Fix server to set up a more WSGI compliant environment.
--- a/mercurial/hgweb/server.py Fri Jun 23 08:10:06 2006 +0200
+++ b/mercurial/hgweb/server.py Tue Jun 27 00:09:31 2006 -0700
@@ -76,13 +76,14 @@
length = self.headers.getheader('content-length')
if length:
env['CONTENT_LENGTH'] = length
- accept = []
- for line in self.headers.getallmatchingheaders('accept'):
- if line[:1] in "\t\n\r ":
- accept.append(line.strip())
- else:
- accept = accept + line[7:].split(',')
- env['HTTP_ACCEPT'] = ','.join(accept)
+ for header in [h for h in self.headers.keys() \
+ if h not in ('content-type', 'content-length')]:
+ hkey = 'HTTP_' + header.replace('-', '_').upper()
+ hval = self.headers.getheader(header)
+ hval = hval.replace('\n', '').strip()
+ if hval:
+ env[hkey] = hval
+ env['SERVER_PROTOCOL'] = self.request_version
req = hgrequest(self.rfile, self.wfile, env)
self.send_response(200, "Script output follows")