CGI question

Diez B. Roggisch deets at nospam.web.de
Mon May 26 06:02:05 EDT 2008


Rohan wrote:

> Hi
> 
> I have python-CGIs for my web application running on apache 2.
> Few of the CGIs run for a long time.
> 
> When such a CGI is running and user presses "Stop" button of browser
> (or connection is aborted) how can I identify such situation and
> terminate
> the CGI.
> I don't want the CGI to complete the processing and terminate when it
> tries to write to client pipe.
> It would be good to terminate it as soon as client connection is
> aborted.
> 
> How can I achieve this?

The only way I can think of is to regularly output something inside the CGI,
and thus make it fail in the very moment the pipe is closed.

But I didn't try that myself - and if it doesn't work I don't think you
stand a chance, because that's the way sockets work - there is no
signalization beyond that, and even if it were it's not propagated across
CGI.

Diez



More information about the Python-list mailing list