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

Terry Reedy tjreedy at udel.edu
Tue Nov 13 02:41:36 CET 2012


On 11/12/2012 5:59 PM, Cameron Simpson wrote:
> On 12Nov2012 16:35, Terry Reedy <tjreedy at udel.edu> wrote:
> | On 11/12/2012 10:52 AM, Johannes Kleese wrote:
> | > While at it, I noticed that urllib.request.Request.has_header() and
> | > .get_header() are case-sensitive,
> |
> | Python is case sensitive.

To be more precise, Python string comparisons are by codepoints. If one 
wants normalized comparison, one usually has to do do the normalization 
oneself.

> But headers are not. I'd be very inclined to consider case sensitivity
> in has_header and get_header to be a bug, absent a compelling argument
> against it.

It appears that the behavior is not consistent with doc examples and 
other header name handling. I added a note to
http://bugs.python.org/issue12455

-- 
Terry Jan Reedy



More information about the Python-list mailing list