STDERR going to browser with IIS Perl.exe

STDERR going to browser with IIS Perl.exe

am 27.10.2008 01:12:30 von lyle

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

HTTP Error 502.2 - Bad Gateway


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
".



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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: STDERR going to browser with IIS Perl.exe

am 27.10.2008 04:12:01 von Bill Luebkert

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
>

HTTP Error 502.2 - Bad Gateway


>

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
> ".


>
> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: STDERR going to browser with IIS Perl.exe

am 27.10.2008 12:18:53 von Brian Raven

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
>

HTTP Error 502.2 - Bad Gateway


>

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
> ".


>
> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs