use the collapsed path in the run_cgi method (closes #19435)

This commit is contained in:
Benjamin Peterson 2013-10-30 12:43:09 -04:00
parent 505be2146f
commit 04e9de40f3
3 changed files with 16 additions and 5 deletions

View file

@ -926,18 +926,17 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
def run_cgi(self):
"""Execute a CGI script."""
path = self.path
dir, rest = self.cgi_info
i = path.find('/', len(dir) + 1)
i = rest.find('/')
while i >= 0:
nextdir = path[:i]
nextrest = path[i+1:]
nextdir = rest[:i]
nextrest = rest[i+1:]
scriptdir = self.translate_path(nextdir)
if os.path.isdir(scriptdir):
dir, rest = nextdir, nextrest
i = path.find('/', len(dir) + 1)
i = rest.find('/')
else:
break