##// END OF EJS Templates
httppeer: change logic around argument handling...
Gregory Szorc -
r36236:e4ccd7a6 default
parent child Browse files
Show More
@@ -252,6 +252,8 b' class httppeer(wireproto.wirepeer):'
252 # with infinite recursion when trying to look up capabilities
252 # with infinite recursion when trying to look up capabilities
253 # for the first time.
253 # for the first time.
254 postargsok = self._caps is not None and 'httppostargs' in self._caps
254 postargsok = self._caps is not None and 'httppostargs' in self._caps
255
256 # Send arguments via POST.
255 if postargsok and args:
257 if postargsok and args:
256 strargs = urlreq.urlencode(sorted(args.items()))
258 strargs = urlreq.urlencode(sorted(args.items()))
257 if not data:
259 if not data:
@@ -265,11 +267,16 b' class httppeer(wireproto.wirepeer):'
265 argsio.length = len(strargs)
267 argsio.length = len(strargs)
266 data = _multifile(argsio, data)
268 data = _multifile(argsio, data)
267 headers[r'X-HgArgs-Post'] = len(strargs)
269 headers[r'X-HgArgs-Post'] = len(strargs)
268 else:
270 elif args:
269 if len(args) > 0:
271 # Calling self.capable() can infinite loop if we are calling
270 httpheader = self.capable('httpheader')
272 # "capabilities". But that command should never accept wire
271 if httpheader:
273 # protocol arguments. So this should never happen.
272 headersize = int(httpheader.split(',', 1)[0])
274 assert cmd != 'capabilities'
275 httpheader = self.capable('httpheader')
276 if httpheader:
277 headersize = int(httpheader.split(',', 1)[0])
278
279 # Send arguments via HTTP headers.
273 if headersize > 0:
280 if headersize > 0:
274 # The headers can typically carry more data than the URL.
281 # The headers can typically carry more data than the URL.
275 encargs = urlreq.urlencode(sorted(args.items()))
282 encargs = urlreq.urlencode(sorted(args.items()))
@@ -277,8 +284,10 b' class httppeer(wireproto.wirepeer):'
277 headersize):
284 headersize):
278 headers[header] = value
285 headers[header] = value
279 varyheaders.append(header)
286 varyheaders.append(header)
287 # Send arguments via query string (Mercurial <1.9).
280 else:
288 else:
281 q += sorted(args.items())
289 q += sorted(args.items())
290
282 qs = '?%s' % urlreq.urlencode(q)
291 qs = '?%s' % urlreq.urlencode(q)
283 cu = "%s%s" % (self._url, qs)
292 cu = "%s%s" % (self._url, qs)
284 size = 0
293 size = 0
General Comments 0
You need to be logged in to leave comments. Login now