Request Headers In a CGI

Michael Foord fuzzyman at
Fri Sep 10 16:32:46 CEST 2004

Sam Holden <sholden at> wrote in message news:<slrnck2sab.9d5.sholden at>...
> On 10 Sep 2004 02:02:23 -0700, Michael Foord <fuzzyman at> wrote:
> > Is it possible to get at the http request headers in a normal CGI ?
> >
> > I can't touch the server, so I can't install anything like mod_python.
> > I've tried googling but the answer seems to be 'no'.
> >
> > I know I can reconstruct *most* headers from the environment variables
> > - is this my only option ? I've heard of 'non-parsed headers', but I
> > don't know how to use them from within a python cgi....
> Non-parsed headers are unrelated - they involve the web server not
> parsing the CGI response headers but instead sending them directly to
> the browser.
> What you want can't be done. You can reconstruct most of what you want
> via the environment, but not all of it. HTTP Authentication passwords
> leap to mind.

Ok, thanks.
It's a shame because I'm writing a CGI proxy - which means the user
will have to put their username and password into a form for me, I
can't just proxy their request headers........... (not that that was
unproblematic anyway).



More information about the Python-list mailing list