
|
If you were logged in you would be able to see more operations.
|
|
|
| Resolution Date: |
07/May/06 02:11 PM
|
|
When you have Apache ".htaccess" configuration like:
SetHandler mod_python
#PythonPath "['/Users/grahamd/Sites/auth']+sys.path"
<Files "page1.txt">
PythonHandler page1::handler_txt
</Files>
<Files "page2.txt">
PythonHandler page2::handler_txt
</Files>
and "page1.txt" is accessed, the req.hlist.directory attribute, which is supposed to list the name of the directory the PythonHandler directive was used in, gets set to "page1.txt/" instead.
This value then gets added into "sys.path". Because it doesn't actually identify the directory, the module "page1" cannot actually be found when the import is performed.
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: Traceback (most recent call last):
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 288, in HandlerDispatch\n log=debug)
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 508, in import_module\n f, p, d = imp.find_module(parts[i], path)
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: ImportError: No module named page1
The only workaround at this point is to explicitly define the PythonPath directive to include the directory the modules and ".htaccess" file are in. Not sure yet whether there is a way in Apache of determining the directory the "Files" directive is used in and set "req.hlist.directory" correctly.
|
|
Description
|
When you have Apache ".htaccess" configuration like:
SetHandler mod_python
#PythonPath "['/Users/grahamd/Sites/auth']+sys.path"
<Files "page1.txt">
PythonHandler page1::handler_txt
</Files>
<Files "page2.txt">
PythonHandler page2::handler_txt
</Files>
and "page1.txt" is accessed, the req.hlist.directory attribute, which is supposed to list the name of the directory the PythonHandler directive was used in, gets set to "page1.txt/" instead.
This value then gets added into "sys.path". Because it doesn't actually identify the directory, the module "page1" cannot actually be found when the import is performed.
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: Traceback (most recent call last):
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 288, in HandlerDispatch\n log=debug)
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 508, in import_module\n f, p, d = imp.find_module(parts[i], path)
[Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: ImportError: No module named page1
The only workaround at this point is to explicitly define the PythonPath directive to include the directory the modules and ".htaccess" file are in. Not sure yet whether there is a way in Apache of determining the directory the "Files" directive is used in and set "req.hlist.directory" correctly. |
Show » |
made changes - 09/Apr/06 02:16 PM
| Field |
Original Value |
New Value |
|
Assignee
|
|
Graham Dumpleton
[ grahamd
]
|
made changes - 09/Apr/06 02:17 PM
|
Status
|
Open
[ 1
]
|
In Progress
[ 3
]
|
made changes - 24/Apr/06 06:29 AM
|
Resolution
|
|
Fixed
[ 1
]
|
|
Status
|
In Progress
[ 3
]
|
Resolved
[ 5
]
|
|
Fix Version/s
|
|
3.3
[ 12310101
]
|
made changes - 07/May/06 02:09 PM
|
Resolution
|
Fixed
[ 1
]
|
|
|
Status
|
Resolved
[ 5
]
|
Reopened
[ 4
]
|
made changes - 07/May/06 02:11 PM
|
Status
|
Reopened
[ 4
]
|
Resolved
[ 5
]
|
|
Resolution
|
|
Fixed
[ 1
]
|
made changes - 07/May/06 02:11 PM
|
Comment
|
[ Reopened because using PythonInterpPerDirective in conjunction with dynamically registered filters causes mod_python to crash. Problem code is in select_interp_name().
py_handler *fh;
if (fname) {
if (is_input) {
fh = (py_handler *)apr_hash_get(conf->in_filters, fname,
APR_HASH_KEY_STRING);
} else {
fh = (py_handler *)apr_hash_get(conf->out_filters, fname,
APR_HASH_KEY_STRING);
}
s = fh->directory;
}
else {
s = hle->directory;
}
For a dynamically registered filter, fname is "mod_python" and the context provided with the filter handler is used to get details of dynamically registered filter. This information isn't available or used by select_interp_name() which assumes that filter is part of globally registered filters. It will not find the filter and so "fh" is NULL and accessing directory attribute causes a crash.
]
|
|
made changes - 05/Apr/07 11:47 AM
|
Status
|
Resolved
[ 5
]
|
Closed
[ 6
]
|
|