comparison mercurial/hgweb/protocol.py @ 14094:d10c6835497e

http: minor tweaks to long arg handling x-arg -> x-hgarg replace itertools.count(1)
author Matt Mackall <mpm@selenic.com>
date Sun, 01 May 2011 03:51:04 -0500
parents ce99d887585f
children 1ffeeb91c55d
comparison
equal deleted inserted replaced
14093:ce99d887585f 14094:d10c6835497e
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import cgi, cStringIO, itertools, zlib, sys, urllib 8 import cgi, cStringIO, zlib, sys, urllib
9 from mercurial import util, wireproto 9 from mercurial import util, wireproto
10 from common import HTTP_OK 10 from common import HTTP_OK
11 11
12 HGTYPE = 'application/mercurial-0.1' 12 HGTYPE = 'application/mercurial-0.1'
13 13
30 data[k] = knownargs[k][0] 30 data[k] = knownargs[k][0]
31 return [data[k] for k in keys] 31 return [data[k] for k in keys]
32 def _args(self): 32 def _args(self):
33 args = self.req.form.copy() 33 args = self.req.form.copy()
34 chunks = [] 34 chunks = []
35 for i in itertools.count(1): 35 i = 1
36 h = self.req.env.get('HTTP_X_ARG_' + str(i)) 36 while 1:
37 h = self.req.env.get('HTTP_X_HGARG_' + str(i))
37 if h is None: 38 if h is None:
38 break 39 break
39 chunks += [h] 40 chunks += [h]
41 i += 1
40 args.update(cgi.parse_qs(''.join(chunks), keep_blank_values=True)) 42 args.update(cgi.parse_qs(''.join(chunks), keep_blank_values=True))
41 return args 43 return args
42 def getfile(self, fp): 44 def getfile(self, fp):
43 length = int(self.req.env['CONTENT_LENGTH']) 45 length = int(self.req.env['CONTENT_LENGTH'])
44 for s in util.filechunkiter(self.req, limit=length): 46 for s in util.filechunkiter(self.req, limit=length):