Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-04-23 Thread Yassine Chaouche
Here is a simple multi-threaded python web application that uses only the stanard library modules : #!/usr/bin/env python #-*- encoding=utf-8 -*- import SimpleHTTPServer import BaseHTTPServer import SocketServer class MyServer(SocketServer.ThreadingMixIn,BaseHTTPServer.HTTPServer): pass

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-04-23 Thread Yassine Chaouche
Hello, I wanted to make a little update on this thread. The problem is solved, and while debugging my application I learned that it is actually possible to have multithreaded or multi-process web application in python using only the standard library. A longer explanation, along with minimal wo

Re: bottle.py app doesn't timeout properly ?

2015-04-15 Thread Yassine Chaouche
Here's a traceback I generated by catching a SIGINT and printing an exception : Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line

bottle.py app doesn't timeout properly ?

2015-04-13 Thread Yassine Chaouche
Hello, I have written a script using bottle.py. The app works fine most of times. Sometimes though, the server takes time to respond and the web browser eventually drops the connection to the server after a certain time (timeout), showing this page : """ Connection reset The connection to th

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-08 Thread Yassine Chaouche
On Tuesday, February 3, 2015 at 3:17:37 PM UTC+1, Amirouche Boubekki wrote: > 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 t

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
On Tuesday, February 3, 2015 at 3:17:37 PM UTC+1, Amirouche Boubekki wrote: > 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] Exactly ! thanks for taking time to reading my original post a second t

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
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 pref

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
Thanks Chris, it's only a matter of time, I'll eventually make the transition to python3 when I'll learn it well enough. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
> > Thanks Marko. It's a lost cause then. > > You trimmed out the part where he mentioned asyncio. :) > > ChrisA IIRC asyncio is python 3 only and I'm not ready yet to make the leap. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
On Tuesday, February 3, 2015 at 10:27:11 AM UTC+1, Marko Rauhamaa wrote: > The standard library and nonblocking can't be used in the same sentence. Thanks Marko. It's a lost cause then. I am thinking about switching to one of the following : - CherryPy - Bottle - circuits - Quixote - Weblay

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
Thank you Amirouch. I was hoping to use something very simple and already provided by the standard library. If I can fix the script, the better. If the script can't be fixed, then I'll switch to another library (I already have one in mind). -- https://mail.python.org/mailman/listinfo/python-l

Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-03 Thread Yassine Chaouche
Hello Irmen, > Why? If you have multiple threads serving some requests at the same time, > doesn't that > already achieve your goal? Having multiple requests running at a time is one thing. Making them non-blocking is another. That's how I understand it. > In other words, have you tried what