comparison mercurial/httprepo.py @ 14244:e7525a555a64

url: use new http support if requested by the user The new http library is wired in via an extra module (httpconnection.py), as it requires similar but different plumbing to connect the library to Mercurial's internals and urllib2. Eventualy we should be able to remove all of keepalive.py and its associated tangle in url.py and replace it all with the code in httpconnection.py. To use the new library, set 'ui.usehttp2' to true. The underlying http library uses the logging module liberally, so if things break you can use 'ui.http2debuglevel' to set the log level to INFO or DEBUG to get that logging information (for example, ui.http2debuglevel=info.)
author Augie Fackler <durin42@gmail.com>
date Fri, 06 May 2011 10:22:08 -0500
parents 091c86a77d19
children 13d44e4235f8
comparison
equal deleted inserted replaced
14243:861f28212398 14244:e7525a555a64
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 from node import nullid 9 from node import nullid
10 from i18n import _ 10 from i18n import _
11 import changegroup, statichttprepo, error, url, util, wireproto 11 import changegroup, statichttprepo, error, httpconnection, url, util, wireproto
12 import os, urllib, urllib2, zlib, httplib 12 import os, urllib, urllib2, zlib, httplib
13 import errno, socket 13 import errno, socket
14 14
15 def zgenerator(f): 15 def zgenerator(f):
16 zd = zlib.decompressobj() 16 zd = zlib.decompressobj()
178 if x in changegroup.bundletypes: 178 if x in changegroup.bundletypes:
179 type = x 179 type = x
180 break 180 break
181 181
182 tempname = changegroup.writebundle(cg, None, type) 182 tempname = changegroup.writebundle(cg, None, type)
183 fp = url.httpsendfile(self.ui, tempname, "rb") 183 fp = httpconnection.httpsendfile(self.ui, tempname, "rb")
184 headers = {'Content-Type': 'application/mercurial-0.1'} 184 headers = {'Content-Type': 'application/mercurial-0.1'}
185 185
186 try: 186 try:
187 try: 187 try:
188 r = self._call(cmd, data=fp, headers=headers, **args) 188 r = self._call(cmd, data=fp, headers=headers, **args)