Re: Getting HTTP Headers from CGI program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tushar Joshi wrote:
Hi thanks for the reply. I'm writing my applications in C so would have thought there might be a low level way of doing this.

I was asking, just in case you were using Perl. I would then have pointed you to mod_perl and the CGI module, which together allow you to do that kind of thing easily.

But, in general, if this is a CGI program, then it is running as a separate process from Apache itself, and it does not have access to Apache internals. What your program gets is the CGI environment as set up by Apache, but you do not get all the HTTP request headers that way (only some are "translated" by Apache as environment variables for your CGI program).

It would be different if your application, instead of a CGI program, was written as an Apache add-on module. That is possible, but I cannot help you there (other than with Perl).

There may be a possibility however, by using one of the existing Apache modules as a filter, which would take the content of a HTTP request header and turn it into an environment variable which your CGI could then see. I cannot give you any specifics, but I would look at modules such as mod_setenvif, mod_headers, mod_rewrite.
I would start the search here :
http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html#setenvif

Be a bit careful however when you see words like "environment variables". These words do not necessarily have the meaning "environment variables for CGI programs".


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux