[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

karl report at bugs.python.org
Tue Mar 19 22:34:56 CET 2013


karl added the comment:

The wireshark trace is a different domain than the code example. But let's see. cocobear added:

headers = [("Content-Type","application/oct-stream"),]

with a "Content-Type", not the capitalized "Type".


BUT in the source code or urllib/request.py there is
http://hg.python.org/cpython/file/3.3/Lib/urllib/request.py#l1184

if not request.has_header('Content-type')

And if you check has_header at
http://hg.python.org/cpython/file/3.3/Lib/urllib/request.py#l367

it compares exactly the string it has received, when HTTP headers are case insensitive. It reminds me of

http://bugs.python.org/issue12455
http://bugs.python.org/issue17322

with capitalization issues.

I'm changing the title to be more exact.

----------
nosy: +karlcow
title: urllib2 use of opener.addheaders -> [urllib.request]: Comparison of HTTP headers should be insensitive to the case

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5550>
_______________________________________


More information about the Python-bugs-list mailing list