Stefan Wehr
mail at stefanwehr.de
Sat May 13 11:16:33 EDT 2006
Hi all, I need to send headers directly to the client; that is, before mod_python sends its headers (I know that I have to handle the status line specially). Background: I need to detect when the user hits the 'Cancel' button of the browser. The only reliable way to do this seems to send something periodically to the client. My idea is now to send dummy headers to the client until the possibly long running HTML code generating function is finished. Then I stop sending dummy headers and send the HTML code to the client. If the client hits 'Cancel' while the HTML code generating function is running, I'm able to detect this because I get some kind of error when sending a dummy header. The problem is now: how can I send the dummy headers? I cannot use 'req.write' because this flushes all headers (note that some headers can be set only *after* HTML has been generated). My idea was then to use 'req.connection.write'. The problem with this approach is that this function does *not* trigger an error if the connection is closed. I also fiddled around with the 'req.connection.aborted' field without success. Any help would be greatly appreciated. Cheers, Stefan
|