[issue1684] CGIHTTPServer does not chdir prior to executing the CGI script
Fazal Majid
report at bugs.python.org
Sat Dec 22 02:05:27 CET 2007
Fazal Majid added the comment:
There isn't any normative reference that I know of, in fact the default
behavior is different on Unix and Windows.
Apache 2.2 (and most certainly older versions as well) implements this
in mod_cgi.c. The relevant lines:
/* Transmute ourselves into the script.
* NB only ISINDEX scripts get decoded arguments.
*/
if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
((rc = apr_procattr_io_set(procattr,
e_info->in_pipe,
e_info->out_pipe,
e_info->err_pipe)) != APR_SUCCESS) ||
((rc = apr_procattr_dir_set(procattr,
ap_make_dirstr_parent(r->pool,
r->filename))) !=
APR_SUCCESS) ||
apr_procattr_dir_set sets the cwd for the child subprocess
ap_make_dirstr_parent is equivalent to os.path.dirname.
As the default behavior is system-dependent, it should not be hardcoded
but some sort of hook should provided to allow implementing either the
UNIX or Windows semantics.
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1684>
__________________________________
More information about the Python-bugs-list
mailing list