No headers filter for a subrequest

Maxim Dounin mdounin at mdounin.ru
Mon Mar 16 13:58:20 UTC 2015


Hello!

On Mon, Mar 16, 2015 at 04:27:56PM +0300, Marat Dakota wrote:

> And one more question. I've noticed that I'll have to
> copy-paste ngx_http_header_val_s definition too (because it is defined in
> .c file) and this is a risk to have different structures when something is
> changed in nginx and my module still have the previous version.

That's an internal structure to store the module configuration 
information.  As long as you are adding your own module, you may 
use a different structure for this, or avoid it at all if it's 
not needed by your module.

> Another idea is to mock r->main and put it back after. Something like this
> in my header filter:
> 
>     main = r->main;
>     r->main = r;
>     rc = ngx_http_next_header_filter(r);
>     r->main = main;
> 
> This works for my current simple tests. Is this a completely bad idea?

This is a dirty hack and will result in undefined behaviour.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list