[New-bugs-announce] [issue22467] Lib/http/server.py, inconsistent header casing

DS6 report at bugs.python.org
Tue Sep 23 07:20:15 CEST 2014

New submission from DS6:

Inconsistent casing, such as "Content-type" vs "Content-Type", "Content-Length" vs "Content-length", while technically not breaking any RFC or other HTTP-related rules (headers are case-insensitive, after all), can occasionally cause problems when attempting to retrieve already-set headers from http.server.BaseHTTPRequestHandler._headers_buffer (in my situation specifically, trying to retrie the Content-Type header in the sendfile method in an extended BaseHTTPRequestHandler class). This happens a lot in the file and I wouldn't be surprised if the problem were to crop up in other places as well.
I'm a new user of Python, so despite having searched for an answer to this problem, if there's a case-insensitive way to obtain items from a list and I'm just daft, please feel free to point me in the right direction, though I feel that the casing should be corrected regardless for consistency and optimization sake.

(Aside: I would try to publish a patch along with this issue report with the casing issues fixed, but I'm not too knowledgeable about versioning and stuff and would have no idea where to start.)

components: Library (Lib)
messages: 227324
nosy: DS6
priority: normal
severity: normal
status: open
title: Lib/http/server.py, inconsistent header casing
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list