Skip to content

Loading…

Fix for the Tornado server #38

Closed
wants to merge 1 commit into from

2 participants

@matrixise

Hi Armin,

I fixed a small bug when we try to use nginx with Tornado and Flask.

The value of SERVER_PORT is an integer value and not a String, and we have a traceback, because it can concat a string with an integer.

Regards,

Stéphane.

PS: I think my commit message is wrong.

@mitsuhiko
Owner

This is a bug in tornado and should be fixed there. I will not change Werkzeug in that regard because it opens a can of worms and there might be other places where SERVER_PORT is used.

This problem can easily be worked around with a small WSGI middleware: http://paste.pocoo.org/show/345661/

@matrixise

I agree with you, I created a small middleware based on your code, and it works fine.

Thank you and sorry for my Pull Request.

Stéphane

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2011
  1. @matrixise
Showing with 1 addition and 1 deletion.
  1. +1 −1 werkzeug/routing.py
View
2 werkzeug/routing.py
@@ -1097,7 +1097,7 @@ def bind_to_environ(self, environ, server_name=None, subdomain=None):
server_name = environ['SERVER_NAME']
if (environ['wsgi.url_scheme'], environ['SERVER_PORT']) not \
in (('https', '443'), ('http', '80')):
- server_name += ':' + environ['SERVER_PORT']
+ server_name += ':' + str(environ['SERVER_PORT'])
elif subdomain is None:
if 'HTTP_HOST' in environ:
wsgi_server_name = environ.get('HTTP_HOST')
Something went wrong with that request. Please try again.