changeset 28486:50314dc3ae4e

httppeer: compute header names only once This also helps make the code a little more readable.
author Augie Fackler <augie@google.com>
date Fri, 11 Mar 2016 11:51:22 -0500
parents d3893900f6c8
children 98d98a645e9d
files mercurial/httppeer.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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())