Test that ConnectionPool preserves path dot segments
MODIFY
dummyserver/handlers.py
dummyserver/handlers.py
@@ -93,7 +93,7 @@ class TestingApp(RequestHandler):
if not path.startswith("/"):
path = urlsplit(path).path
- target = path[1:].replace("/", "_")
+ target = path[1:].split("/", 1)[0]
method = getattr(self, target, self.index)
resp = method(req)

MODIFY
src/urllib3/connectionpool.py
src/urllib3/connectionpool.py
@@ -65,6 +65,11 @@ class ConnectionPool(object):
"""
Base class for all connection pools, such as
:class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`.
+
+ .. note::
+ ConnectionPool.urlopen() does not normalize or percent-encode target URIs
+ which is useful if your target server doesn't support percent-encoded
+ target URIs.
"""
scheme = None

MODIFY
test/with_dummyserver/test_connectionpool.py
test/with_dummyserver/test_connectionpool.py
@@ -787,6 +787,12 @@ class TestConnectionPool(HTTPDummyServerTestCase):
response = pool.request("GET", "http://LoCaLhOsT:%d/" % self.port)
assert response.status == 200
+ def test_preserves_path_dot_segments(self):
+ """ ConnectionPool preserves dot segments in the URI """
+ with HTTPConnectionPool(self.host, self.port) as pool:
+ response = pool.request("GET", "/echo_uri/seg0/../seg2")
+ assert response.data == b"/echo_uri/seg0/../seg2"
+
class TestRetry(HTTPDummyServerTestCase):
def test_max_retry(self):

Test that ConnectionPool preserves path dot segments