[ python-Bugs-1459963 ] urllib2 changes header names
SourceForge.net
noreply at sourceforge.net
Sat Aug 19 03:54:04 CEST 2006
Bugs item #1459963, was opened at 2006-03-28 13:02
Message generated for change (Comment added) made by jjlee
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1459963&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Michael Vert (vimico)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 changes header names
Initial Comment:
It seems that urllib2 changes the writing of any
additional supplied headers, i.e. "User-Agent" becomes
"User-agent", "TEST-HEADER" becomes "Test-header".
A few sites do not recognize "User-agent" and insist on
"User-Agent".
Fix: remove all occurences of capitalize() in urllib2.
----------------------------------------------------------------------
Comment By: John J Lee (jjlee)
Date: 2006-08-19 02:54
Message:
Logged In: YES
user_id=261020
Patch 1459963 (applied in 50842) should be reverted and a
better patch applied (see below), since this one needlessly
breaks the old (albeit undocumented) interface of direct
access to request.headers (which existed prior to the
introduction of the .get_header() &c. methods).
Patch 1542948 reverts 50842's changes to urllib2 (it does
not revert the changes to urllib) and fixes the reported
issue with a one-line fix in AbstractHTTPHandler
(.title()-case the HTTP headers before sending them to
httplib). That fix is also more localised to HTTP -- urllib2
knows about other protocols too. This patch also corrects a
mis-wording in Misc/NEWS: the old case convention was not
strictly incorrect (according to RFC 2616), but just did not
follow the usual title-case convention.
If the original patch was applied to the 2.4 maintenance
branch, I guess patch 1542948 should be applied there too.
(Just BTW: With hindsight, the methods should never have
been introduced (which was done when the "unredirected"
headers were introduced), but rather request.headers changed
to be a class != dict: that was my fault, and it's too late
to fix that...)
----------------------------------------------------------------------
Comment By: Michael Vert (vimico)
Date: 2006-03-28 16:32
Message:
Logged In: YES
user_id=928834
I checked the database before submitting... I admit, I
haven't gone back 2 years. :-)
It seems to be the same bug. But it was still present in
2.4.2 (version used in Ubuntu Breezy).
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2006-03-28 13:40
Message:
Logged In: YES
user_id=849994
Some normalizing is important to prevent duplicate headers.
Changed capitalize() to title() to match the default casing
(now user-agent becomes User-Agent) in rev. 43399.
----------------------------------------------------------------------
Comment By: Jens Diemer (pylucid)
Date: 2006-03-28 13:16
Message:
Logged In: YES
user_id=1330780
There are old, closed Bug-Reports:
https://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=994101
?!?!?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1459963&group_id=5470
More information about the Python-bugs-list
mailing list