I'm looking to get a header which will use Apache, IIS 6, and IIS 7. I will not enter in the reason for your here. Let us just state that it is not as simple as I figured it might be :-)

Anyway, the issue has something related to NPH. Within our code (initially written for IIS 6) we've

use CGI qw(:standard);

print "HTTP/1.0 200 OK\n";

print header;

towards the top of every cgi script I just read that this is the way you know IIS that you would like NPH.

Apache uses the filename to ascertain if the output is nph (nph- should be the start of the filename) what exactly Used to do (which works both in IIS 6 and Apache) may be the following:

use CGI qw(:standard);
print header('text/html', '200 OK');

IIS 7, oddly enough, appears to require NPH, therefore if I do not either do

use CGI qw(:standard -nph);


print "HTTP/1.0 200 OK\n";

print header('text/html', '200 OK'); #parameters are apparently optional

the browser tries to behave strange using the file, because it does not obtain the mimetype.

Also note: IIS 6 and 7 are ok without printing any header whatsoever, but Apache does not like this.

Anyway, the very best factor at this time is always to make

use CGI qw(:standard);
print header('text/html', '200 OK');

in some way operate in IIS 7. Does anybody understand how I'm able to do this? I'm not sure all of the particulars for the server configuration, but when you know me ways to get any particulars you will need, I'm able to do this.

Thanks in either case!

I'd just produce a subroutine that does the best factor with respect to the server. Guess what happens you need to do in every situation, so simply do that for the reason that situation.

Another choice is to patch CGI.pm to create its $CGI::NPH variable properly by searching in the server type. CGI.pm already has got the fundamentals there. When you fix that, submit an area.

Best of luck :)

John (yet others) have explained to create a subroutine that will Perform The Right Factor. Hope this can help another person!

sub header {
    return (($ENV{PERLXS})?"HTTP/1.0 200 OK\r\n":"").CGI->header(@_);