def mywrap_socket(sock, *args, **kwargs): kwargs['do_handshake_on_connect'] = False sock = ssl.wrap_socketold(sock, *args, **kwargs) sock.settimeout(StandardBrowser.DEFAULT_TIMEOUT) try: sock.getpeername() except: sock.do_handshake_on_connect = True else: sock.do_handshake() return sock
def mywrap_socket(sock, *args, **kwargs): kwargs["do_handshake_on_connect"] = False kwargs["ssl_version"] = kwargs.get("ssl_version", ssl.PROTOCOL_TLSv1) sock = ssl.wrap_socketold(sock, *args, **kwargs) sock.settimeout(StandardBrowser.DEFAULT_TIMEOUT) try: sock.getpeername() except: sock.do_handshake_on_connect = True else: sock.do_handshake() return sock