[issue2275] urllib2 header capitalization

Hans-Peter Jansen report at bugs.python.org
Sun Mar 30 14:12:28 CEST 2008


Hans-Peter Jansen <hpj at urpla.net> added the comment:

> But should not this patch be handled in a way wherein.
> key.capitalize() is just replaced by key.upper()?

Hmm, are you sure?
>>> "hello".upper()
'HELLO'
>>> 

but the issue is with values containing dashes:
>>> 'accept-charset'.capitalize()
'Accept-charset'
whereas the rest of the world would expect:
'Accept-Charset'
        ^

This is especially useful, if you try to emulate the behavior of a
typical browser as close as possible.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2275>
__________________________________


More information about the Python-bugs-list mailing list