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 ?

References (4 earlier) <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 2015-02-03 14:09 +0000
Subject Re: How to write a non blocking SimpleHTTPRequestHandler ?
Newsgroups comp.lang.python
Message-ID <mailman.18427.1422973045.18130.python-list@python.org> (permalink)

Show all headers | 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