httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Swapan Gupta" <>
Subject RE: Problem with getting custom HTTP header in IHS 2.42.x
Date Mon, 13 Oct 2003 12:02:14 GMT

Please find the information inline.

-----Original Message-----
From: Jeff Trawick [] 
Sent: Monday, October 13, 2003 4:29 PM
To: Swapan Gupta
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

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

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.

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:

string CApacheServer::GetHeader( const char *Name ) const
       const char*   header = apr_table_get(m_pReqRec->headers_in, Name );
        if ( header == NULL )
            Log( LOGLEVEL_DEBUG, "GetHeader> %s=\"\"", Name );
            return "";

        Log( LOGLEVEL_DEBUG, "GetHeader> Returning %s=\"%s\"", Name, header );
        return header;

bool Process(CApacheServer Server)
	string value = Server.GetHeader("FOO");		// PS - This does not return anything. The value
is NULL.
	.	// Other functionality


int foo_header_processor( request_rec *pReq )

        config_struct *pConfig = (config_struct *) ap_get_module_config(pReq->per_dir_config,

        CApacheServer Server( pReq );

        if ( !Process( Server ) )
            Log(LOGLEVEL_INFO, "Returning DONE.");
            return DONE;
            Log(LOGLEVEL_INFO, "Returning DECLINED.");
            return DECLINED;


static void foo_register_hooks(apr_pool_t* p)

module foo_module = {


This code works fine when the GetHeader method is invoked passing something like "COOKIE"
or "CONNECTION" as a parameter (i.e., it returns the value of that header). However, when
this method is invoked using "FOO" or any other header that is set to by the other module,
as parameter, it does not get the Header value.

Please note that the code works in case ApacheServer 2.x setup, but does not in case of HIS
2.x setup.

Any pointers?????

View raw message