httppeer: compute header names only once
This also helps make the code a little more readable.
--- a/mercurial/httppeer.py Fri Mar 11 11:33:43 2016 -0500
+++ b/mercurial/httppeer.py Fri Mar 11 11:51:22 2016 -0500
@@ -108,12 +108,12 @@
headerfmt = 'X-HgArg-%s'
contentlen = headersize - len(headerfmt % '000' + ': \r\n')
headernum = 0
+ varyheaders = []
for i in xrange(0, len(encargs), contentlen):
headernum += 1
header = headerfmt % str(headernum)
headers[header] = encargs[i:i + contentlen]
- varyheaders = [
- headerfmt % str(h) for h in range(1, headernum + 1)]
+ varyheaders.append(header)
headers['Vary'] = ','.join(varyheaders)
else:
q += sorted(args.items())