On Fri, Jan 16, 2004 at 07:36:59AM -0800, Marko Faldix wrote:
> > See:
> > http://hoohoo.ncsa.uiuc.edu/cgi/env.html
> Read it, thanks for this link. What is wrong with PATH_TRANSLATED?
It's the PATH_INFO translated -- and PATH_INFO is the path *after* the
script name. So it may not even exist. And if it doesn't exist then
PATH_TRANSLATED doesn't exist. At least that's one thing in the
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.
The server provides a translated version of PATH_INFO, which takes the
path and does any virtual-to-physical mapping to it.
> > Can you report back what IIS returns?
> Yes, here reduced to what we need. I put it into
> C:\home\mydir\swish\test.cgi and called http://localhost/swish/test.cgi
> which returns
> GATEWAY_INTERFACE : CGI/1.1
> HTTP_HOST : localhost
> OS : Windows_NT
> PATH : C:\Perl\bin\;C:\Programme\Swish-E;C:\Programme\SWISH-E\lib\swish-e;
> PATH_INFO : /swish/test.cgi
> PATH_TRANSLATED : C:\home\mydir\swish\test.cgi
> REQUEST_METHOD : GET
> SCRIPT_NAME : /swish/test.cgi
> SERVER_NAME : localhost
> SERVER_SOFTWARE : Microsoft-IIS/5.0
> IIS does not have variable SCRIPT_FILENAME!
Right -- not part of the "standard".
Just guessing, but Apache was smart enough to realize that the standard
didn't provide a way to get to the script's path so added
Microsoft, being Microsoft, decided to just change the standard by
changing the meaning of PATH_INFO and PATH_TRANSLATED. Does MS do this
crap on purpose, you suppose?
> If I had the path to the directory where the called swish.cgi is, I could
> take this directory as my default to look for configuration
> file, appreciating same code for both Apache and IIS. So PATH_TRANSLATED or
> SCRIPT_NAME seems to be useful.
> Would you suggest to prefer SCRIPT_NAME?
SCRIPT_NAME is not useful. It's the URL path, which may or may not have
any relation to the real path of the file.
What about other environment vars on IIS? APPL_PHYSICAL_PATH?
If the Internet is the Information Super Highway, why doesn't Microsoft
get their driver's license revoked for breaking so many rules of the
Received on Fri Jan 16 16:33:43 2004