##// END OF EJS Templates
hgweb: handle CONTENT_LENGTH...
Gregory Szorc -
r36863:ed0456fd default
parent child Browse files
Show More
@@ -200,6 +200,13 b' def parserequestfromenv(env):'
200 200
201 201 headers = wsgiheaders.Headers(headers)
202 202
203 # This is kind of a lie because the HTTP header wasn't explicitly
204 # sent. But for all intents and purposes it should be OK to lie about
205 # this, since a consumer will either either value to determine how many
206 # bytes are available to read.
207 if 'CONTENT_LENGTH' in env and 'HTTP_CONTENT_LENGTH' not in env:
208 headers['Content-Length'] = env['CONTENT_LENGTH']
209
203 210 return parsedrequest(url=fullurl, baseurl=baseurl,
204 211 advertisedurl=advertisedfullurl,
205 212 advertisedbaseurl=advertisedbaseurl,
@@ -91,10 +91,9 b' class httpv1protocolhandler(wireprototyp'
91 91 return args
92 92
93 93 def forwardpayload(self, fp):
94 if b'Content-Length' in self._req.headers:
95 length = int(self._req.headers[b'Content-Length'])
96 else:
97 length = int(self._wsgireq.env[r'CONTENT_LENGTH'])
94 # Existing clients *always* send Content-Length.
95 length = int(self._req.headers[b'Content-Length'])
96
98 97 # If httppostargs is used, we need to read Content-Length
99 98 # minus the amount that was consumed by args.
100 99 length -= int(self._req.headers.get(b'X-HgArgs-Post', 0))
General Comments 0
You need to be logged in to leave comments. Login now