in reply to Re: Response timeout solution
in thread Response timeout solution

If you need to have the complete response sent within 60 seconds, the first thing I'd do were to stop using CGI.

CGI has nothing to do with that. It's my computations.

If you have to just send something within 60 seconds, immediately print out some reply (let's assume 200 OK is good), and keep printing bogus headers until you have the response ready.

This I think is what I probably need. Could you give me an example. Say, there is a loop where I do some computations. How can I push something back to the client in every iteration?
What do you mean by printing bogus headers?

Replies are listed 'Best First'.
Re^3: Response timeout solution
by Corion (Patriarch) on Jun 14, 2011 at 07:20 UTC

    I mean headers that contribute nothing to the response, just to show the client that "things are still going on". You might need to switch off buffering so that the client sees these headers and gets these as quickly as possible:

    Status: 200 OK X-Bogus-Header: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X-Bogus-Header: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ... X-Bogus-Header: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Type: text/html <html> <body> ...
      You might need to switch off buffering so that the client sees these headers and gets these as quickly as possible:

      How to switch buffering off ?
      But my computations which take 60sec+ start after
      <html> <body> ...

        But my computations which take 60sec+ start after

        Then see Re^3: Response timeout solution, or change your program so it does the

        my $data = calculation (); print content_type(), htmlFrom($data);
Re^3: Response timeout solution
by Anonymous Monk on Jun 14, 2011 at 03:12 UTC