Re: Returning 200 status from my handler

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be2kKHpG9CGyT-9xP2bfHSZEH6uCW0GwSn+Y=jJLgBrbaA@mail.gmail.com>
Hi John,

> I notice, in the getting started documentation, that I am supposed to return
> Apache2::Const::OK to indicate an HTTP 200 success status

Actually, that's not about sending a HTTP 200 success status.  You
return Apache2::Const::OK to tell httpd that your handler ran
correctly.

> When I print out other values of
> constants from the same package they seem to have numeric values which
> directly correspond to their respective HTTP status codes.

True, but it's just due to a lack of imagination on the part of the
httpd developers.  The only constants that intentionally contain valid
HTTP status codes are the Apache2::Const::HTTP_* ones.

> However, it strikes me as a extremely bizarre,
> especially when returning Apache2::Const::HTTP_OK, which does evaluate to
> 200, causes Apache2 to response with a canned error response page

Right because you returned something other than HTTP::Const::OK,
meaning your handler failed and httpd should sound the alarm.

I hope that clears it up for you.  This is a common confusion, so
nothing to feel bad about.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.