This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author k.s.solnushkin
Recipients k.s.solnushkin
Date 2014-04-21.19:05:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398107131.28.0.812868414728.issue21323@psf.upfronthosting.co.za>
In-reply-to
Content
Somewhere between Python 3.3 and 3.4, a bug was introduced that forbids the "http.server" module, working in CGI server mode, to run scripts residing in subdirectories.

This will break existing software that relies on this feature.

How to reproduce the bug:

1. Create a temporary directory and enter it.
2. Create a directory "cgi-bin", and then directory "test" inside "cgi-bin".
3. Create a file "test.py" in "cgi-bin/test" with the following contents (see also attachment to this bug report):

print("""Content-type: text/plain

CGI script executed successfully!
""")

4. When run, it should print the following:

Content-type: text/plain

CGI script executed successfully!

5. Now, run Python 3.3 in CGI HTTP server mode:

c:\Python33\python.exe -m http.server --cgi 8000

A request to "http://localhost:8000/cgi-bin/test/test.py" then produces the following in the HTTP server log:

Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [21/Apr/2014 22:59:11] "GET /cgi-bin/test/test.py HTTP/1.0" 200 -
127.0.0.1 - - [21/Apr/2014 22:59:11] command: c:\Python33\python.exe -u C:\TMP\cgi-bin\test\test.py ""
127.0.0.1 - - [21/Apr/2014 22:59:11] CGI script exited OK

6. Now, try this with Python 3.4, and the request will fail with the following in the log:

C:\TMP>c:\Python34\python.exe -m http.server --cgi 8000
Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [21/Apr/2014 23:02:38] code 403, message CGI script is not a plain file ('/cgi-bin/test')
127.0.0.1 - - [21/Apr/2014 23:02:38] "GET /cgi-bin/test/test.py HTTP/1.0" 403 -

This _could_ be related to the change introduced by issue 19435, although I am not sure.

Tested with Windows XP SP3.
History
Date User Action Args
2014-04-21 19:05:31k.s.solnushkinsetrecipients: + k.s.solnushkin
2014-04-21 19:05:31k.s.solnushkinsetmessageid: <1398107131.28.0.812868414728.issue21323@psf.upfronthosting.co.za>
2014-04-21 19:05:31k.s.solnushkinlinkissue21323 messages
2014-04-21 19:05:30k.s.solnushkincreate