how to translate a virtual path to a physical path in a CGI script

Jarkko Torppa torppa at polykoira.megabaud.fi
Wed Oct 6 08:20:13 EDT 1999


In article <000b8d9b.daa24cc0 at usw-ex0102-015.remarq.com>, raymondjia wrote:
>Hi, all
>
>Can anybody tell me how to translate a virtual path to a physical one
>in a CGI script?  I browsed through the recent topics and couldn't find
>the answer.  Basicly what I need is the equivalent of ASP's
>Server.MapPath().
>
>Is there any Python CGI FAQ page around?

This is not python specific, it is more specific to your webservers cgi
implementation.

apache on unix sets the following environment variables that have the infomation
you seem to be looking for.

PATH_INFO 
       /haloo 
PATH_TRANSLATED 
       /www/htdocs/haloo 
QUERY_STRING 

REQUEST_URI 
       /~torppa/koe.cgi/haloo 
SCRIPT_FILENAME 
       /homes/polykoira/torppa/.public_html/koe.cgi 
SCRIPT_NAME 
       /~torppa/koe.cgi 

the request was for /~torppa/koe.cgi/halloo
/~torppa/koe.cgi is the cgi-bin.

-- 
 Jarkko Torppa                torppa at staff.megabaud.fi
  Megabaud Internet-palvelut




More information about the Python-list mailing list