This commit is contained in:
Benjamin Peterson 2013-10-30 12:48:59 -04:00
commit 35aca89617
3 changed files with 18 additions and 5 deletions

View file

@ -968,18 +968,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