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

List:       apache-modperl
Subject:    Re: headers_out vs err_headers_out with temporary redirect 302
From:       Torsten Förtsch <torsten.foertsch () gmx ! net>
Date:       2012-09-05 10:36:24
Message-ID: 50472B28.5020905 () gmx ! net
[Download RAW message or body]

On 09/03/2012 03:59 PM, Anton Petrusevich wrote:
>> From the doc:
> === The difference between headers_out and err_headers_out, is that 
> the latter are printed even on error, and persist across internal 
> redirects (so the headers printed for ErrorDocument handlers will 
> have them). ===

Yes, that's a bit misleading. The point is what exactly is an "error" here.

I think what this statement means is that all of the internal redirect
functions, that is ap_internal_redirect, ap_internal_redirect_handler
and ap_internal_fast_redirect, contain code like this:

  new->err_headers_out = r->err_headers_out;

(The fast_redirect version does it via apr_table_overlay. But that's
only because it does not really create a new request. It simply
transmogrifies the current request to look like the new one.)

That means an ErrorDocument which is an internal redirect uses the
*same* error header table as the original request instead of a copy.

I think this is really all to it.

> It's still unclear to me what to use for temporary 302 redirects, 
> headers_out or err_headers_out? I tried headers_out and it works.
> But probably I am somewhere wrong?

The Location header (what I think you are talking about) is
special-cased in several locations in the code. It is taken from
headers_out or err_headers_out with headers_out taking precedence. I
think it's ap_send_error_response() that does it.

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

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