[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    RE: [Problem] Can't return Content-type with SERVER_ERROR
From:       Stas Bekman <stas () stason ! org>
Date:       2001-07-31 2:32:58
[Download RAW message or body]

On Mon, 30 Jul 2001, Paul Kulchenko wrote:

> Hi, Geoffrey!
>
> > your procedure is correct.  well, except that you can't do what you
> > want :)
> >
> > take a look at http_protocol.c -
> >
> > 'r->content_type = "text/html; charset=iso-8859-1";' is hardcoded
> > in ap_send_error_response(), so it's an apache thing and not a
> > mod_perl thing...
> Absolutely true to my surprise. That means you can't return proper
> content-type and content-encoding with non-OK codes, Apache will
> rewrite it for you anyway, which is too human-oriented and imho
> should be corrected. I ended up generating usual successful response
> with custom status (which is 500 in my case):
>
>   $r->status($self->response->code);
>   $self->response->headers->scan(sub { $r->header_out(@_) });
>   $r->send_http_header(join '; ', $self->response->content_type);
>   $r->print($self->response->content);
>   &Apache::Constants::OK;
>
> Probably worth mentioning in FAQ or somewhere. It took quite a bit of
> my time.

I've added it to the guide.

> Best wishes, Paul.


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic