Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

Johannes Kleese j.kleese at arcor.de
Tue Nov 13 08:24:47 CET 2012


Terry Reedy wrote:
> On 11/12/2012 10:52 AM, Johannes Kleese wrote:

>> Tested with Python 3.1.3 and Python 3.1.4.
> 
> 3.1 only gets security fixes. Consider upgrading. 

Stuck with Debian on a server, thus stuck with 3.1 on development machine.

> exhibits the same behavior in 3.3.0 of printing ('Content-length', '1')
> in the last output. I agree that that looks wrong, but I do not know if
> such re-use is supposed to be supported.

The Request object should then either get it right on re-use (which I'd
prefer), or block re-use.

>> While at it, I noticed that urllib.request.Request.has_header() and
>> .get_header() are case sensitive,
> 
> Python is case sensitive.

True, of course, but

>> HTTP headers are not (RFC 2616, 4.2).

and the functions work on HTTP data, not Python data. After all, we are
lucky to have functions here and not just a dictionary.


Anyway, thanks for reporting!


More information about the Python-list mailing list