[mod_python] Re: sending headers directly to the client

Graham Dumpleton grahamd at dscpl.com.au
Mon May 15 05:31:22 EDT 2006


On 15/05/2006, at 4:46 PM, Mike Looijmans wrote:

> When the user submits the request, immediately return a page that  
> says something like "processing your request, please wait...".
>
> The simplest thing to do is to just output that on the result page,  
> and flush() the request output. Then do as you normally do.
>
> The "please wait" could be removed with javascript or so.
>
> Another option is to first return a "please wait" HTML page. This  
> page has a redirect header, that loads the actual result page. The  
> user gets to see the redirecting page until the result page is done.

Noting though that you may need a caching system for the result of  
database
query which is accessible from multiple processes. This is because if  
Apache
prefork MPM being used, or even worker with multiple processes, the
subsequent request to get the results of the query will not  
necessarily end
up at the same Apache child process. Thus, you can't rely on caching  
within
an Apache child process.

Graham

>
> Mike Looijmans
> Philips Natlab / Topic Automation
>
>
> Stefan Wehr wrote:
>> Hi!
>> Mike Looijmans <nlv11281 at natlab.research.philips.com> wrote::
>>> First explain what is so special about your request that you  
>>> cannot just send out regular data and have to delay sending the  
>>> response headers?
>> Answering some of our requests can take up to 30 seconds. We often
>> have the problem that users are getting nervous, hit the 'Cancel'
>> button of their browser, and reload the page. Now our system tries to
>> answer two requests, which can lead to strange results: The database
>> transaction started by the first request wins over the database
>> transaction started by the second request, although the user
>> explicitly stopped the first request.
>>> Awaiting your reply - could a simple (periodic) redirect solve  
>>> your problem?
>> How what such a redirect work?
>> Stefan
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list