diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-03-16 01:07:16 -0700 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-03-16 01:07:16 -0700 |
commit | 51a65c91611aa7deb222f24ad2c94021910b7a54 (patch) | |
tree | dad4b18b2634db8ebaaed68dfab9200894e07e76 /Lib/CGIHTTPServer.py | |
parent | 4c59211bd5b136880bb3b5c6aef033e2b62c1019 (diff) | |
download | cpython-git-51a65c91611aa7deb222f24ad2c94021910b7a54.tar.gz |
2.7 - Issue #10484: Fix the CGIHTTPServer's PATH_INFO handling problem
Diffstat (limited to 'Lib/CGIHTTPServer.py')
-rw-r--r-- | Lib/CGIHTTPServer.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py index 13ca0b514b..2ca8217bcb 100644 --- a/Lib/CGIHTTPServer.py +++ b/Lib/CGIHTTPServer.py @@ -323,7 +323,14 @@ def _url_collapse_path_split(path): # Filter out blank non trailing parts before consuming the '..'. path_parts = [part for part in path_parts[:-1] if part] + path_parts[-1:] if path_parts: - tail_part = path_parts.pop() + # Special case for CGI's for PATH_INFO + if path.startswith('/cgi-bin') or path.startswith('/htbin'): + tail_part = [] + while path_parts[-1] not in ('cgi-bin','htbin'): + tail_part.insert(0,path_parts.pop()) + tail_part = "/".join(tail_part) + else: + tail_part = path_parts.pop() else: tail_part = '' head_parts = [] |