httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <>
Subject Re: Sending http headers for 3xx responses
Date Mon, 27 Dec 2010 12:48:35 GMT

On 27 Dec 2010, at 12:30, cronfy wrote:

> > Thanks, I tried it. Currently filter function looks like this:
> >
> > static apr_status_t procinfo_filter(ap_filter_t *f,
> >                                    apr_bucket_brigade *b)
> Why are you doing this in a filter?  You should be manipulating
> the response *body* in a filter, but the *headers* in a processing hook.
> I did not know about that. As I said, I've taken code from mod_expires, and it modifies
headers via filter.
> What hook should I use to manipulate headers *AFTER* content generation was finished?

The headers commonly get sent to the client *BEFORE* content generation is finished.
That's one reason it's rarely a good idea to manipulate them in a filter.

Though with the code you posted it doesn't look like *the* problem, provided
your filter is ahead of HTTP in the filter chain.

> > With no luck for 3xx responses. It works even for 404 Not Found, but not for 3xx.
> Where does the 3xx come from?  Is it a script, or something using the
> same (util_script) processing path like mod_asis?  Or a hooked function?
> I tested 304 response for usual static file, and 304 response generated by php script.
Headers were not set in both cases.

I guess where 304 runs legitimately, it knows there's no response body to filter
(because it's forbidden by the HTTP spec), so it's not running content filters at all.
But I couldn't say for sure OTTOMH.

Nick Kew
View raw message