diff options
author | ianb <devnull@localhost> | 2007-01-04 00:37:19 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2007-01-04 00:37:19 +0000 |
commit | c62be0146584cfd63105ea6e68c2de188e835cce (patch) | |
tree | 9c13d2149e534860fd8609f3f6f46906f6efdc05 | |
parent | e52a896bdc0d9bad912b2f96da97d90bea8b904c (diff) | |
download | paste-c62be0146584cfd63105ea6e68c2de188e835cce.tar.gz |
Respect HTTP_HOST over SERVER_PORT in construct_url
-rw-r--r-- | docs/news.txt | 10 | ||||
-rw-r--r-- | paste/request.py | 15 |
2 files changed, 16 insertions, 9 deletions
diff --git a/docs/news.txt b/docs/news.txt index fe347b3..7f51ffe 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -3,6 +3,14 @@ News .. contents:: +svn trunk +--------- + +* ``paste.request.construct_url`` was adding ``SERVER_PORT`` to + ``HTTP_HOST``; but ``HTTP_HOST`` (from the Host header) generally + contains a port when necessary, and ``SERVER_PORT`` should only be + used with ``SERVER_NAME``. + 1.1.1 ----- @@ -10,7 +18,7 @@ News in Paste 1.1 where most static files would return 404 Not Found). * Fixed ``parse_dict_querystring`` returning empty dicts instead of - ``MultiDict``s. + ``MultiDict``\ s. * Added ``paste.config``, a rewrite of ``paste.deploy.config`` using ``paste.registry``. This version of ``ConfigMiddleware`` will diff --git a/paste/request.py b/paste/request.py index 24de9b8..cc9bf00 100644 --- a/paste/request.py +++ b/paste/request.py @@ -202,16 +202,15 @@ def construct_url(environ, with_query_string=True, with_path_info=True, url = environ['wsgi.url_scheme']+'://' if environ.get('HTTP_HOST'): - url += environ['HTTP_HOST'].split(':')[0] + url += environ['HTTP_HOST'].split(':') else: url += environ['SERVER_NAME'] - - if environ['wsgi.url_scheme'] == 'https': - if environ['SERVER_PORT'] != '443': - url += ':' + environ['SERVER_PORT'] - else: - if environ['SERVER_PORT'] != '80': - url += ':' + environ['SERVER_PORT'] + if environ['wsgi.url_scheme'] == 'https': + if environ['SERVER_PORT'] != '443': + url += ':' + environ['SERVER_PORT'] + else: + if environ['SERVER_PORT'] != '80': + url += ':' + environ['SERVER_PORT'] if script_name is None: url += urllib.quote(environ.get('SCRIPT_NAME','')) |