mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
use the collapsed path in the run_cgi method (closes #19435)
This commit is contained in:
parent
505be2146f
commit
04e9de40f3
3 changed files with 16 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue