CGI question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rohan

    CGI question

    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
  • Diez B. Roggisch

    #2
    Re: CGI question

    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

    Comment

    • Rohan

      #3
      Re: CGI question

      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.


      Comment

      • Poppy

        #4
        Re: CGI question

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


        "Rohan" <nrohan@gmail.c omwrote in message
        news:bf1929ee-647b-4046-b1ea-d693020503a2@w1 g2000prd.google groups.com...
        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.
        >
        >

        Comment

        Working...