[ python-Bugs-1170065 ] HTTPResponse.getheaders() returns lowercased header names

SourceForge.net noreply at sourceforge.net
Fri Mar 31 18:48:08 CEST 2006


Bugs item #1170065, was opened at 2005-03-24 20:24
Message generated for change (Comment added) made by tzot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1170065&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: Open
Resolution: None
Priority: 1
Submitted By: Alexey Dvoychenkov (yain)
Assigned to: Nobody/Anonymous (nobody)
Summary: HTTPResponse.getheaders() returns lowercased header names

Initial Comment:
I'm not sure, if this is a bug, or intentional
behaviour, because on one hand RFC states that field
names for HTTP headers are case-insensitive, on the
other hand, it's not what server really returns to client.

Example:

print response.getheaders()

Yields this (output formatted a bit for clarity):

[('content-length', '5998'), 
('accept-ranges', 'bytes'), 
('last-modified', 'Sun, 30 Jan 2005 14:36:09 GMT'), 
('connection', 'close'), 
('etag', '"26d79-176e-41fcf0d9"'), 
('date', 'Thu, 24 Mar 2005 18:14:07 GMT'), 
('content-type', 'text/html')]



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

Comment By: Christos Georgiou (tzot)
Date: 2006-03-31 19:48

Message:
Logged In: YES 
user_id=539787

I believe that since HTTP Headers are not case sensitive,
this is not a bug.
Fixing the case to either lower-case or upper-case is
typical wherever data are case insensitive, and since Python
strings are case sensitive (in this case, the header name is
being used as a key to a dict), rfc822.py selects lower-case
('suitably canonicalized') to implement case insensitivity.

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

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


More information about the Python-bugs-list mailing list