Reason for storing duplicate copies of response header value e.g. content_encoding in headers_out

Rv Rv rvrv7575 at
Fri Jul 11 11:50:37 UTC 2014

Nginx stores the response headers in the headers ngx_http_headers_out_t

ngx_list_t                        headers
 and also for certain headers , in a corresponding variable in headers_out
e.g.     ngx_table_elt_t                  *content_encoding;

The body filter e.g. gunzip  operate only on content_encoding variable.
So after the gunzip filter executes, the content_encoding value in the headers variable will be gzip (because the response was received as compressed and the content encoding was gzip) but the value of content_encoding variable will be blank because the gunzip filter would have decompressed the content and therefore the content encoding is no longer gzip.

Are all the body filters than expected to look at the variable within the headers_out structure  ? If so what is the use case of maintaining (possibly) different values for the same headers at different places
Thanks for any answers    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list