STDERR going to browser with IIS Perl.exe

Hi All,
Every time I've setup ActivePerl on IIS, be it IIS 5, 6 or now 7,
everything I print to STDERR gets sent to the browser.

This can cause some weird problems. This simple test script:-

#!perl
print "Content-type:text/plain\n\n";
print "TEST\n";
print STDERR "STDERR test\n";


Causes the following error on IIS7
<h2>HTTP Error 502.2 - Bad Gateway</h2>
<h3>The specified CGI application misbehaved by not returning a
complete set of HTTP headers. The headers it did return are "STDERR test
Content-type:text/plain

TEST
".</h3>

So even though the STDERR test is printed last, it's going to the
browser first.

Is this a problem with IIS config? Any pointers?


Lyle

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lyle [ Mo, 27 Oktober 2008 01:12 ] [ ID #1974990 ]

Re: STDERR going to browser with IIS Perl.exe

Lyle wrote:
> Hi All,
> Every time I've setup ActivePerl on IIS, be it IIS 5, 6 or now 7,
> everything I print to STDERR gets sent to the browser.
>
> This can cause some weird problems. This simple test script:-
>
> #!perl
> print "Content-type:text/plain\n\n";
> print "TEST\n";
> print STDERR "STDERR test\n";
>
>
> Causes the following error on IIS7
> <h2>HTTP Error 502.2 - Bad Gateway</h2>
> <h3>The specified CGI application misbehaved by not returning a
> complete set of HTTP headers. The headers it did return are "STDERR test
> Content-type:text/plain
>
> TEST
> ".</h3>
>
> So even though the STDERR test is printed last, it's going to the
> browser first.
>
> Is this a problem with IIS config? Any pointers?

Try unbuffering stdout - chances are your stdout is not getting
out till after the stderr print. $| = 1;
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Bill Luebkert [ Mo, 27 Oktober 2008 04:12 ] [ ID #1974991 ]

RE: STDERR going to browser with IIS Perl.exe

Lyle <> wrote:
> Hi All,
> Every time I've setup ActivePerl on IIS, be it IIS 5, 6 or now 7,
> everything I print to STDERR gets sent to the browser.
>
> This can cause some weird problems. This simple test script:-
>
> #!perl
> print "Content-type:text/plain\n\n";
> print "TEST\n";
> print STDERR "STDERR test\n";
>
>
> Causes the following error on IIS7
> <h2>HTTP Error 502.2 - Bad Gateway</h2>
> <h3>The specified CGI application misbehaved by not returning a
> complete set of HTTP headers. The headers it did return are "STDERR
> test Content-type:text/plain
>
> TEST
> ".</h3>
>
> So even though the STDERR test is printed last, it's going to the
> browser first.
>
> Is this a problem with IIS config? Any pointers?

I am not a CGI expert, but it was my understanding that anything written
to STDERR was normally directed to the error log. I know nothing of IIS,
but I would hope that it could be configured to do the same.

Of course your post leads to the question of why you are writing
directly to STDERR. If you are using CGI::Carp, you can direct error
messages to STDOUT, STDERR, or a log file of your choice.

HTH

--
Brian Raven

------------------------------------------------------------ -----------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Brian Raven [ Mo, 27 Oktober 2008 12:18 ] [ ID #1974992 ]
Perl » gmane.comp.lang.perl.active-perl » STDERR going to browser with IIS Perl.exe

Vorheriges Thema: Email::MIME
Nächstes Thema: Win32-API-0.55 problem