New submission from Stefan Prawda:

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)

----------
components: Tests
files: cpython.diff
keywords: patch
messages: 278600
nosy: Stefan Prawda
priority: normal
severity: normal
status: open
title: test_urllib2_localnet.ProxyAuthTests fails with no_proxy and NO_PROXY env
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45084/cpython.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28435>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to