Commit f5f3cb79 authored by 's avatar

Merged fix to handle no port in host header

parent b3886d74
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.38 $'[11:-2] __version__='$Revision: 1.39 $'[11:-2]
import regex, re, sys, os, string, urllib import regex, re, sys, os, string, urllib
from string import lower, atoi, rfind, split, strip, join, upper, find from string import lower, atoi, rfind, split, strip, join, upper, find
...@@ -281,6 +281,13 @@ class HTTPRequest(BaseRequest): ...@@ -281,6 +281,13 @@ class HTTPRequest(BaseRequest):
if have_env('HTTP_HOST'): if have_env('HTTP_HOST'):
host = strip(environ['HTTP_HOST']) host = strip(environ['HTTP_HOST'])
hostname, port = splitport(host) hostname, port = splitport(host)
# some clients manage to forget the port :(
if port is None and environ.has_key('SERVER_PORT'):
s_port=environ['SERVER_PORT']
if s_port not in ('80', '443'):
port=s_port
else: else:
hostname = strip(environ['SERVER_NAME']) hostname = strip(environ['SERVER_NAME'])
port = environ['SERVER_PORT'] port = environ['SERVER_PORT']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment