[PATCH 1 of 2] Fix server to set up a more WSGI compliant
environment
hopper at omnifarious.org
hopper at omnifarious.org
Fri Jun 23 12:33:22 CDT 2006
# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Node ID a41a24a81c9e278a4a4eb29e822f4b2118176f1b
# Parent 1066c585767ecaa57dc08960a52d12d3c692b202
Fix server to set up a more WSGI compliant environment.
diff -r 1066c585767e -r a41a24a81c9e mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py Wed Jun 21 22:45:29 2006 -0700
+++ b/mercurial/hgweb/server.py Fri Jun 23 09:53:38 2006 -0700
@@ -76,13 +76,14 @@ class _hgwebhandler(object, BaseHTTPServ
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")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20060623/40c99a26/attachment.pgp
More information about the Mercurial
mailing list