This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Piotr Szczepaniak
Recipients Piotr Szczepaniak
Date 2016-10-13.20:07:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1476389226.43.0.0474537923373.issue28435@psf.upfronthosting.co.za>
In-reply-to
Content
test_urllib2_localnet.ProxyAuthTests fails with no_proxy and NO_PROXY env set:
NO_PROXY=localhost,127.0.0.0/8,::1
no_proxy=localhost,127.0.0.0/8,::1

Patch attached.

Run:
./python -m unittest test.test_urllib2_localnet.ProxyAuthTests -v
test_proxy_qop_auth_int_works_or_throws_urlerror (test.test_urllib2_localnet.ProxyAuthTests) ... ok
test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests) ... ERROR
test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests) ... ERROR
test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests) ... ERROR

======================================================================
ERROR: test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests)
----------------------------------------------------------------------
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>

======================================================================
ERROR: test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests)
----------------------------------------------------------------------
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>

======================================================================
ERROR: test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests)
----------------------------------------------------------------------
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)
History
Date User Action Args
2016-10-13 20:07:06Piotr Szczepaniaksetrecipients: + Piotr Szczepaniak
2016-10-13 20:07:06Piotr Szczepaniaksetmessageid: <1476389226.43.0.0474537923373.issue28435@psf.upfronthosting.co.za>
2016-10-13 20:07:06Piotr Szczepaniaklinkissue28435 messages
2016-10-13 20:07:05Piotr Szczepaniakcreate