Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Monks,
I have written several CGI programs to perform a variety of tasks, and every now and again this appears at the top of the page:
 HTTP/1.1 200 OK Date: Wed, 05 May 2004 09:08:27 GMT Server: Apache/1.3.6 (Unix) PHP/4.3.2 mod_perl/1.21 mod_ssl/2.2.8 OpenSSL/0.9.2b Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html  a26 ...along with sporadic alpha-numeric combinations throughout the rest of the content eg:
<td bgcolor="#dddddd">4</td> 23 <td bgcolor="#dddddd">Sysadmin</td> 1c <td bgcolor="#dddddd">3</td> 24 <td bgcolor="#dddddd">permanent</td> 28 <td bgcolor="#dddddd">1020343455</td> 5 </tr> 3f
Any ideas what this could be?
It occurs about 1% of the time and of course unpredictably ie: I could load the same page 100 times and maybe I'll get this weird result. It also doesn't appear to make any difference what the content is. It could just be a simple program to produce a frameset using the CGI module. It also never occurs locally on my ibook macosx, only on webservers.
Help/ideas appreciated.

traxlog

Replies are listed 'Best First'.
Re: Why does my CGI script sometimes first show headers and then content?
by bradcathey (Prior) on May 05, 2004 at 11:04 UTC
    Indeed, it is hard to imagine what's happening. Are you using "print 'Content-type: text/html" more than once? Is it possible that some runnings of your script route through a second printing of the header? It can only happen once in a script. See my own question and the helpful replies here.

    —Brad
    "A little yeast leavens the whole dough."
Re: Why does my CGI script sometimes first show headers and then content?
by rupesh (Hermit) on May 05, 2004 at 10:29 UTC
             It occurs about 1% of the time and of course unpredictably...

    If you could post your code (the source of your problem), it would be easier to diagonize.
Re: Why does my CGI script sometimes first show headers and then content?
by Anonymous Monk on May 06, 2004 at 10:17 UTC
    Solved.

    The webserver is using some kind of CGI-wrapper. When it times out after 15 seconds all hell breaks loose.
    Nothing to do with my scripts after all!

    Thanks anyway.