Re: CGI: Running a forked background process



Hal Vaughan <hal@xxxxxxxxxxxxxxxxxxxx> wrote:
I have a web page (served up by Apache 2) where a user click a link to
download a file. The link calls my Perl CGI script which takes the
parameters and generates a file to download. It takes time to generate
the file, so my idea was to fork like this:

....

I've found, though, that the fork is not working. When I click on the
link, I get a LONG pause and eventually the countdown page appears, but
only after the forked program is done with it's work.

The child program is holding onto the STDOUT and STDERR that it inherited
from the parent. Apache knows that STDOUT is not yet closed, and therefore
assumes the CGI isn't done yet and holds the connection to the browser open
(or something like that.) The forked process needs to close or reopen
STDOUT/STDERR in order to cut the web browser free.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: CGI: Running a forked background process
    ... The link calls my Perl CGI script which takes the ... parameters and generates a file to download. ... The child program is holding onto the STDOUT and STDERR that it inherited ... STDOUT/STDERR in order to cut the web browser free. ...
    (comp.lang.perl.misc)
  • Re: get list of files
    ... Fredrik Lundh schrieb: ... download the files. ... With yyy = ftp.retrlinesI get this listing at stdout, ...
    (comp.lang.python)
  • Re: get list of files
    ... download the files. ... With yyy = ftp.retrlinesI get this listing at stdout, ... How can I resolve this problem? ...
    (comp.lang.python)
  • Re: CGI: Running a forked background process
    ... Hal Vaughan wrote in ... The link calls my Perl CGI script which takes the ... parameters and generates a file to download. ... comp.lang.perl.misc guidelines on the WWW: ...
    (comp.lang.perl.misc)