Our perl CGI scripts output response headers repeately which were inserted into the output html contents. a sample code:
use strict;
use CGI;
$|=1;
my $q = new CGI();
print $q->header("text/html"), $q->start_html("test");
print "aa";
print $q->end_html ;
outputs the following on browser:
HTTP/1.1 200 OK Connection: close Date: Sat, 07 Nov 2009 21:34:27 GMT Content-Type: text/html; charset=ISO-8859-1 Server: Microsoft-IIS/6.0 aaHTTP/1.1 200 OK Connection: close Date: Sat, 07 Nov 2009 21:34:27 GMT Content-Type: text/html; charset=ISO-8859-1 Server: Microsoft-IIS/6.0
if I remove the line "$|=1", then it outputs:
aa
If I run the script above from command line, it also outputs:
aa
seems everytime the script output something, IIS always automatically append the same response header to the output. So if I change the above script to:
use strict;
use CGI;
$|=1;
my $q = new CGI();
print $q->header("text/html"), $q->start_html("test");
print "<br>aa";
print "<br>bb<br/>";
print $q->end_html ; it now outputs the following on browser:
HTTP/1.1 200 OK Connection: close Date: Sat, 07 Nov 2009 21:41:32 GMT Content-Type: text/html; charset=ISO-8859-1 Server: Microsoft-IIS/6.0
aa
bb
HTTP/1.1 200 OK Connection: close Date: Sat, 07 Nov 2009 21:41:32 GMT Content-Type: text/html; charset=ISO-8859-1 Server: Microsoft-IIS/6.0
did anybody experience the same issue? how do I fix this?
the server is windows 2003 std with service pack 1, running IIS 6.0. same script runs ok on other server that has the same version of software running.
Thanks,
--mmpower