diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-04-18 07:16:17 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-04-18 07:16:17 (GMT) |
commit | 791ac54a44c1d8c6ee03a3ef733ce04182b8637c (patch) | |
tree | 9b00e2fb683943ff36e4022d2a72409f6ec68272 /Lib/test/test_httpservers.py | |
parent | d2be07e1fdc7e18338efe5c6e1c95eb44f8dd869 (diff) | |
parent | d274b3f1f1e2d8811733fb952c9f18d7da3a376a (diff) | |
download | cpython-791ac54a44c1d8c6ee03a3ef733ce04182b8637c.zip cpython-791ac54a44c1d8c6ee03a3ef733ce04182b8637c.tar.gz cpython-791ac54a44c1d8c6ee03a3ef733ce04182b8637c.tar.bz2 |
Issue #26657: Merge http.server fix from 3.5
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r-- | Lib/test/test_httpservers.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 3856d00..b313aee 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -12,6 +12,7 @@ import os import sys import re import base64 +import ntpath import shutil import urllib.parse import html @@ -960,6 +961,24 @@ class SimpleHTTPRequestHandlerTestCase(unittest.TestCase): path = self.handler.translate_path('//filename?foo=bar') self.assertEqual(path, self.translated) + def test_windows_colon(self): + with support.swap_attr(server.os, 'path', ntpath): + path = self.handler.translate_path('c:c:c:foo/filename') + path = path.replace(ntpath.sep, os.sep) + self.assertEqual(path, self.translated) + + path = self.handler.translate_path('\\c:../filename') + path = path.replace(ntpath.sep, os.sep) + self.assertEqual(path, self.translated) + + path = self.handler.translate_path('c:\\c:..\\foo/filename') + path = path.replace(ntpath.sep, os.sep) + self.assertEqual(path, self.translated) + + path = self.handler.translate_path('c:c:foo\\c:c:bar/filename') + path = path.replace(ntpath.sep, os.sep) + self.assertEqual(path, self.translated) + class MiscTestCase(unittest.TestCase): def test_all(self): |