[issue2275] urllib2 header capitalization

John J Lee report at bugs.python.org
Fri Jul 11 21:09:31 CEST 2008


John J Lee <jjlee at users.sourceforge.net> added the comment:

There already is a test for the breakage, but the patch changes the
expected output to match the new return value of .header_items():

-    [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')]
+    [('Foo-Bar', 'baz'), ('Spam-Eggs', 'blah')]

Code that previously worked fine, for example code that iterates through
.header_items() and does string comparisons on the header names, or does
"in" tests on the keys of dict(header_items), etc. will break, the
existence of .has_header() notwithstanding.

What is the purpose of this change?  Can you explain how that justifies
breaking working code?

The alternative to this change is to leave the return value of
.header_items() unchanged.  That could be done by performing case
normalisation at a later stage.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2275>
_______________________________________


More information about the Python-bugs-list mailing list