Not completely clear of which of HOST_NAME or SERVER_NAME is correct to use.

This commit is contained in:
Roland Hedberg
2013-05-24 11:44:16 +02:00
parent 26227e0563
commit ad4c338230

View File

@@ -162,6 +162,8 @@ def geturl(environ, query=True, path=True):
"""
url = [environ['wsgi.url_scheme'] + '://']
if environ.get('SERVER_NAME'):
url.append(environ['HTTP_HOST'])
else:
url.append(environ['SERVER_NAME'])
if environ['wsgi.url_scheme'] == 'https':
if environ['SERVER_PORT'] != '443':
@@ -169,8 +171,6 @@ def geturl(environ, query=True, path=True):
else:
if environ['SERVER_PORT'] != '80':
url.append(':' + environ['SERVER_PORT'])
else:
url.append(environ['HTTP_HOST'])
if path:
url.append(getpath(environ))
if query and environ.get('QUERY_STRING'):