comparison mercurial/hgweb/protocol.py @ 28530:fd2acc5046f6

http: support sending hgargs via POST body instead of in GET or headers narrowhg (for its narrow spec) and remotefilelog (for its large batch requests) would like to be able to make requests with argument sets so absurdly large that they blow out total request size limit on some http servers. As a workaround, support stuffing args at the start of the POST body. We will probably want to leave this behavior off by default in servers forever, because it makes the old "POSTs are only for writes" assumption wrong, which might break some of the simpler authentication configurations.
author Augie Fackler <augie@google.com>
date Fri, 11 Mar 2016 11:37:00 -0500
parents 37fcfe52c68c
children 86db5cb55d46
comparison
equal deleted inserted replaced
28529:045cdf47851a 28530:fd2acc5046f6
43 else: 43 else:
44 data[k] = knownargs[k][0] 44 data[k] = knownargs[k][0]
45 return [data[k] for k in keys] 45 return [data[k] for k in keys]
46 def _args(self): 46 def _args(self):
47 args = self.req.form.copy() 47 args = self.req.form.copy()
48 postlen = int(self.req.env.get('HTTP_X_HGARGS_POST', 0))
49 if postlen:
50 args.update(cgi.parse_qs(
51 self.req.read(postlen), keep_blank_values=True))
52 return args
48 chunks = [] 53 chunks = []
49 i = 1 54 i = 1
50 while True: 55 while True:
51 h = self.req.env.get('HTTP_X_HGARG_' + str(i)) 56 h = self.req.env.get('HTTP_X_HGARG_' + str(i))
52 if h is None: 57 if h is None: