On 9/13/05, Dave Howorth <[EMAIL PROTECTED]> wrote:
> David Baird wrote:
> > 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

Just had a look at CGI::Maypole. The headers are printed in
send_output(). So if you return a status code any time before running
send_output, then the headers won't get printed. When the handler
returns a status code, but nothing has been printed, CGI.pm signals an
error.

At first glance this looks like a structural problem in Maypole.
Different frontends need things to happen in a different sequence, but
the only place they get to change things is send_output, right at the
end. Apache::MVC also sets the headers in send_output, but they get
communicated to Apache in a different way, and I think mod_perl
probably handles skipping this stage more elegantly. But then, my
sites run on MasonX::Maypole, which takes over sending the headers to
Apache slightly earlier. And I still haven't run any code to test
this.

d.


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

Reply via email to