httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [users@httpd] Re: CGI Child Process Question
Date Sat, 21 Mar 2009 11:02:59 GMT
Lihet Ruben wrote:
I would look at this in another way.
A cgi-bin program is a separate process from the Apache child that runs
it.  The Apache process starts the cgi-bin process, and arranges to read
back everything that the cgi-bin writes to STDOUT.  Then Apache sends
this to the browser.  In-between, there is buffering, so as someone
pointed out, it is possible that after your cgi-bin has already finished
its job of producing the output and has exited, Apache is still busy
sending some chunks of output to the browser, and then the user cancels.
In that case, your script would think that everything has been sent,
while this is not the case.

What I would thus do, is to implement your logic of verifying that the
user has received everything, in an Apache output filter.  It is still
not perfect, but much "closer" to the browser. If the user interrupts
the connection by hitting cancel, the filter would know, because it
would get an i/o error when writing to the response socket.  And it
could notify your application.

Now understand that if your client is behind a proxy that does
buffering, then the proxy will still hold some data, while Apache is
long done and the filter has told your application that everything was
sent. And the user can still hit cancel then.

So ultimately, to be 100% sure, the only solution is to ask the user,
when he has finished downloading, to acknowledge receipt.

I cannot think of an easy way to do that with a standard browser, but I
can imagine a Java applet which gets the file from your server, writes
it to a local file, and when it is done, makes a POST to the server to
say it was done.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message