This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients eric.smith, rosoroso
Date 2019-11-17.18:04:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574013865.58.0.94266154858.issue38831@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-11-17 18:04:25eric.smithsetrecipients: + eric.smith, rosoroso
2019-11-17 18:04:25eric.smithsetmessageid: <1574013865.58.0.94266154858.issue38831@roundup.psfhosted.org>
2019-11-17 18:04:25eric.smithlinkissue38831 messages
2019-11-17 18:04:25eric.smithcreate