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

Location header key is unicode in case of relative redirects, breaks uwsgi #758

Closed
ThiefMaster opened this issue Jun 3, 2013 · 1 comment

Comments

@ThiefMaster
Copy link
Member

from flask import Flask, redirect
app = Flask(__name__)

@app.route('/blah')
def blah():
    return 'blah'

app.add_url_rule('/', view_func=lambda: redirect('/blah'))

Run it like this:

uwsgi --plugin python27 --http 0.0.0.0:31337 --module app --callable app --virtualenv .

Then access it, e.g. using httpie:

http get http://myhost:31337

uwsgi shows this error:

Traceback (most recent call last):
  File "/tmp/werkzeug-uwsgi-unicode-headers/lib/python2.7/site-packages/flask/app.py", line 1829, in __call__
    return self.wsgi_app(environ, start_response)
  File "/tmp/werkzeug-uwsgi-unicode-headers/lib/python2.7/site-packages/flask/app.py", line 1814, in wsgi_app
    return response(environ, start_response)
  File "/tmp/werkzeug-uwsgi-unicode-headers/lib/python2.7/site-packages/werkzeug/wrappers.py", line 1103, in __call__
    start_response(status, headers)
TypeError: http header key must be a string

a print headers in __call__ shows this:

[('Content-Type', 'text/html; charset=utf-8'), ('Content-Length', '217'), (u'Location', 'http://myhost:31337/blah')]
@mitsuhiko
Copy link
Contributor

Fixed in werkzeug master. Thanks.

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

No branches or pull requests

2 participants