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 martin.panter
Recipients jjlee, martin.panter, orsenthil, xhchen111
Date 2019-05-05.00:51:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557017497.61.0.968101993537.issue1160328@roundup.psfhosted.org>
In-reply-to
Content
Today, proxy.pconline.com.cn resolves to a local (inaccessible) address for me (192.168.11.254). After changing the proxy address to localhost, and testing with Python 2.6.8, I can’t see any evidence of a bug in Python. Winsock error 10053 is WSAECONNABORTED, which apparently can be triggered after a lower-level protocol failure or timeout. So this could be the fault of the proxy, network, or a firewall. I am closing this, assuming nobody else can to reproduce this fifteen years later.

The closest I got is the following HTTP seen at the proxy:

>>> [conn, address] = listener.accept()
>>> pprint(conn.recv(3000).splitlines(keepends=True))
[b'GET http://192.168.10.177:8080/price/login.do?method=list HTTP/1.1\r\n',
 b'Accept-Encoding: identity\r\n',
 b'Host: 192.168.10.177:8080\r\n',
 b'Proxy-Authorization: Basic cGljOmlMdXNhbHQ=\r\n',
 b'Connection: close\r\n',
 b'User-Agent: Python-urllib/2.6\r\n',
 b'\r\n']
>>> conn.sendall(b'HTTP/1.1 200 Okay\r\nContent-Length: 0\r\n\r\n')
>>> conn.close()
>>> [conn, address] = listener.accept()
>>> pprint(conn.recv(3000).splitlines(keepends=True))
[b'POST http://192.168.10.177:8080/price/login.do?method=login HTTP/1.1\r\n',
 b'Accept-Encoding: identity\r\n',
 b'Content-Length: 27\r\n',
 b'Host: 192.168.10.177:8080\r\n',
 b'User-Agent: Python-urllib/2.6\r\n',
 b'Connection: close\r\n',
 b'Proxy-Authorization: Basic cGljOmlMdXNhbHQ=\r\n',
 b'Content-Type: application/x-www-form-urlencoded\r\n',
 b'\r\n',
 b'password=admin&userId=admin']

If I close the proxy’s listener before sending the first response, this causes ECONNREFUSED for the second request, with a similar back trace:

$ python2.6 t.py

Traceback (most recent call last):
  File "t.py", line 13, in <module>
    response = urllib2.urlopen(request, postdata)
  File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 1181, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.6/urllib2.py", line 1156, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>
History
Date User Action Args
2019-05-05 00:51:37martin.pantersetrecipients: + martin.panter, jjlee, orsenthil, xhchen111
2019-05-05 00:51:37martin.pantersetmessageid: <1557017497.61.0.968101993537.issue1160328@roundup.psfhosted.org>
2019-05-05 00:51:37martin.panterlinkissue1160328 messages
2019-05-05 00:51:36martin.pantercreate