File urllib3-fix-test-urls.patch of Package python-urllib3

From: Jacek Tomasiak <jacek.tomasiak@gmail.com>
Date: Tue, 13 Oct 2020 15:09:11 +0200
Subject: [PATCH] Fix test URLs containing whitespaces

They triggered CVE-2019-9740 checks added in python here [0].
The problematic test should fail because of invalid source address but it
failed earlier because of invalid request URL. Request URLs contained string
representation of the tested source address which can contain whitespaces.
E.g. "/source_address?(\'192.0.2.255\', 0)"
Upstream urllib3 solved this problem as part of bigger set of changes ([1],[2]
and [3]). This is a simplified version of these which solves the problem
without changing the functional code.

[0] https://github.com/python/cpython/pull/12755
[1] https://github.com/urllib3/urllib3/pull/1586
[2] https://github.com/urllib3/urllib3/pull/1647
[3] https://github.com/urllib3/urllib3/pull/1673
---
 test/with_dummyserver/test_connectionpool.py | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py
index 95616fce0..7c65ca243 100644
--- a/test/with_dummyserver/test_connectionpool.py
+++ b/test/with_dummyserver/test_connectionpool.py
@@ -680,7 +680,7 @@ class TestConnectionPool(HTTPDummyServerTestCase):
             # FIXME: This assert flakes sometimes. Not sure why.
             self.assertRaises(NewConnectionError,
                               pool.request,
-                              'GET', '/source_address?{0}'.format(addr))
+                              'GET', '/source_address?{0}'.format(addr).replace(' ', '%20'))
 
     def test_stream_keepalive(self):
         x = 2
openSUSE Build Service is sponsored by