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.

Title: CGIHTTPServer doesn't handle path names with embeded space
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
Status: closed Resolution: wont fix
Dependencies: 1681674 Superseder:
Assigned To: Nosy List: BreamoreBoy, ajaksu2, akuchling, georg.brandl, htgoebel, rosslagerwall
Priority: normal Keywords: patch

Created on 2006-08-06 19:43 by htgoebel, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
CGIHTTPServer.patch htgoebel, 2007-03-14 21:22 Patch for using subprocess against r54234
Messages (11)
msg50837 - (view) Author: Hartmut Goebel (htgoebel) Date: 2006-08-06 19:43
This is a patch for Bug #1436206:

On Windows, if the path name of a CGI script to be run
contains space characters, it need to be quoted
properly when called via os.popen2/3. Otherwise the
script can not be executed.

Solved by using commands.mkarg() to quote arguments
where necessary.
msg50838 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-10-27 17:54
Logged In: YES 

Would it simplify matters if CGIHTTPServer used the
subprocess module, which tries to provide a
platform-independent interface?
msg50839 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-13 19:36
Note that commands.mkarg() is written for UNIX shells. While it may work with spaces in the file name, it may produce illegal Windows command line commands in other cases.
msg50840 - (view) Author: Hartmut Goebel (htgoebel) Date: 2007-03-14 21:22
I think the best way to solve this would be to use the
subprocess module, as amk suggested.

I included a new patch which for CGIHTTPServer which uses subprocess. Unfortunately 
this does not work ion Windows due to a problem with subprocess: On Windows 
passing the request.rfile (a _fileobject wrapper arround the socket) as stdin/out
lead to an error. I'll file a bugreport on that case.

Beside of this, the patch should solve the problem in a platform-independent way.
File Added: CGIHTTPServer.patch
msg50841 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-15 07:48
Which error is that? Is it perhaps this: ?
msg50842 - (view) Author: Hartmut Goebel (htgoebel) Date: 2007-03-15 09:05
No, the error it's related to (and maybe
msg50843 - (view) Author: Hartmut Goebel (htgoebel) Date: 2007-03-15 19:35
The bugreport I spoke of has been filed as
msg83902 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-03-21 00:31
Issue 1681674 was closed as won't fix, so IIUC this patch won't work.
msg114813 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-24 20:04
A patch that includes unit tests and doc changes is presumably needed to take this forward.
msg126310 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-01-15 04:57
Shouldn't this be closed? CGIHTTPServer *has* been updated to use subprocess on windows and the dependency has been closed as wont fix.
msg126318 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-01-15 08:44
Right, closing this one too.  Thanks!
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43787
2011-01-15 08:44:19georg.brandlsetstatus: open -> closed

messages: + msg126318
resolution: wont fix
nosy: akuchling, georg.brandl, htgoebel, ajaksu2, BreamoreBoy, rosslagerwall
2011-01-15 04:57:21rosslagerwallsetnosy: + rosslagerwall
messages: + msg126310
2010-08-24 20:04:07BreamoreBoysetnosy: + BreamoreBoy

messages: + msg114813
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
2009-04-05 13:48:59georg.brandllinkissue1436206 superseder
2009-04-05 13:48:59georg.brandlunlinkissue1436206 dependencies
2009-03-21 00:31:22ajaksu2setdependencies: + subprocess.Popen fails with socket._fileobject on Windows
type: behavior
versions: + Python 2.6
nosy: + ajaksu2

messages: + msg83902
stage: test needed
2009-03-21 00:27:31ajaksu2linkissue1436206 dependencies
2006-08-06 19:43:52htgoebelcreate