BaseHTTPServer ThreadMixIn not working

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Oct 5 02:08:20 EDT 2011


En Mon, 03 Oct 2011 12:03:18 -0300, amit <wilson.amit at gmail.com> escribió:

> I am really stuck in a very simple problem and wanted to know if you
> could take some time to check it out -
>
> My code is simple. Using BaseHTTPServer and ThreadInMix I want to run
> a python script (Script1.py) for every request made simultaneously.
> [...]
>
> If I open multiple tabs/pages in Chrome/Firefox/IE and give URL:
> http://localhost:8080, the pages wait for previous page? This does not
> imply threading? Any help? Thanks

Your code is fine, and Python behaves correctly. The browser is queuing  
all similar requests when it sees they all refer to the same URI. Had the  
first response contained an Expires: header in the future, there would be  
no need to ask again for the same object; the ETag: and Last-Modified:  
headers may play a role too. So, only after the first response is  
completely read, Chrome/Firefox/IE sees it is invalid and knows she cannot  
re-use the received body and has to issue the second request and waits  
again and ...

Try with different URLs for each request:
http://localhost:8080/a
http://localhost:8080/b
http://localhost:8080/c
and you'll see they all are processed in parallel.


-- 
Gabriel Genellina




More information about the Python-list mailing list