[issue12849] Cannot override 'connection: close' in urllib2 headers

Demian Brecht report at bugs.python.org
Thu Jun 19 18:33:29 CEST 2014


Demian Brecht added the comment:

The problem here as far as I can tell is that the underlying file object (addinfourl) blocks while waiting for a full response from the server. As detailed in section 8.1 of RFC 2616, requests and responses can be pipelined, meaning requests can be sent while waiting for full responses from a server.

The suggested change of overriding headers is only a partial solution as it doesn't allow for non-blocking pipelining.

@Martin Panter: My suggestion for you would simply be to use http.client (httplib) as R. David Murray suggests, which doesn't auto-inject the Connection header. Also, a server truncating responses when "Connection: close" is sent sounds like a server-side bug to me. Unless you're a server maintainer (or have access to the developers), have you tried reaching out to them to request a fix?

----------
nosy: +dbrecht

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


More information about the Python-bugs-list mailing list