pwsm / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

httplib2 should not assume header keys are case-insensitive #99

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I know the spec says HTTP headers are case-insensitive, but I've
encountered a server in the wild that treats the "Content-Type" header as
case-sensitive. (I.e., it requires that the header be exactly
"Content-Type", not "content-type".)

The server is http://www2.co.multnomah.or.us/. Here's a snippet of its
response headers so we know the offensive version of ASP.NET:

Server: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g mod_jk/1.2.12
X-AspNet-Version: 2.0.50727

I can't just subclass the Http in httplib2 and override
_normalize_headers() because the class assumes the headers are lower case.
:-/ Fixing this would require a bit of refactoring. I'm happy to code up a
patch if the maintainers decide it's worth changing.

Original issue reported on code.google.com by holov...@gmail.com on 22 Apr 2010 at 10:05

GoogleCodeExporter commented 8 years ago
And what happens when someone else finds a server that only accepts headers in 
lower-
case? And a fourth person finds a server that only accepts headers in all upper 
case?

Also, I realize we like to bash certain companies products, but do you really 
think 
they messed up something this basic? A quick search and I couldn't find anyone 
else 
having similar problems, which surprises me if it really is an asp.net problem.

Original comment by joe.gregorio@gmail.com on 14 May 2010 at 3:27

GoogleCodeExporter commented 8 years ago
Joe, while it has been 2 years since your answer, i find it unacceptable.
i find many servers that have an issue with lower-casing the headers, including 
Yahoo for example..
i don't see any good reason to mess with the data that a user supplies, if i 
wish to send mixed case headers by all means let me, don't decide for me how to 
send the headers.

this might be the right (=rfc) way, but not the smart way
would very much appreciate reopening this ticket and handling this issue 

Original comment by amir....@gmail.com on 18 Jan 2013 at 4:47

GoogleCodeExporter commented 8 years ago
I got the same issue. I can not to use httplib2 anymore. 

httplib2 is a garbage.   How can you decide me how to send header.

Original comment by huoli...@gmail.com on 16 May 2013 at 2:36

GoogleCodeExporter commented 8 years ago
We got the same issue. If you respect the header exactly as the user typed it 
(maintaining its case) the request will work with servers that follow the spec 
(as they are case insensitive) and with "broken" servers (as the user knows or 
can know exactly which letters should be uppercase/lowercase).

As it is right know httplib2 only works for servers that are "right", and 
doesn't leave any option to the developer that has to work with "broken" 
servers.

Original comment by ago...@gmail.com on 3 Apr 2014 at 10:18