Show More
@@ -132,7 +132,7 b' class httprepository(remoterepository):' | |||
|
132 | 132 | |
|
133 | 133 | proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') |
|
134 | 134 | # XXX proxyauthinfo = None |
|
135 | handler = httphandler() | |
|
135 | handlers = [httphandler()] | |
|
136 | 136 | |
|
137 | 137 | if proxyurl: |
|
138 | 138 | # proxy can be proper url or host[:port] |
@@ -164,7 +164,7 b' class httprepository(remoterepository):' | |||
|
164 | 164 | proxyscheme, netlocunsplit(proxyhost, proxyport, |
|
165 | 165 | proxyuser, proxypasswd or ''), |
|
166 | 166 | proxypath, proxyquery, proxyfrag)) |
|
167 |
handler |
|
|
167 | handlers.append(urllib2.ProxyHandler({scheme: proxyurl})) | |
|
168 | 168 | ui.debug(_('proxying through http://%s:%s\n') % |
|
169 | 169 | (proxyhost, proxyport)) |
|
170 | 170 | |
@@ -183,10 +183,9 b' class httprepository(remoterepository):' | |||
|
183 | 183 | (user, passwd and '*' * len(passwd) or 'not set')) |
|
184 | 184 | passmgr.add_password(None, host, user, passwd or '') |
|
185 | 185 | |
|
186 | opener = urllib2.build_opener( | |
|
187 | handler, | |
|
188 | urllib2.HTTPBasicAuthHandler(passmgr), | |
|
189 | urllib2.HTTPDigestAuthHandler(passmgr)) | |
|
186 | handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), | |
|
187 | urllib2.HTTPDigestAuthHandler(passmgr))) | |
|
188 | opener = urllib2.build_opener(*handlers) | |
|
190 | 189 | |
|
191 | 190 | # 1.0 here is the _protocol_ version |
|
192 | 191 | opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] |
@@ -222,11 +221,8 b' class httprepository(remoterepository):' | |||
|
222 | 221 | cu = "%s%s" % (self._url, qs) |
|
223 | 222 | try: |
|
224 | 223 | if data: |
|
225 | if isinstance(data, file): | |
|
226 | # urllib2 needs string or buffer when using a proxy | |
|
227 | data.seek(0) | |
|
228 | data = data.read() | |
|
229 | self.ui.debug(_("sending %d bytes\n") % len(data)) | |
|
224 | self.ui.debug(_("sending %s bytes\n") % | |
|
225 | headers.get('content-length', 'X')) | |
|
230 | 226 | resp = urllib2.urlopen(urllib2.Request(cu, data, headers)) |
|
231 | 227 | except urllib2.HTTPError, inst: |
|
232 | 228 | if inst.code == 401: |
General Comments 0
You need to be logged in to leave comments.
Login now