Skip to content

Commit

Permalink
Try using user@http://localhost:port for proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed May 15, 2024
1 parent b1209aa commit 9c40169
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test_capture_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def handle_error(self, request, client_address):
server = make_server('localhost', 0, wsgiprox, server_class=NoLogServer)
addr, cls.port = server.socket.getsockname()

cls.proxies = {'https': 'localhost:' + str(cls.port),
'http': 'localhost:' + str(cls.port)
cls.proxies = {'https': 'http://user@localhost:' + str(cls.port),
'http': 'http://user@localhost:' + str(cls.port)
}

def run():
Expand All @@ -53,12 +53,12 @@ def test_capture_http_proxy(self):
assert response.rec_type == 'response'
assert response.rec_headers['WARC-Target-URI'] == "http://example.com/test"
assert response.content_stream().read().decode('utf-8') == 'Proxied: /http://example.com/test'
assert response.rec_headers['WARC-Proxy-Host'] == 'http://localhost:{0}'.format(self.port)
assert response.rec_headers['WARC-Proxy-Host'] == 'http://user@localhost:{0}'.format(self.port)

request = next(ai)
assert request.rec_type == 'request'
assert request.rec_headers['WARC-Target-URI'] == "http://example.com/test"
assert request.rec_headers['WARC-Proxy-Host'] == 'http://localhost:{0}'.format(self.port)
assert request.rec_headers['WARC-Proxy-Host'] == 'http://user@localhost:{0}'.format(self.port)

with raises(StopIteration):
assert next(ai)
Expand Down

0 comments on commit 9c40169

Please sign in to comment.