##// 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 headers = wsgiheaders.Headers(headers)
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 return parsedrequest(url=fullurl, baseurl=baseurl,
210 return parsedrequest(url=fullurl, baseurl=baseurl,
204 advertisedurl=advertisedfullurl,
211 advertisedurl=advertisedfullurl,
205 advertisedbaseurl=advertisedbaseurl,
212 advertisedbaseurl=advertisedbaseurl,
@@ -91,10 +91,9 b' class httpv1protocolhandler(wireprototyp'
91 return args
91 return args
92
92
93 def forwardpayload(self, fp):
93 def forwardpayload(self, fp):
94 if b'Content-Length' in self._req.headers:
94 # Existing clients *always* send Content-Length.
95 length = int(self._req.headers[b'Content-Length'])
95 length = int(self._req.headers[b'Content-Length'])
96 else:
96
97 length = int(self._wsgireq.env[r'CONTENT_LENGTH'])
98 # If httppostargs is used, we need to read Content-Length
97 # If httppostargs is used, we need to read Content-Length
99 # minus the amount that was consumed by args.
98 # minus the amount that was consumed by args.
100 length -= int(self._req.headers.get(b'X-HgArgs-Post', 0))
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