[ python-Bugs-994101 ] urllib2: improper capitalization of headers

SourceForge.net noreply at sourceforge.net
Tue Mar 28 14:23:14 CEST 2006


Bugs item #994101, was opened at 2004-07-19 21:22
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=994101&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: Robert Sayre (franklinmint)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2: improper capitalization of headers

Initial Comment:
urllib2.py version 1.72 uses capitalize() on HTTP
header names. This results in headers like "User-agent"
instead of "User-Agent". This causes HTTP 400 errors on
some servers when the request has a body, because there
are two content length headers placed in the request:

"Content-Length" (inserted by httplib)
"Content-length" (inserted by
Request.add_unredirected_header)

The capitalization is incorrect, and httplib inserts
Content-Length anyway, so I'm not sure why urllib2 is
bothering.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-03-28 12:23

Message:
Logged In: YES 
user_id=849994

It is. This bug report was about duplicate headers in the
request, while the one you mention is about the
capitalization per se.

----------------------------------------------------------------------

Comment By: Jens Diemer (pylucid)
Date: 2006-03-28 12:18

Message:
Logged In: YES 
user_id=1330780

This isn't fixed:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1459963&group_id=5470

----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2005-01-09 14:56

Message:
Logged In: YES 
user_id=469548

This was fixed by the new patch jjlee provided (#997626).

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2004-07-25 18:06

Message:
Logged In: YES 
user_id=261020

I've added a comment to 996159 which explains what's wrong 
and points to a new patch.


----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-07-22 20:48

Message:
Logged In: YES 
user_id=469548

Patch is available at http://python.org/sf/996159.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=994101&group_id=5470


More information about the Python-bugs-list mailing list