David Baird wrote:
Another MM (Maypole Mystery). I think what's happening is that the
ERROR/DECLINED return code is being used as a general mechanism of
signalling an exception, but once the exception is detected, the range
of return values (i.e. it's -1 or it's -1) isn't rich enough to give
any useful information about what to do next. If we had a more general
exception system, where models could throw exception objects, then we
could deal with different conditions better. For example, Mason
handles redirects by throwing a redirect error. Everything gets
dumped, redirect headers are set, and the handler immediately returns.
I've always assumed that DECLINED and ERROR were something magic to do
with mod_perl. But a quick Google found this:
http://httpd.apache.org/docs/1.3/misc/API.html
...
Basic concepts.
...
The handler can typically do one of three things:
* Handle the request, and indicate that it has done so by returning
the magic constant OK.
* Decline to handle the request, by returning the magic integer
constant DECLINED. In this case, the server behaves in all respects as
if the handler simply hadn't been there.
* Signal an error, by returning one of the HTTP error codes. This
terminates normal handling of the request, although an ErrorDocument may
be invoked to try to mop up, and it will be logged in any case.
So it looks to me like its use in Maypole follows this, but either it's
incomplete, or just undocumented so I don't understand how I'm supposed
to use it.
return $status unless $status == OK;
So your non-Maypole return code is preserved, at least for custom
authentication. Note that if debug is turned off, the stanza you quote
is skipped entirely, and the status returned from call_authenticate is
returned immediately.
Exactly! So you get a 500.
No, you get whatever your custom authenticate() method returns. Am I
missing something here? I guess I'll have to actually run some code.
Well I get 500, even if authenticate returns 404:
sub authenticate {
my ($r) = @_;
return 404 if $r->path =~ /static/;
return OK;
}
Server error!
The server encountered an internal error and was unable to complete your
request.
Error message:
Premature end of script headers: beer.cgi
If you think this is a server error, please contact the webmaster.
Error 500
cpepc210-3
Tue Sep 13 11:21:08 2005
Apache/2.0.53 (Linux/SUSE)
Cheers, Dave
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users