New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_urllib2_localnet.ProxyAuthTests fails with no_proxy and NO_PROXY env #72621
Comments
test_urllib2_localnet.ProxyAuthTests fails with no_proxy and NO_PROXY env set: Patch attached. Run: ====================================================================== Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 964, in send
self.connect()
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/home/d0han/cpython/cpython/Lib/socket.py", line 722, in create_connection
raise err
File "/home/d0han/cpython/cpython/Lib/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/test/test_urllib2_localnet.py", line 372, in test_proxy_qop_auth_works
result = self.opener.open(self.URL)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 544, in _open
'_open', req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused> ====================================================================== Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 964, in send
self.connect()
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/home/d0han/cpython/cpython/Lib/socket.py", line 722, in create_connection
raise err
File "/home/d0han/cpython/cpython/Lib/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/test/test_urllib2_localnet.py", line 360, in test_proxy_with_bad_password_raises_httperror
self.URL)
File "/home/d0han/cpython/cpython/Lib/unittest/case.py", line 728, in assertRaises
return context.handle('assertRaises', args, kwargs)
File "/home/d0han/cpython/cpython/Lib/unittest/case.py", line 177, in handle
callable_obj(*args, **kwargs)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 544, in _open
'_open', req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused> ====================================================================== Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 964, in send
self.connect()
File "/home/d0han/cpython/cpython/Lib/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/home/d0han/cpython/cpython/Lib/socket.py", line 722, in create_connection
raise err
File "/home/d0han/cpython/cpython/Lib/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/d0han/cpython/cpython/Lib/test/test_urllib2_localnet.py", line 366, in test_proxy_with_no_password_raises_httperror
self.URL)
File "/home/d0han/cpython/cpython/Lib/unittest/case.py", line 728, in assertRaises
return context.handle('assertRaises', args, kwargs)
File "/home/d0han/cpython/cpython/Lib/unittest/case.py", line 177, in handle
callable_obj(*args, **kwargs)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 544, in _open
'_open', req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/home/d0han/cpython/cpython/Lib/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused> Ran 4 tests in 3.024s FAILED (errors=3) |
The test tries using ProxyHandler directly. It looks like that handler intentionally ignores the request if it matches no_proxies (bpo-6894), so I think Piotr’s approach of adjusting the tests is correct. The patch looks good to me, though I would drop that blank line in test_proxy_qop_auth_works(). It looks like setting a temporary environment variable should disable any settings from Windows registry or OS X config, so this patch should even help in those cases. |
New changeset 8f4424bdeadc by Martin Panter in branch '2.7': New changeset dc9ad44125de by Martin Panter in branch '3.5': New changeset 05c3fbaa8fcf by Martin Panter in branch '3.6': New changeset 4b6e6a77e501 by Martin Panter in branch 'default': |
I altered the comment (looks like it was a copy from code forcing proxies to be bypassed). Also, I didn’t port the second no_proxy fix to 2.7; it looks like there is a different workaround there which is not affected by the environment. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: