Graham Dumpleton
Mon, 17 Apr 2006 14:24:39 -0700
Was this with mod_python from subversion or 3.2.8? Want to qualify whether latest set of changes I checked in to support Files directive has caused it to behave differently as how it determines req.hlist.directory is different to before. Thanks. Graham On 18/04/2006, at 4:33 AM, Nicolas Lehuen wrote:
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.htmlNote 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.htmlSo 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, Nicolas2006/4/16, Graham Dumpleton <[EMAIL PROTECTED]>: I am sure I asked this a long time ago, but have forgotten all thedetails. 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.directoryis coming through set including backslashes rather than forward slashes. I want to get my head around this all again as at different times the valuesof req.filename and req.hlist.directory are used to determine the Pythoninterpreter 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 withscenarios where a different interpreter to one than was expected will beused. Any help from Win32 users in understanding all this would be much appreciated. Thanks. Graham