httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: Problem with getting custom HTTP header in IHS 2.42.x
Date Mon, 13 Oct 2003 16:00:19 GMT
Swapan Gupta wrote:
> Please find the information inline.
> -----Original Message-----
> From: Jeff Trawick [] 
> Sent: Monday, October 13, 2003 4:29 PM
> To: Swapan Gupta
> Cc:
> Subject: Re: Problem with getting custom HTTP header in IHS 2.42.x
> Swapan Gupta wrote:
>>>I am facing a problem there. When I try to get the HTTP headers, on 
>>>Apache2x I am getting both the Default (such as HTTP_COOKIE, 
>>>HTTP_CONNECTION) and Custom HTTP headers such as HTTP_FOO. But when I 
>>>test the same code on IHS, I see that I am able to only get the default 
>>>HTTP headers and not my Custom HTTP headers.
>>Where do these custom headers come from?  From the original request or 
>>from the response?
>>[Swapan] The custom HTTP headers are generated as part of the response. 
>>However I could not get the headers out of either headers_in or headers_out.
> What is the name of the header field?
> [Swapan] The name of the HTTP header is HTTP_FOO. I am trying to extract 
 >it using the string "FOO"

If the name of the header is HTTP_FOO, then you have to look it up via 
the string HTTP_FOO.

Example:  If the client sends the request header "Content-Length", then 
you have to look it up with the string "Content-Length".

> What generates this header field?  A CGI or a module?
> [Swapan] This header is generated by another module.
> If a module:
>    In which phase does the module set the header? 
> [Swapan] Access Phase
>    Which table does the module put the header? 
> [Swapan] request_rec->headers_in

Why put it in r->headers_in if it is intended for the response?  That 
doesn't sound right.

> In which phase is your module looking for the header field?
> [Swapan] In my module, I look for the header in the Access phase itself.

What have you done to guarantee that your module's access hook runs 
after the access hook of the module that sets this header?

> Which table does your module look in -- headers_out or err_headers_out?
> [Swapan] My module also looks in request_rec->headers_in
> What is the exact code your module uses to try to find this header field 
> in the table?
> [Swapan] Please find the relevant code snippet below:

apr_table_get(r->headers_in, "FOO") will never find "HTTP_FOO" 
regardless of whether you're running IHS or Apache.

Note that for CGIs and mod_ext_filter filters and maybe some other stuff 
(SSI exec= perhaps), ap_add_common_vars() is called, and that maps 
headers such as "FOO" to "HTTP_FOO".  But it doesn't put them in 
r->headers_in; instead it puts them in r->subprocess_env.  I can't see 
where else this magic "HTTP_" prefix can come from.

View raw message