[issue12576] urlib.request fails to open some sites

STINNER Victor report at bugs.python.org
Mon Jul 18 12:13:39 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

imdb.com and python.org use HTTP/1.1. imdb.com server sends a "Transfer-encoding: chunked" header whereas python.org doesn't. python.org has a "Connection: close" header, whereas imdb.com doesn't.

The more revelant difference for this issue is the "Connection: close" header: HTTPResponse.wil_close is True if "Connection: close" header is present (see _check_close() method), it returns False otherwise. HTTPConnection.getresponse() keeps a reference to the response if will_close is False, or calls its close() method otherwise.

The "Cneonction: close" header looks to be a quirk of Netscaler loadbalancers. It is sometimes "nnCoection" uses the same load balancer.

There are buggy web servers, Python should not raise a "I/O closed file" error on such server.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12576>
_______________________________________


More information about the Python-bugs-list mailing list