Skip to content

Commit 2f1d3a1

Browse files
aesteve-rhnirs
authored andcommitted
http_test: make realistic server url
Recent HTTPRequestHandler changes avoid urls that start with '//' to protect against open redirect attacks (see python/cpython@4abab6b). Server url in the http test have no path, therefore the handler that is used in the test receives the root path, resulting in requests starting with '//' when the Backend tries to get the extents, which break in the pipelines for recent Python 3.10 versions. This is not a realistic scenario and not something the library needs to handle. Is better to change the url to a more realistic scenario, and since we want to test image handling, have `/images/ticket-id` in the url path. Signed-off-by: Albert Esteve <aesteve@redhat.com>
1 parent 02cd151 commit 2f1d3a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/backends/http_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def http_server(tmp_pki):
3838
server.socket = ctx.wrap_socket(server.socket, server_side=True)
3939

4040
server.url = urlparse(
41-
"https://localhost:{}/".format(server.server_port))
41+
"https://localhost:{}/images/ticket-id".format(server.server_port))
4242
server.cafile = tmp_pki.cafile
4343
server.app = http.Router([])
4444

@@ -79,7 +79,7 @@ def __init__(self, http_server, uhttp_server=None):
7979
self.dirty = False
8080
self.requests = 0
8181

82-
router = http.Router([("/(.*)", self)])
82+
router = http.Router([(r"/images/(.*)", self)])
8383
http_server.app = router
8484
if uhttp_server:
8585
uhttp_server.app = router
@@ -197,7 +197,7 @@ def get(self, req, resp, path=None):
197197
"""
198198
Override to dispatch "GET /extents" resource.
199199
"""
200-
if path == "/extents":
200+
if path == "ticket-id/extents":
201201
self.requests += 1
202202
context = req.query.get("context", "zero")
203203
self._extents(resp, context)

0 commit comments

Comments
 (0)