PATH_TRANSLATED is one of the most frequently misunderstood server variables, as this following question illustrates...
Hi David !
I have some problem with using function SERVER_CONTEXT->GetServerVariable(.......)
all info query i make in HttpFilterProc with SF_NOTIFY_AUTHENTICATION enabled
i need obtain 'PATH_TRANSLATED' server variable. all fork fine if I request some like http://domain.tld/mydir/some_cgi_script.pl
PATH_TRANSLATED - contain full path to this file ('c:\some_site_root\mydir\some_cgi_script.pl') and e.t.c.
but if i request http://domain.tld/mydir/simple.html PATH_TRANSLATED contain just 'c:\some_site_root' - that's all, no 'mydir' in path and no file name.
Why this happens ? or i'm dooing some wrong. maby exists diff. -> request cgi or request html file ?
I suspect you are trying to obtain the full physical filename referenced by the virtual URL of the request being authenticated.
Through experimentation, you are guessing that PATH_TRANSLATED is supposed to return the full physical filename to you, but unfortunately, your guess is incorrect. According to CGI 1.1 Specification:
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.
A virtual path to the script being executed, used for self-referencing URLs.
As you can see, PATH_TRANSLATED is NOT defined as the "full path to the file" specified by the URL. It is a virtual-to-physical translation of PATH_INFO. And PATH_INFO is the "extra path information" at the end of the CGI script name.
Let me use your examples to illustrate the point. Based on your description, this is your server configuration:
For the following URLs, this is the expected behavior according to CGI 1.1 specification for the server variables PATH_INFO, PATH_TRANSLATED, and SCRIPT_NAME:
Notice that since PATH_INFO for the script "/mydir/simple.html" is empty-string, by definition the virtual-to-physical mapping (aka PATH_TRANSLATED) would be for "/" which would be C:\some_site_root. This is the by-design behavior that you observed.
Now, on IIS6, we added a new server variable, SCRIPT_TRANSLATED, which is the virtual-to-physical mapping of SCRIPT_NAME. It is probably what you are looking for. Prior to IIS6, you will have to calculate and generate this yourself, and PATH_TRANSLATED is not it.