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

Flask request headers #1197

Closed
csheppard opened this issue Sep 20, 2016 · 3 comments
Closed

Flask request headers #1197

csheppard opened this issue Sep 20, 2016 · 3 comments

Comments

@csheppard
Copy link

Long story short

After upgrading to aiohttp-1.0.1 and multidict-2.1.0 I can no longer get values from flask.request.headers.

Reverting back to aiohttp==0.22.5 multidict==1.2.2 works fine.

Expected behaviour

print(request.headers.get('Host'))
myhost.name

print(request.headers['host'])
myhost.name

Actual behaviour

print(request.headers.get('Host'))
None

print(request.headers['host'])
  <snip>
  File "venv/lib/python3.5/site-packages/werkzeug/datastructures.py", line 1312, in __getitem__
    return _unicodify_header_value(self.environ['HTTP_' + key])
KeyError: 'HTTP_HOST'

Steps to reproduce

Viewing the data of request.headers.dict['environ'] reveals that the key is actually 'HTTP_Host' and not 'HTTP_HOST' as werkzeug is looking for.

Your environment

aiohttp (1.0.1)
Flask (0.11.1)
gunicorn (19.6.0)
multidict (2.1.0)
Werkzeug (0.11.11)

@fafhrd91
Copy link
Member

fafhrd91 commented Sep 20, 2016

@asvetlov wsgi needs to be adjusted.

but what is the reason to use non-async framework with aiohttp?

@asvetlov
Copy link
Member

Fixed by b782139

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants