Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPHeaderDict incompatible with python-requests' CaseInsensitiveDict #670

Closed
atodorov opened this issue Jul 9, 2015 · 1 comment
Closed

Comments

@atodorov
Copy link

atodorov commented Jul 9, 2015

Hi, please see details here, especially comments #2 and #3 on that bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1241561

On line 93 of requests/adapters.py there is:

response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {}))

where resp['headers'] is now of type urllib3.HTTPHeaderDict so the following happens before and after this line is executed:

resp['headers'] is

HTTPHeaderDict({'soapserver': 'SOAP::Lite/Perl/1.11', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'content-encoding': 'gzip', 'transfer-encoding': 'chunked', 'set-cookie': 'Bugzilla_login_request_cookie=or9UbA03it; domain=bugzilla.redhat.com; path=/; HttpOnly', 'vary': 'Accept-Encoding,User-Agent', 'server': 'Apache', 'connection': 'close', 'date': 'Thu, 09 Jul 2015 15:33:28 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'text/xml'})

response.headers is 

<class 'requests.structures.CaseInsensitiveDict'> {'soapserver': ('soapserver', 'SOAP::Lite/Perl/1.11'), 'x-xss-protection': ('x-xss-protection', '1; mode=block'), 'x-content-type-options': ('x-content-type-options', 'nosniff'), 'content-encoding': ('content-encoding', 'gzip'), 'transfer-encoding': ('transfer-encoding', 'chunked'), 'set-cookie': ('set-cookie', 'Bugzilla_login_request_cookie=or9UbA03it; domain=bugzilla.redhat.com; path=/; HttpOnly'), 'vary': ('vary', 'Accept-Encoding,User-Agent'), 'server': ('server', 'Apache'), 'connection': ('connection', 'close'), 'date': ('date', 'Thu, 09 Jul 2015 15:33:28 GMT'), 'x-frame-options': ('x-frame-options', 'SAMEORIGIN'), 'content-type': ('content-type', 'text/xml')}

then the value for content-type becomes ('content-type', 'text/xml') which breaks elsewhere.

We can either patch python-request to account for that (I've found one place and it works for me) or better provide a backward compatible update to urllib3. Any idea if we can make the later ?

@shazow
Copy link
Member

shazow commented Jul 9, 2015

I believe this is effectively a dupe of #633, please correct me if I'm mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants