Skip Menu |

This queue is for tickets about the Maypole CPAN distribution.

Report information
The Basics
Id: 14570
Status: open
Priority: 0/
Queue: Maypole

People
Owner: Nobody in particular
Requestors: dave [...] riverside-cms.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.09
  • 2.10
  • 2.10_pre1
  • 2.10_pre2
  • 2.10_pre2a
  • 2.10_pre3
Fixed in: (no value)



Subject: Returning error codes breaks Maypole::CGI
Returning an error code directly from early stages in the workflow breaks CGI::Maypole, because send_ouput is skipped. send_output() is responsible for printing headers, if that doesn't happen, all return codes become a 500 server error (premature end of script headers). There may be similar issues with other frontends, haven't tested. d.
[DAVEBAIRD - Tue Sep 13 07:13:34 2005]: Show quoted text
> Returning an error code directly from early stages in the workflow > breaks CGI::Maypole, because send_ouput is skipped. send_output() > is responsible for printing headers, if that doesn't happen, all > return codes become a 500 server error (premature end of script > headers). > > There may be similar issues with other frontends, haven't tested. > > d.
What do you mean by 'returning error codes', http errors or internal maypole values? Can you give an example?
[TEEJAY - Tue Oct 11 14:46:24 2005]: Show quoted text
> [DAVEBAIRD - Tue Sep 13 07:13:34 2005]: >
> > Returning an error code directly from early stages in the workflow > > breaks CGI::Maypole, because send_ouput is skipped. send_output() > > is responsible for printing headers, if that doesn't happen, all > > return codes become a 500 server error (premature end of script > > headers). > > > > There may be similar issues with other frontends, haven't tested. > > > > d.
> > What do you mean by 'returning error codes', http errors or internal > maypole values? > > Can you give an example? > >
Sorry, returning *any* status code is broken. Say $r->call_authenticate returns anything != Maypole::Constants::OK (might be -1 i.e. Maypole::Constants::DECLINED, or 302 or 403 etc). handler_guts() will immediately return that value to handler(), and handler() will immediately return that value to the server. $r->send_output() is not called, and it is send_output that is responsible for setting up the response headers. So under CGI, you'll get a 'premature end of script headers' error. Under mod_perl, not sure what you'd get, but probably not what you expect, because send_output() is also responsible for setting up response headers in Apache::MVC. I suspect this may relate to the mystery of why Maypole::Constants::DECLINED and Mp::C::ERROR are both -1 - don't know what that code signifies to Apache (probably DECLINED?), but it may be relevant, and Simon may have assumed that the only non-OK values returned from handler() will be -1. send_output() should perhaps be split into 2 methods, one to print the headers, the other to print the content. Don't print the headers for DECLINED or ERROR, do for other status codes. d.