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

SourceForge.net noreply at sourceforge.net
Sun Jul 25 20:06:49 CEST 2004


Bugs item #994101, was opened at 2004-07-19 22:22
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=994101&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
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: John J Lee (jjlee)
Date: 2004-07-25 19: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 21: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