diff options
| author | bwarsaw | 1999-02-23 18:27:44 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-02-23 18:27:44 +0000 |
| commit | 9e2ab86da5efa606d35c3654f320bdab3d7d7df1 (patch) | |
| tree | 33307beaf729a8a6fb74c265eb691b15fcda5917 | |
| parent | 4268b8fcb887c3f513b9103d1671ef050c996c20 (diff) | |
| download | mailman-9e2ab86da5efa606d35c3654f320bdab3d7d7df1.tar.gz mailman-9e2ab86da5efa606d35c3654f320bdab3d7d7df1.tar.zst mailman-9e2ab86da5efa606d35c3654f320bdab3d7d7df1.zip | |
FormatListinfoOverview(): strip the port number off of HTTP_HOST if it
is present.
| -rw-r--r-- | Mailman/Cgi/listinfo.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py index 9e29b33a7..8bb2f2dc4 100644 --- a/Mailman/Cgi/listinfo.py +++ b/Mailman/Cgi/listinfo.py @@ -60,10 +60,11 @@ def FormatListinfoOverview(error=None): # XXX We need a portable way to determine the host by which we are being # visited! An absolute URL would do... - if os.environ.has_key('HTTP_HOST'): - http_host = os.environ['HTTP_HOST'] - else: - http_host = None + http_host = os.environ.get('HTTP_HOST') + port = os.environ.get('SERVER_PORT') + # strip off the port if there is one + if port and http_host[-len(port)-1:] == ':'+port: + http_host = http_host[:-len(port)-1] if mm_cfg.VIRTUAL_HOST_OVERVIEW and http_host: host_name = http_host else: |
