Im currently working on a Web C ++ application using FastCGI with Apache and mod_fcgid.
I am trying to get request headers, but I have not found how to do this. After some research, I thought the headers were in the "envp" attribute of "FCGX_Request", but it contained environment variables such as:
REMOTE_ADDR: 192.168.0.50 SERVER_SOFTWARE: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0f DAV/2 mod_fcgid/2.3.6 REDIRECT_UNIQUE_ID: TxytP38AAAEAABpcDskAAAAE FCGI_ROLE: RESPONDER HTTP_ACCEPT_LANGUAGE: fr SERVER_SIGNATURE: <address>Apache/2.2.21 [etc.]
These variables offer me useful information, but I need real HTTP headers, and especially Cookie. I tried to read FCGX_Request in stream "in", but it seems to be for the request body (POST data). Since my application is for multithreading, I use "FCGX_Accept_r ()", for example:
while(true) { FCGX_Init(); FCGX_Request* fcgiRequest = new FCGX_Request; FCGX_InitRequest(fcgiRequest, 0, 0); if(FCGX_Accept_r(fcgiRequest) < 0) break; Request* request = new Request(fcgiRequest); request->process(); }
But actually I do not use streams. Requests are executed one by one.
How to get request headers?
Thanks.
source share