[Mailman-Developers] Error in Mailman Version: 1.0rc1

Harald Meland Harald.Meland@usit.uio.no
22 May 1999 16:09:47 +0200


[Richard Ellerbrock]

> I continuously get the following error in my error
> log. Unfortunately I do not know what leads to the error.
> 
> 
> admin: [----- Mailman Version: 1.0rc1 -----]
> admin: [----- Traceback ------]
> admin: Traceback (innermost last):
> admin:   File "/home/mailman/scripts/driver", line 112, in run_main
> admin:     main()
> admin:   File "/home/mailman/Mailman/Cgi/listinfo.py", line 40, in main
> admin:     FormatListinfoOverview()
> admin:   File "/home/mailman/Mailman/Cgi/listinfo.py", line 66, in FormatListinf
> oOverview
> admin:     if port and http_host[-len(port)-1:] == ':'+port:
> admin: AttributeError: __getslice__

Apparently your web server isn't defining the HTTP_HOST environment
variable when running CGI scripts.  The CGI/1.1 spec says that
SERVER_NAME should hold

  The server's hostname, DNS alias, or IP address as it would appear
  in self-referencing URLs"

(but doesn't mention HTTP_HOST...), so with the below
(just-checked-in) patch Mailman falls back on SERVER_NAME when
HTTP_HOST is unset:

Index: listinfo.py
===================================================================
RCS file: /export/public/cvsroot/mailman/Mailman/Cgi/listinfo.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- listinfo.py	1999/05/02 22:57:45	1.10
+++ listinfo.py	1999/05/22 10:06:09	1.11
@@ -60,7 +60,8 @@
 
     # XXX We need a portable way to determine the host by which we are being 
     #     visited!  An absolute URL would do...
-    http_host = os.environ.get('HTTP_HOST')
+    http_host = os.environ.get('HTTP_HOST') or\
+                os.environ.get('SERVER_NAME')
     port = os.environ.get('SERVER_PORT')
     # strip off the port if there is one
     if port and http_host[-len(port)-1:] == ':'+port:

Thanks for the bug report,
-- 
Harald