Reading "Accept" header from module

Igor Sysoev is at rambler-co.ru
Wed Feb 11 12:41:14 MSK 2009


On Wed, Feb 11, 2009 at 09:29:24AM +0000, Chris Farmiloe wrote:

> Enabling NGX_HTTP_HEADERS in the main build seems to give
> me trouble... so I'll have a go at fetching things via  
> ngx_http_get_variable

You need to add

have=NGX_HTTP_HEADERS . auto/have

in your <module>/config file.

> thanks.
> 
> Chris
> 
> 
> >Hello!
> >
> >On Tue, Feb 10, 2009 at 04:42:08PM +0000, Chris Farmiloe wrote:
> >
> >>Is the "Accept" header content made available on the request struct
> >>anywhere? Or if there is an easy way to grab it from the raw headers?
> >>
> >>.... defining NGX_HTTP_HEADERS seems to give me unpredictable results
> >>when reading the data on request struct.
> >
> >It should be in r->headers_in->accept.  Please note that
> >NGX_HTTP_HEADERS have to be defined for the whole nginx build, not
> >just your module.
> >
> >Alternatively, you may just lookup $http_accept variable via
> >ngx_http_get_variable().  This will work even without
> >NGX_HTTP_HEADERS defined (and will trigger logic in
> >ngx_http_variable_unknown_header_in() for arbitrary http header
> >lookup).
> >
> >Maxim Dounin
> >
> 

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list