--- medusa_http.orig.py 2004-01-21 20:54:54.000000000 -0600 +++ medusa_http.py 2004-01-21 23:11:02.000000000 -0600 @@ -66,6 +66,12 @@ path = request.uri query_string = '' + http_host = msg.get("Host") + if http_host: + server_name = http_host.split(":")[0] # We don't want the port, if it's there + else: + server_name = self.server.ip or socket.gethostbyaddr(socket.gethostname())[0] + environ = {'REQUEST_METHOD': request.command, 'ACCEPT_ENCODING': msg.get('Accept-encoding'), 'CONTENT_TYPE': msg.get('Content-type'), @@ -81,11 +87,12 @@ 'REQUEST_URI': request.uri, 'SCRIPT_NAME': '', "SCRIPT_FILENAME": '', - 'SERVER_NAME': self.server.ip or socket.gethostname(), + 'SERVER_NAME': server_name, 'SERVER_PORT': str(self.server.port), 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': self.server_name, } + # Propagate HTTP headers - copied from twisted_http.py for title, header in msg.items(): envname = title.replace('-', '_').upper()