Hi Graham,

Here is the test handler I've used :

from mod_python import apache

def handler(req):
    req.content_type = 'text/plain'
    req.write(req.hlist.directory+'\n')
    req.write(req.filename+'\n' )
    return apache.OK

If I use :

DocumentRoot "c:\\apache22\\htdocs"
<Directory "c:\\apache22\\htdocs">
   # ...
    SetHandler mod_python
    PythonHandler test_handler
</Directory>

I get, when calling http://localhost/index.html:

c:\apache22\htdocs/
C:/apache22/htdocs/index.html
Note that the drive letter has been uppercased and req.filename normalized to POSIX path names. req.hlist.directory, though supported by Win32, looks weird.

Now with :

DocumentRoot "c:/apache22/htdocs"
<Directory "c:/apache22/htdocs">
   # ...
    SetHandler mod_python
    PythonHandler test_handler
</Directory>

I get :

c:/apache22/htdocs/
C:/apache22/htdocs/index.html
With :

DocumentRoot "c:/apache22/htdocs"

<Directory "c:\\apache22\\htdocs">
   # ...
    SetHandler mod_python
    PythonHandler test_handler
</Directory>

I get :

c:\apache22\htdocs/
C:/apache22/htdocs/index.html

And finally with :

DocumentRoot "c:\\apache22\\htdocs"
<Directory "c:/apache22/htdocs">
   # ...
    SetHandler mod_python
    PythonHandler test_handler
</Directory>

I get :
c:/apache22/htdocs/
C:/apache22/htdocs/index.html

So req.filename seems always normalized while req.hlist.directory reflects what was entered in the Directory tag. Both POSIX and Windows forms are allowed, unfortunately, but the backslash forms needs C-style escaping, and IIRC the Apache documentation recommends using forward slashes.

Regards,
Nicolas
2006/4/16, Graham Dumpleton <[EMAIL PROTECTED]>:
I am sure I asked this a long time ago, but have forgotten all the
details.

On Win32 systems does req.filename set by Apache always use POSIX
style forward slashes, ie., '/', to separate components of a
directory? Thus:

   /some/path

How does Apache indicate a drive letter when one is necessary? Is it:

   c:/some/path

Does any of the above change based on whether forward or backward
slashes are used in a Directory directive? Ie.,

   <Directory c:/some/path>
   ...
   </Directory?

vs:

   <Directory "c:\\some\\path>
   ...
   </Directory>

Or does Apache not allow the latter anyway?

If Apache does allow the latter, does that mean that req.hlist.directory
is coming through set including backslashes rather than forward
slashes.

I want to get my head around this all again as at different times the
values
of req.filename and req.hlist.directory are used to determine the Python
interpreter name. As highlighted in:

   http://issues.apache.org/jira/browse/MODPYTHON-161

If there is a mix of conventions, with user code also being able to
affect
these values, there may be no consistency and thus could end up with
scenarios where a different interpreter to one than was expected will be
used.

Any help from Win32 users in understanding all this would be much
appreciated.

Thanks.

Graham

Reply via email to