mercurial/httppeer.py
changeset 34701 6db536bed7ec
parent 34699 375c8debe336
child 34724 9c3dcaf648ef
equal deleted inserted replaced
34700:8e5132ece156 34701:6db536bed7ec
   219                     i.length = len(data)
   219                     i.length = len(data)
   220                     data = i
   220                     data = i
   221                 argsio = io.BytesIO(strargs)
   221                 argsio = io.BytesIO(strargs)
   222                 argsio.length = len(strargs)
   222                 argsio.length = len(strargs)
   223                 data = _multifile(argsio, data)
   223                 data = _multifile(argsio, data)
   224             headers['X-HgArgs-Post'] = len(strargs)
   224             headers[r'X-HgArgs-Post'] = len(strargs)
   225         else:
   225         else:
   226             if len(args) > 0:
   226             if len(args) > 0:
   227                 httpheader = self.capable('httpheader')
   227                 httpheader = self.capable('httpheader')
   228                 if httpheader:
   228                 if httpheader:
   229                     headersize = int(httpheader.split(',', 1)[0])
   229                     headersize = int(httpheader.split(',', 1)[0])
   242         if util.safehasattr(data, 'length'):
   242         if util.safehasattr(data, 'length'):
   243             size = data.length
   243             size = data.length
   244         elif data is not None:
   244         elif data is not None:
   245             size = len(data)
   245             size = len(data)
   246         if size and self.ui.configbool('ui', 'usehttp2'):
   246         if size and self.ui.configbool('ui', 'usehttp2'):
   247             headers['Expect'] = '100-Continue'
   247             headers[r'Expect'] = r'100-Continue'
   248             headers['X-HgHttp2'] = '1'
   248             headers[r'X-HgHttp2'] = r'1'
   249         if data is not None and 'Content-Type' not in headers:
   249         if data is not None and r'Content-Type' not in headers:
   250             headers['Content-Type'] = 'application/mercurial-0.1'
   250             headers[r'Content-Type'] = r'application/mercurial-0.1'
   251 
   251 
   252         # Tell the server we accept application/mercurial-0.2 and multiple
   252         # Tell the server we accept application/mercurial-0.2 and multiple
   253         # compression formats if the server is capable of emitting those
   253         # compression formats if the server is capable of emitting those
   254         # payloads.
   254         # payloads.
   255         protoparams = []
   255         protoparams = []
   279             for header, value in protoheaders:
   279             for header, value in protoheaders:
   280                 headers[header] = value
   280                 headers[header] = value
   281                 varyheaders.append(header)
   281                 varyheaders.append(header)
   282 
   282 
   283         if varyheaders:
   283         if varyheaders:
   284             headers['Vary'] = ','.join(varyheaders)
   284             headers[r'Vary'] = r','.join(varyheaders)
   285 
   285 
   286         req = self._requestbuilder(pycompat.strurl(cu), data, headers)
   286         req = self._requestbuilder(pycompat.strurl(cu), data, headers)
   287 
   287 
   288         if data is not None:
   288         if data is not None:
   289             self.ui.debug("sending %s bytes\n" % size)
   289             self.ui.debug("sending %s bytes\n" % size)