Issue #26657: Merge http.server fix from 3.5

This commit is contained in:
Martin Panter 2016-04-18 07:16:17 +00:00
commit 791ac54a44
3 changed files with 26 additions and 3 deletions

View file

@ -768,9 +768,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
words = filter(None, words)
path = os.getcwd()
for word in words:
drive, word = os.path.splitdrive(word)
head, word = os.path.split(word)
if word in (os.curdir, os.pardir): continue
if os.path.dirname(word) or word in (os.curdir, os.pardir):
# Ignore components that are not a simple file/directory name
continue
path = os.path.join(path, word)
if trailing_slash:
path += '/'