Eric V. Smith <e...@trueblade.com> added the comment:

Well, the standard says they're case insensitive: 
https://tools.ietf.org/html/rfc7230#section-3.2

Forcing the case on the header item seems quite deliberate: 
https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L399
I assume that the .capitalize call is made in order to normalize headers, in 
case another header with the same name but different capitalization is added.

I can't recommend making a code change here. We're compliant with the standard, 
and any change would no doubt break someone's code.

I do agree that it might be worth documenting.

It's unfortunate that the caller can't specify an exact string they want to use 
(in order to handle broken servers), but that's the way it's been for ages.

----------
nosy: +eric.smith

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38831>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to