in reply to Creating a "Progress" page with CGI

See "Watching long processes through CGI".

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: Creating a "Progress" page with CGI

Replies are listed 'Best First'.
Re^2: Creating a "Progress" page with CGI
by jfroebe (Parson) on Dec 06, 2005 at 19:04 UTC

    Hi Randal,

    The "Lines 1 through 3 begin nearly every CGI program I write: enabling taint checking, compiler restrictions, and disabling the buffering of standard output." in your article doesn't hold true any more for Apache 2. Specifically the "$|++;" which does disable the buffering at the perl level but not within Apache v2. :(

    The method to use now is forking the process in the background and providing updates. Roy Johnson provides the link to the redirection discussion.

    Update: I remembered my tests wrong. My apologies to Merlyn.

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      The "Lines 1 through 3 begin nearly every CGI program I write: enabling taint checking, compiler restrictions, and disabling the buffering of standard output." in your article doesn't hold true any more for Apache 2. Specifically the "$|++;" which does disable the buffering at the perl level but not within Apache v2. :(
      Uh, you're apparently confused. I'm unbuffering the connection between the forked Perl process and Apache. That doesn't matter whether it's Apache 1 or Apache 2. That's to keep unbuffered and buffered output from intermixing badly to STDOUT, so that the header doesn't appear after some of the body content, for example.
      The method to use now is forking the process in the background and providing updates. Roy Johnson provides the link to the redirection discussion.
      And the technique shown is indeed "fork and continue the process in the background". Did you read the article?

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Hi Randal,

        Actually I did many times both on the web and also in the book. Anyways, I didn't explain myself clearly enough. Sorry about that. With Apache 2, the unbuffering at the perl level doesn't seem to make any difference (atleast with my testing).

        update: nevermind. I remembered my test wrong. ugh.. must be too close to monday

        Jason L. Froebe

        Team Sybase member

        No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1