summaryrefslogtreecommitdiff
path: root/mercurial/url.py
diff options
context:
space:
mode:
Diffstat (limited to 'mercurial/url.py')
-rw-r--r--mercurial/url.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/mercurial/url.py b/mercurial/url.py
index 9cb88e0..60b1012 100644
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -135,7 +135,7 @@ def _gen_sendfile(orgsend):
orgsend(self, data)
return _sendfile
-has_https = util.safehasattr(urllib2, 'HTTPSHandler')
+has_https = hasattr(urllib2, 'HTTPSHandler')
if has_https:
try:
_create_connection = socket.create_connection
@@ -192,8 +192,8 @@ class httpconnection(keepalive.HTTPConnection):
# general transaction handler to support different ways to handle
# HTTPS proxying before and after Python 2.6.3.
def _generic_start_transaction(handler, h, req):
- tunnel_host = getattr(req, '_tunnel_host', None)
- if tunnel_host:
+ if hasattr(req, '_tunnel_host') and req._tunnel_host:
+ tunnel_host = req._tunnel_host
if tunnel_host[:7] not in ['http://', 'https:/']:
tunnel_host = 'https://' + tunnel_host
new_tunnel = True
@@ -377,8 +377,7 @@ if has_https:
keyfile = self.auth['key']
certfile = self.auth['cert']
- conn = httpsconnection(host, port, keyfile, certfile, *args,
- **kwargs)
+ conn = httpsconnection(host, port, keyfile, certfile, *args, **kwargs)
conn.ui = self.ui
return conn