HI Pavel,

Your messages include a lot of good details, but they are a bit long. I'd
suggest trying to keep things as short as you can.  Remember that everyone
working on open source is a volunteer, spending their own personal time to
read and answer your messages.

On Sun, Aug 31, 2014 at 4:15 PM, Pavel V. <pavel2...@ngs.ru> wrote:
> I completely misunderstand, why we need to return HTTP_* codes from
ModPerl handlers.
> Why Apache::OK or Apache::SERVER_ERROR are not enough?

Returning HTTP status code constants from a handler is legal and expected.
 See "Return Values" here:
http://httpd.apache.org/docs/2.4/developer/modguide.html

> Can anybody explain, why this was needed with mp1?

Sure.  CGI scripts don't have return values, since they are standalone
scripts and not subroutines.  They set status by sending the headers  out.
 A proper handler can do this with the return code, but if you do that,
your script won't be correct under mod_cgi anymore.  Many people needed
their scripts to run under both, so the workaround was to set $r->status()
if you detect a mod_perl environment, and Registry would pick that up and
use it as the return code.

It might have been better to do something different that would have left
status untouched, like set an $ENV variable, but I suspect people were
already trying to set $r->status() directly and Doug just wanted to make
that work.  Registry has always been a balance between porting CGI scripts
and allowing people to do more mod_perl-specific things.

> Why we are unable to left $r->status, the new value set by script,
untouched?

I believe this is because we want the server to get the response code from
the handler and set the status itself.

> After reading mailing list I understand what nothing will change in
nearest .... century.
> Sorry to bother you.

There's no need to be rude.  It's not a simple situation with a simple
answer.  This is why the recent versions of Registry were designed to be
easy to override.  It's impossible to please everyone with one set of
behavior.  Most people who are trying to do things involving status codes
end up switching over to writing handlers, which is a better approach if
you're not concerned about your code working under mod_cgi.

- Perrin

Reply via email to