You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2001/05/20 00:04:07 UTC

Re: cvs commit: httpd-2.0/modules/metadata mod_headers.c

On Sat, May 19, 2001 at 08:12:06PM -0000, stoddard@apache.org wrote:
>...
>    static void register_hooks(apr_pool_t *p)
>    {
>   -    ap_hook_fixups(fixup_headers, NULL, NULL, APR_HOOK_MIDDLE);
>   -} 
>   +    ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST);
>   +    ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST);
>   +    ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter, AP_FTYPE_CONTENT);
>   +}

Is there a particular reason that the insert_filter call and the fixups need
to be APR_HOOK_LAST? If not, then it would be "better" to use
APR_HOOK_MIDDLE.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/modules/metadata mod_headers.c

Posted by Ben Laurie <be...@algroup.co.uk>.
Graham Leggett wrote:
> 
> Greg Stein wrote:
> 
> > >   +    ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST);
> > >   +    ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST);
> > >   +    ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter, AP_FTYPE_CONTENT);
> > >   +}
> >
> > Is there a particular reason that the insert_filter call and the fixups need
> > to be APR_HOOK_LAST? If not, then it would be "better" to use
> > APR_HOOK_MIDDLE.
> 
> Fiddling with headers ideally should be done at the last point before
> the request headers hit the content generator, and the last minute
> before the response headers hit the browser.
> 
> This is so that "Header(In|Out) unset Header" has the chance to modify a
> particular header without a filter bypassing it. For example - someone
> might want to override the Cache-Control: header, but this would be
> impossible if the cache filter ran after the headers filter.
> 
> (In fact one could argue that this should really be
> APR_HOOK_REALLY_LAST, because a cache filter is likely to be
> APR_HOOK_LAST).

I think this should then be APR_HOOK_LAST+1, or, more likely, cache
filters should name the header filter as a successor.

APR_HOOK_REALLY_LAST is really intended for internal use only...

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Re: cvs commit: httpd-2.0/modules/metadata mod_headers.c

Posted by Graham Leggett <mi...@sharp.fm>.
Greg Stein wrote:

> >   +    ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST);
> >   +    ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST);
> >   +    ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter, AP_FTYPE_CONTENT);
> >   +}
> 
> Is there a particular reason that the insert_filter call and the fixups need
> to be APR_HOOK_LAST? If not, then it would be "better" to use
> APR_HOOK_MIDDLE.

Fiddling with headers ideally should be done at the last point before
the request headers hit the content generator, and the last minute
before the response headers hit the browser.

This is so that "Header(In|Out) unset Header" has the chance to modify a
particular header without a filter bypassing it. For example - someone
might want to override the Cache-Control: header, but this would be
impossible if the cache filter ran after the headers filter.

(In fact one could argue that this should really be
APR_HOOK_REALLY_LAST, because a cache filter is likely to be
APR_HOOK_LAST).

Regards,
Graham 
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."