comparison mercurial/sslutil.py @ 29228:9b07017ba528

sslutil: remove redundant check of sslsocket.cipher() We are doing this check in both wrapsocket() and validatesocket(). The check was added to the validator in 4bb59919c905 and the commit message justifies the redundancy with a "might." The check in wrapsocket() was added in 0cc4ad757c77, which appears to be part of the same series. I'm going to argue the redundancy isn't needed. I choose to keep the check in wrapsocket() because it is working around a bug in Python's wrap_socket() and I feel the check for the bug should live next to the function call exhibiting the bug.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 15 May 2016 11:50:49 -0700
parents dffe78d80a6c
children e6de6ef3e426
comparison
equal deleted inserted replaced
29227:dffe78d80a6c 29228:9b07017ba528
297 The passed socket must have been created with ``wrapsocket()``. 297 The passed socket must have been created with ``wrapsocket()``.
298 """ 298 """
299 host = sock._hgstate['hostname'] 299 host = sock._hgstate['hostname']
300 ui = sock._hgstate['ui'] 300 ui = sock._hgstate['ui']
301 301
302 if not sock.cipher(): # work around http://bugs.python.org/issue13721
303 raise error.Abort(_('%s ssl connection error') % host)
304 try: 302 try:
305 peercert = sock.getpeercert(True) 303 peercert = sock.getpeercert(True)
306 peercert2 = sock.getpeercert() 304 peercert2 = sock.getpeercert()
307 except AttributeError: 305 except AttributeError:
308 raise error.Abort(_('%s ssl connection error') % host) 306 raise error.Abort(_('%s ssl connection error') % host)