Skip to content

Commit

Permalink
Try using 127.0.0.1 for proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed May 22, 2024
1 parent 99db9e1 commit a69ac4d
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 @@ -31,8 +31,8 @@ def handle_error(self, request, client_address):

print(f"cls.port: {cls.port}", flush=True)

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

print(f"cls.proxies: {cls.proxies}", flush=True)
Expand All @@ -57,12 +57,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://127.0.0.1:{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://127.0.0.1:{0}'.format(self.port)

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

0 comments on commit a69ac4d

Please sign in to comment.