You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jean-Michel Hiver <jh...@mkdoc.com> on 2004/03/11 17:54:02 UTC

[mp1] Apache::Registry, PerlSendHeaders and 404 Not Found

Hi List,

When doing the following:

* Using Apache::Registry
* Using PerlSendHeader On
* Sending a custom 404 Not Found response from the Apache::Registry script

I get a very strange behavior. In the response, Apache sends:

* the custom 404 headers PLUS
* the custom 404 html generated by the script PLUS
* Apache's default ErrorDocument

Under mod_cgi, Apache sends only the first two elements of the above list.

Does it sound familiar?
Any ideas?

Cheers,
Jean-Michel.


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp1] Apache::Registry, PerlSendHeaders and 404 Not Found

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Jean-Michel Hiver wrote:
> Hi List,
> 
> When doing the following:
> 
> * Using Apache::Registry
> * Using PerlSendHeader On
> * Sending a custom 404 Not Found response from the Apache::Registry script
> 
> I get a very strange behavior. In the response, Apache sends:
> 
> * the custom 404 headers PLUS
> * the custom 404 html generated by the script PLUS
> * Apache's default ErrorDocument
> 
> Under mod_cgi, Apache sends only the first two elements of the above list.
> 
> Does it sound familiar?
> Any ideas?

this is a very common situation.  basically, you can't throw an error (such
as return NOT_FOUND or call die) after you have printed anything in
Registry, since the first print effectively calls $r->send_http_headers
behind the scenes.  mod_cgi buffers the entire response before calling
ap_send_http_headers, which is why they are different.  such is the price
you pay for speed.

I'm pretty sure that at least the Eagle book talks about this aspect of
programming with Registry, but I'm sure you'll find it in the guide
somewhere as well.

HTH

--Geoff


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html