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

Paul Robinson paul.robinson at quantisci.co.uk
Mon Oct 11 05:27:40 EDT 1999


In article <14331.34861.43390.369768 at dolphin.mojam.com>,
  skip at mojam.com (Skip Montanaro) wrote:
>
>     >> Currently I am running IIS
 ...
>     >> I managed to write a mappath() function yesterday, which
substracts
>     >> PATH_INFO from PATH_TRANSLATED to derive the document root,
and join
>     >> the given logial path to it.  This way is definitely not
reliable, is
>     >> it?
>
> Unfortunately, no, it's not.  On Apache at least (and probably on
other web
> servers as well), you can define lots of mappings between virtual
paths and
> absolute paths within the same server.
 ...
> Given that, it may be possible to rummage around in the config file
and
> build a list of potential directories where files could be located,
then try
> locating the file using that list.

In IIS the same config information is in the registry at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Vi
rtual Roots

These can be extracted using Python in order to make the deduction
about the physical location of the virtual directories.

    Paul.


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list