You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Philip Mak <pm...@aaanime.net> on 2003/07/19 01:15:23 UTC

Why HTTP Code 200 instead of 500?

I got this from Apache::ASP:

HTTP/1.1 200 OK
Date: Fri, 18 Jul 2003 23:13:35 GMT
Server: Apache/1.3.27 (Unix) mod_deflate/1.0.19 mod_accel/1.0.30
Cache-Control: private
Content-Type: text/html
Transfer-Encoding: chunked

19a5
<tt>
<b><u>Errors Output</u></b>
<ol>

<li> unknown class 'Files' at /usr/lib/perl5/site_perl/5.6.1//Tangram/Schema.pm 
...

This was from a script that had an error in it. But why did it return
HTTP code 200 instead of 500? Is there a way I can make it return 500
when there is an error? (This is a script that will be called by
another program, and that program uses the HTTP code to know if
something is wrong.)

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Why HTTP Code 200 instead of 500?

Posted by Joshua Chamas <jo...@chamas.com>.
It might make more sense, however its been working this way for so many years, 
I hesistate to change the behavior at this point.  From a development 
perspective, having it output 200 status is easiest because Apache will render 
that code no problem, otherwise one might have to start dealing with error 
document rendering & that kind of thing.

Regards,

Josh

Quoting Philip Mak <pm...@aaanime.net>:

> On Fri, Jul 18, 2003 at 10:24:20PM -0400, Joshua Chamas wrote:
> > This is what happens when Debug is set to higher than 1/-1.  You
> > might have settings of 2/-2 or 3/-3, which renders errors pretty
> > HTML format like this.
> 
> Wouldn't it make more sense for the server to return an HTTP code of
> 500 (and still display the error on the screen)? This way,
> applications that call the ASP script and rely on seeing an HTTP error
> code to know if something is wrong will not be fooled. Website status
> monitoring applications are another thing that may think all is well
> if they see HTTP 200 OK. I use "Debug 2" sometimes even in production
> environments.
> 
> I know there are some browsers that don't display HTTP 500 code
> messages sometimes, but only when they are under 512 bytes long, and
> all Apache::ASP error pages would be more than that length I think.
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Why HTTP Code 200 instead of 500?

Posted by Philip Mak <pm...@aaanime.net>.
On Fri, Jul 18, 2003 at 10:24:20PM -0400, Joshua Chamas wrote:
> This is what happens when Debug is set to higher than 1/-1.  You
> might have settings of 2/-2 or 3/-3, which renders errors pretty
> HTML format like this.

Wouldn't it make more sense for the server to return an HTTP code of
500 (and still display the error on the screen)? This way,
applications that call the ASP script and rely on seeing an HTTP error
code to know if something is wrong will not be fooled. Website status
monitoring applications are another thing that may think all is well
if they see HTTP 200 OK. I use "Debug 2" sometimes even in production
environments.

I know there are some browsers that don't display HTTP 500 code
messages sometimes, but only when they are under 512 bytes long, and
all Apache::ASP error pages would be more than that length I think.

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Why HTTP Code 200 instead of 500?

Posted by Joshua Chamas <jo...@chamas.com>.
This is what happens when Debug is set to higher than 1/-1.  You might have 
settings of 2/-2 or 3/-3, which renders errors pretty HTML format like this.

--Josh

Quoting Philip Mak <pm...@aaanime.net>:

> I got this from Apache::ASP:
> 
> HTTP/1.1 200 OK
> Date: Fri, 18 Jul 2003 23:13:35 GMT
> Server: Apache/1.3.27 (Unix) mod_deflate/1.0.19 mod_accel/1.0.30
> Cache-Control: private
> Content-Type: text/html
> Transfer-Encoding: chunked
> 
> 19a5
> <tt>
> <b><u>Errors Output</u></b>
> <ol>
> 
> <li> unknown class 'Files' at
> /usr/lib/perl5/site_perl/5.6.1//Tangram/Schema.pm
> ...
> 
> This was from a script that had an error in it. But why did it return
> HTTP code 200 instead of 500? Is there a way I can make it return 500
> when there is an error? (This is a script that will be called by
> another program, and that program uses the HTTP code to know if
> something is wrong.)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org