CGI server by Python

Alex Martelli aleax at aleax.it
Sat Oct 5 10:50:52 EDT 2002


Brian Lee wrote:
        ...
>> > I tested CGIHTTPServer.py in Python 2.2 and found that 
cgi files in
        ...
> But I found environmental variable, $PATH_INFO is not match for my
> code. I searched on Google how PATH_INFO define and how to set
> the variable in server. But I can't find it and just wonder someone
> who know it.

I'm not sure what you mean.  There's one statement:
        env['PATH_INFO'] = uqrest
in CGIHTTPServer.py -- and uqrest is the urllib.unquote'd version
of 'rest', which is determined at the start of method run_cgi by
parsing self.cgi_info appropriately.  What is it you can't find, and
what problems are you experiencing?

As CGIHTTPServer.py itself mentions, a reference page for
environment variables expected by CGI scripts can be found at
http://hoohoo.ncsa.uiuc.edu/cgi/env.html - that page says:
"""
PATH_INFO 
The extra path information, as given by the client. In other words, scripts 
can be accessed by their virtual pathname, followed by extra information at 
the end of this path. The extra information is sent as PATH_INFO. This 
information should be decoded by the server if it comes from a URL before 
it is passed to the CGI script.
"""

So, what is not working as this spec says it should work?


Alex




More information about the Python-list mailing list