Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85150

Re: How to write a non blocking SimpleHTTPRequestHandler ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <amirouche.boubekki@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:bitbucket': 0.05; 'socket': 0.07; 'http': 0.09; 'rewrite': 0.09; 'subject:How': 0.10; 'python': 0.11; "wouldn't": 0.14; '-&gt;': 0.16; '[1].': 0.16; 'blocking': 0.16; 'imo,': 0.16; 'non-blocking': 0.16; 'stuff,': 0.16; 'subject:non': 0.16; 'think.': 0.16; 'prevent': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'library': 0.18; 'bit': 0.19; 'else,': 0.19; 'written': 0.21; 'feb': 0.22; '2.x': 0.24; 'headers': 0.24; 'tue': 0.24; "i've": 0.25; '&gt;': 0.26; 'to:2**1': 0.27; '[1]': 0.29; 'patch': 0.29; '[2]': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'exceptions': 0.31; 'though.': 0.31; 'stuff': 0.32; 'url:python': 0.33; 'comment': 0.34; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; 'url:listinfo': 0.36; 'possible': 0.36; 'url:org': 0.36; 'level': 0.37; 'server': 0.38; 'url:library': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'catch': 0.60; 'matter': 0.61; 'simply': 0.61; 'first': 0.61; 'high': 0.63; '2015': 0.84; 'asynchronous': 0.84; 'subject:skip:S 20': 0.91; 'ports': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=kaZmXFSSgX55ELK+ZcVipg4H9b1vG5hPKXGnvK8L0Xo=; b=Ab9pnz+nYElhxV1RefAtTV3dVqoBoRQfndjwGwfK0P8buyn0xL1iEldPsBbOQs7PoG 7mbXtTV9MPl3hOgwQbYi2CeVNwbi3ze5o9XKbgdwNYMODNWezGfsq4HjfNe48F2AQzU4 7PhU/PGzkv9PlPO9FmmxNfvU4MepZUmGZiUEBlf6zmtNQa+kkaG5HQovhjAEZ7a3+XIC 8UyvoaIre4yR9w/jlvym7Hhz8+L1zlKIbt1f6Mbg5C3hfcJHUW2Ti9LlCupYlOXUA978 UhmR6yxZWwdinuXcQcMhkw+IBjAHEJ/iSP2muqA6CcIvfcsK32tqQbOMrms/UowKdoIl 06Xw==
X-Received by 10.152.9.170 with SMTP id a10mr24458360lab.1.1422972592465; Tue, 03 Feb 2015 06:09:52 -0800 (PST)
MIME-Version 1.0
References <mailman.18397.1422871634.18130.python-list@python.org> <47031e69-e94d-4257-8c7d-e7c00a543634@googlegroups.com> <874mr3ibve.fsf@elektro.pacujo.net> <c0e17d52-4978-48fd-8848-30426ea42e14@googlegroups.com> <mailman.18420.1422960897.18130.python-list@python.org> <b6cb0fcb-9934-41b6-a8f6-902d26f2588c@googlegroups.com> <mailman.18421.1422961678.18130.python-list@python.org> <87r3u7grd3.fsf@elektro.pacujo.net> <e6d081df-1db0-41a3-905c-e3c2845d5dda@googlegroups.com>
From Amirouche Boubekki <amirouche.boubekki@gmail.com>
Date Tue, 03 Feb 2015 14:09:51 +0000
Subject Re: How to write a non blocking SimpleHTTPRequestHandler ?
To Yassine Chaouche <yacinechaouche@yahoo.com.dmarc.invalid>, python-list@python.org
Content-Type multipart/alternative; boundary=001a1132f49ae62fa7050e2f9f53
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18427.1422973045.18130.python-list@python.org> (permalink)
Lines 111
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422973045 news.xs4all.nl 2875 [2001:888:2000:d::a6]:43642
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85150

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

> The standard library and nonblocking can't be used in the same sentence.

python 2.x stdlib has no high level support of *async* code. There is
trollius library that ports asyncio to py2 though.

I was a bit quick in my first anwser. What you want is to prevent the
socket to wait indefinetly for data (based on strace output) which is done
with socket.setblocking/settimeout [1]. asynchronous (asyncio) is something
else, and you would still need to handle blocking I think.

There is contentbrowser [2] which is somekind of web proxy.

IMO, python 2 -> python 3 is not a big leap. Some things are better in
python 3.


[1] https://docs.python.org/2/library/socket.html#socket.socket.setblocking
[2] https://bitbucket.org/david/contentbrowser/src





On Tue Feb 03 2015 at 2:00:27 PM Yassine Chaouche
<yacinechaouche@yahoo.com.dmarc.invalid> wrote:

> On Tuesday, February 3, 2015 at 12:35:32 PM UTC+1, Marko Rauhamaa wrote:
>
> > So far I've been happy with select.epoll(), socket.socket() and ten
> > fingers.
> > Marko
>
> There's already software written to take care of much of the HTTP stuff
> protocol stuff, the headers etc. I wouldn't rewrite it. I prefer to monkey
> patch parts of existing code rather then rewrite all of it.
>
> But your comment is interesting because, as I understand it, a
> non-blocking web server is simply a matter of setting timeouts on sockets,
> catch the exceptions and move on. I don't know why wouldn't that be
> possible with python stdlib ?
>
>
> > The standard library and nonblocking can't be used in the same sentence.
>
> ?
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: How to write a non blocking SimpleHTTPRequestHandler ? Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2015-02-02 10:07 +0000
  Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 01:08 -0800
    Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 11:27 +0200
      Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 02:47 -0800
        Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-03 21:54 +1100
          Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 03:04 -0800
            Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-03 22:07 +1100
              Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 03:23 -0800
              Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 13:35 +0200
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 04:56 -0800
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 15:45 +0200
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-04 01:03 +1100
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 16:20 +0200
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-02-03 20:25 -0500
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-04 00:21 +1100
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2015-02-03 14:09 +0000
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 06:50 -0800
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Filadelfo Fiamma <philosganga@gmail.com> - 2015-02-03 16:03 +0100
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-03 16:39 +0000
                Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-08 06:13 -0800
            Re: How to write a non blocking SimpleHTTPRequestHandler ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-03 12:10 +0000

csiph-web