CGI question

R

Rohan

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?

Any help is appreciated!

Thanks
Rohan
 
D

Diez B. Roggisch

Rohan said:
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
 
R

Rohan

Thanks Diez for your suggestion.
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.

I also thought of this, but this looks little crude approach.
The problem seems very generic I was wondering if it could be handled
more
gracefully by some configuration in Apache or cgi script.

Apache process handling the request would close the connection with
client,
but it won't notify anything to spawned CGI process, so it keeps
running.
 
P

Poppy

Can you consider a webservice under something like CherryPY, rather than
cgi? It may provide more options.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top