Is there an efficient method to get request header by value?

Maxim Dounin mdounin at mdounin.ru
Mon Jul 28 13:44:10 UTC 2014


Hello!

On Mon, Jul 28, 2014 at 09:21:07PM +0800, Andy wrote:

> Hi dev,
> 
> My code need to parse some private request headers, is there any method
> already in the core to do this job, get the request header by header value?
> I don't want to iterate the array one by one to compare the key. I see only
> some standard headers are set in the request_headers_in hash table.

You mean "by header name"?
There are two possible ways:

- iterate through the r->headers_in list;

- provide a way to configure variable or a complex value instead 
  of a hardcoded private header name, and use $http_<header> by 
  default.

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



More information about the nginx-devel mailing list