comparison mercurial/wireprotoserver.py @ 36280:685bcdd236b5

wireprotoserver: py3 helpfully calls adds HTTP_ to CONTENT_LENGTH Just handle both with a membership check, preferring the HTTP_ namespaced version. Sigh. Differential Revision: https://phab.mercurial-scm.org/D2310
author Augie Fackler <augie@google.com>
date Sun, 18 Feb 2018 00:02:33 -0500
parents af0a19d8812b
children 0c231df1ffdc
comparison
equal deleted inserted replaced
36279:1e0c9f9f6f36 36280:685bcdd236b5
140 argvalue = decodevaluefromheaders(self._req, r'X-HgArg') 140 argvalue = decodevaluefromheaders(self._req, r'X-HgArg')
141 args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) 141 args.update(urlreq.parseqs(argvalue, keep_blank_values=True))
142 return args 142 return args
143 143
144 def forwardpayload(self, fp): 144 def forwardpayload(self, fp):
145 length = int(self._req.env[r'CONTENT_LENGTH']) 145 if r'HTTP_CONTENT_LENGTH' in self._req.env:
146 length = int(self._req.env[r'HTTP_CONTENT_LENGTH'])
147 else:
148 length = int(self._req.env[r'CONTENT_LENGTH'])
146 # If httppostargs is used, we need to read Content-Length 149 # If httppostargs is used, we need to read Content-Length
147 # minus the amount that was consumed by args. 150 # minus the amount that was consumed by args.
148 length -= int(self._req.env.get(r'HTTP_X_HGARGS_POST', 0)) 151 length -= int(self._req.env.get(r'HTTP_X_HGARGS_POST', 0))
149 for s in util.filechunkiter(self._req, limit=length): 152 for s in util.filechunkiter(self._req, limit=length):
150 fp.write(s) 153 fp.write(s)