SVN: r25276 - trunk/quixote/server

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Wed, 6 Oct 2004 12:20:29 -0400
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: nascheme
Date: 2004-10-06 11:46:53 -0400 (Wed, 06 Oct 2004)
New Revision: 25276

Modified:
   trunk/quixote/server/medusa_http.py
Log:
Fix Medusa server bug introduced in 1.1.  HTTP headers must have "HTTP_"
prepended to them.


Modified: trunk/quixote/server/medusa_http.py
===================================================================
--- trunk/quixote/server/medusa_http.py	2004-10-06 15:11:40 UTC (rev 25275)
+++ trunk/quixote/server/medusa_http.py	2004-10-06 15:46:53 UTC (rev 25276)
@@ -77,8 +77,8 @@
                            socket.gethostbyaddr(socket.gethostname())[0])
 
         environ = {'REQUEST_METHOD': request.command,
-                   'ACCEPT_ENCODING': msg.get('Accept-encoding'),
-                   'CONTENT_TYPE': msg.get('Content-type'),
+                   'ACCEPT_ENCODING': msg.get('Accept-encoding', ''),
+                   'CONTENT_TYPE': msg.get('Content-type', ''),
                    'CONTENT_LENGTH': len(data),
                    "GATEWAY_INTERFACE": "CGI/1.1",
                    'PATH_INFO': path,
@@ -93,13 +93,9 @@
                    'SERVER_PROTOCOL': 'HTTP/1.1',
                    'SERVER_SOFTWARE': self.server_name,
                    }
-
         for title, header in msg.items():
-            envname = title.replace('-', '_').upper()
+            envname = 'HTTP_' + title.replace('-', '_').upper()
             environ[envname] = header
-        for k,v in environ.items():
-            if v == None:
-                environ[k] = ''
 
         stdin = StringIO(data)
         qreq = self.publisher.create_request(stdin, environ)