##// END OF EJS Templates
url: always create BetterHTTPS connections the same way
Mads Kiilerich -
r13422:ebce5196 default
parent child Browse files
Show More
@@ -546,12 +546,13 b' if has_https:'
546 send = keepalive.safesend
546 send = keepalive.safesend
547
547
548 def connect(self):
548 def connect(self):
549 self.sock = _create_connection((self.host, self.port))
550
549 host = self.host
551 host = self.host
550 cacerts = self.ui.config('web', 'cacerts')
552 cacerts = self.ui.config('web', 'cacerts')
551 hostfingerprint = self.ui.config('hostfingerprints', host)
553 hostfingerprint = self.ui.config('hostfingerprints', host)
552
554
553 if cacerts and not hostfingerprint:
555 if cacerts and not hostfingerprint:
554 sock = _create_connection((self.host, self.port))
555 self.sock = _ssl_wrap_socket(self.sock, self.key_file,
556 self.sock = _ssl_wrap_socket(self.sock, self.key_file,
556 self.cert_file, cert_reqs=CERT_REQUIRED,
557 self.cert_file, cert_reqs=CERT_REQUIRED,
557 ca_certs=util.expandpath(cacerts))
558 ca_certs=util.expandpath(cacerts))
@@ -562,7 +563,8 b' if has_https:'
562 'insecurely)') % (host, msg))
563 'insecurely)') % (host, msg))
563 self.ui.debug('%s certificate successfully verified\n' % host)
564 self.ui.debug('%s certificate successfully verified\n' % host)
564 else:
565 else:
565 httplib.HTTPSConnection.connect(self)
566 self.sock = _ssl_wrap_socket(self.sock, self.key_file,
567 self.cert_file)
566 if hasattr(self.sock, 'getpeercert'):
568 if hasattr(self.sock, 'getpeercert'):
567 peercert = self.sock.getpeercert(True)
569 peercert = self.sock.getpeercert(True)
568 peerfingerprint = util.sha1(peercert).hexdigest()
570 peerfingerprint = util.sha1(peercert).hexdigest()
General Comments 0
You need to be logged in to leave comments. Login now