http://qs1969.pair.com?node_id=842030

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

So, anyway . . . I've got two near-identical Windows 2003 servers - live and test.

I have the same version of IIS (6.0) installed on both servers, but different versions of Perl.

On the live server, I have ActiveState 5.8.8. On the test server, I have Strawberry 5.12

I have the same script on both servers. The script begins like this:

use FindBin qw($Bin $Script); use lib "$FindBin::Bin/../lib"; use strict; use warnings; use Text::CSV; use CGI; use CGI::Session; use Net::LDAP; use DBI; use LWP::Simple;

I then define $session:

my $cgi = new CGI; my $session = new CGI::Session(undef, $cgi, {Directory=>'c:\temp'});

and I define the subroutine, output_header, to output the beginnings of a web-page:

sub output_header { my $current_session = $_[0]; my $wrb_url = $_[1]; # so what about the NPH thing?! print $current_session->header(-nph=>1); # print $current_session->header(); print <<ENDOFTEXT; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> ... [loads of HTML stuff goes here . . . ] ... ... </head> ENDOFTEXT }

I then call my subroutine:

output_header($session, $wrb_url);

Note: you can disregard $wrb_url - it's not important. The rest of the script works fine and just outputs the rest of a web-page, including the final </body> and </html> tags. In fact, the problems SEEM to start before the <head> tag, possibly something to do with the HTTP stuff sent right at the beginning. On the test server, the browser returns CGI Error, with the line under that reading: 'The specified CGI application misbehaved by not returning a complete set of HTTP headers.'. The live server works fine. The only difference I've been able to spot in the HTTP is the inclusion of the following line on the live server:

Cookie: CGISESSID=52308b820ff99fd3d4dca46c4b7a5280

[obviously the value of CGISESSID changes] This line is absent in the HTTP from the test server. I've been tearing my hair out trying to work out what on earth is wrong and why I'm getting that CGI error. Anyone?