cpython: ecef74419d55 (original) (raw)
Mercurial > cpython
changeset 70908:ecef74419d55
Close #12289: Fix "is executable?" test in the CGI server Use os.access(path, os.X_OK) instead of (os.stat(path).st_mode & 0o111 != 0), and ignore the test on Windows. [#12289]
Victor Stinner victor.stinner@haypocalc.com | |
---|---|
date | Mon, 20 Jun 2011 17:45:54 +0200 |
parents | d84760f1dcbe |
children | 1861683793d9 |
files | Lib/http/server.py |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-)[+] [-] Lib/http/server.py 8 |
line wrap: on
line diff
--- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -897,11 +897,7 @@ def nobody_uid(): def executable(path): """Test for executable file."""
- try:
st = os.stat(path)[](#l1.8)
- except os.error:
return False[](#l1.10)
- return st.st_mode & 0o111 != 0
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): @@ -1015,7 +1011,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRe scriptname) return ispy = self.is_python(scriptname)
if not ispy:[](#l1.20)
if self.have_fork or not ispy:[](#l1.21) if not self.is_executable(scriptfile):[](#l1.22) self.send_error(403, "CGI script is not executable (%r)" %[](#l1.23) scriptname)[](#l1.24)