[New-bugs-announce] [issue10483] http.server - what is executable on Windows
report at bugs.python.org
Sun Nov 21 08:26:30 CET 2010
New submission from Glenn Linderman <v+python at g.nevcal.com>:
The def executable for CGIHTTPRequestHandler is simply wrong on Windows. The Unix executable bits do not apply.
Yet it is not clear what to use instead. One could check the extension against PATHEXT, perhaps, but Windows doesn't limit itself to that except when not finding the exactly specified executable name. Or one could require and borrow the unix #! convention. As an experiment, since I'm mostly dealing the script files, I tried out a hack that implements two #! lines, the first for Unix and the second for Windows, and only consider something executable if the second line exists. This fails miserably for .exe files, of course.
Another possibility would be to see if there is an association for the extension, but that rule would permit a Word document to be "executable" because there is a way to open it using MS Word.
Another possibility would be to declare a list of extensions in the server source, like the list of directories from which CGIs are found.
Another possibility would be to simply assume that anything found in the CGI directory is executable.
Another possibility is to require the .cgi extension only to be executable, but then it is hard to know how to run it.
Another possibility is to require two "extensions"... the "real" one for Windows, and then .cgi just before it. So to make a program executable, it would be renamed from file.ext to file.cgi.ext
But the current technique is clearly insufficient.
components: Library (Lib)
title: http.server - what is executable on Windows
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce