diff -r 9fdeca5fdbf0 Lib/http/server.py --- a/Lib/http/server.py Mon Mar 28 06:13:52 2016 +0000 +++ b/Lib/http/server.py Mon Mar 28 21:56:22 2016 +0200 @@ -741,7 +741,7 @@ self.end_headers() return f - def translate_path(self, path): + def translate_path(self, path, os_path=os.path): """Translate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system @@ -763,10 +763,13 @@ words = filter(None, words) path = os.getcwd() for word in words: - drive, word = os.path.splitdrive(word) - head, word = os.path.split(word) + while True: + drive, word = os_path.splitdrive(word) + if not drive: + break + head, word = os_path.split(word) if word in (os.curdir, os.pardir): continue - path = os.path.join(path, word) + path = os_path.join(path, word) if trailing_slash: path += '/' return path diff -r 9fdeca5fdbf0 Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py Mon Mar 28 06:13:52 2016 +0000 +++ b/Lib/test/test_httpservers.py Mon Mar 28 21:56:22 2016 +0200 @@ -12,6 +12,7 @@ import sys import re import base64 +import ntpath import shutil import urllib.parse import html @@ -908,6 +909,11 @@ path = self.handler.translate_path('//filename?foo=bar') self.assertEqual(path, self.translated) + def test_windows_colon(self): + path = self.handler.translate_path('c:c:c:filename', os_path=ntpath) + path = path.replace(ntpath.sep, os.path.sep) + self.assertEqual(path, self.translated) + class MiscTestCase(unittest.TestCase): def test_all(self):