[mod_python] Mod-Python Help

Mike Looijmans nlv11281 at natlab.research.philips.com
Thu Sep 7 08:40:41 EDT 2006


> Thanks for the help. My packet sniffer is looking at the packets, and instead
> of a new packet header, all these req.flush() calls are keeping the
> connection
> alive. Unfortunately, the javascript xmlhttprequest will only process the
> packet once, instead of during every call to req.flush().

In fact, the TCP connection will outlive the HTTP request if you use 
KeepAlive (which is default on HTTP/1.1).

The problem is not with mod_python, it's with your xmlhttprequest. If 
that reads from the request until the end, you have to change it and 
make it do something before the stream ends.

> Is there a way to close the connection and open it again afterwards? I'm
> trying to get the xmlhttprequest.onreadystatechange to process after each
> call
> to req.flush().

Yes, there's a very simple way. Just send a new HTTP request for every 
"chunk" you want to process.

Note that ONLY the client can OPEN connections. Both client and server 
may close connections as they see fit. So if you want to open a 
connection, you must do so at the client side. Once closed (by any side) 
a connection can never be re-opened and you'll have to make a new one.

Mike.



More information about the Mod_python mailing list