Exemplo n.º 1
0
 def testSimpleSSLwrap(self):
     try:
         ssl.sslwrap_simple(socket.socket(socket.AF_INET))
     except IOError, e:
         if e.errno == 32:  # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
             pass
         else:
             raise
Exemplo n.º 2
0
 def testSimpleSSLwrap(self):
     try:
         ssl.sslwrap_simple(socket.socket(socket.AF_INET))
     except IOError, e:
         if e.errno == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
             pass
         else:
             raise
Exemplo n.º 3
0
 def test_sslwrap_simple(self):
     # A crude test for the legacy API
     try:
         ssl.sslwrap_simple(socket.socket(socket.AF_INET))
     except IOError, e:
         if e.errno == 32:  # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
             pass
         else:
             raise
Exemplo n.º 4
0
 def ssl(sock, keyfile=None, certfile=None):
     # we do an internal import here because the ssl
     # module imports the socket module
     import ssl as _realssl
     warnings.warn("socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.",
                   DeprecationWarning, stacklevel=2)
     return _realssl.sslwrap_simple(sock, keyfile, certfile)
Exemplo n.º 5
0
 def ssl(sock, keyfile=None, certfile=None):
     # we do an internal import here because the ssl
     # module imports the socket module
     import ssl as _realssl
     warnings.warn("socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.",
                   DeprecationWarning, stacklevel=2)
     return _realssl.sslwrap_simple(sock, keyfile, certfile)
Exemplo n.º 6
0
 def ssl(sock, keyfile=None, certfile=None):
     import ssl as _realssl
     warnings.warn(
         'socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.',
         DeprecationWarning,
         stacklevel=2)
     return _realssl.sslwrap_simple(sock, keyfile, certfile)
Exemplo n.º 7
0
def handle_error(prefix):
    exc_format = " ".join(traceback.format_exception(*sys.exc_info()))
    if test_support.verbose:
        sys.stdout.write(prefix + exc_format)

    def testSimpleSSLwrap(self):
        try:
            ssl.sslwrap_simple(socket.socket(socket.AF_INET))
        except IOError, e:
            if e.errno == 32:  # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
                pass
            else:
                raise
        try:
            ssl.sslwrap_simple(socket.socket(socket.AF_INET)._sock)
        except IOError, e:
            if e.errno == 32:  # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
                pass
            else:
                raise
Exemplo n.º 8
0
def handle_error(prefix):
    exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
    if test_support.verbose:
        sys.stdout.write(prefix + exc_format)

    def testSimpleSSLwrap(self):
        try:
            ssl.sslwrap_simple(socket.socket(socket.AF_INET))
        except IOError, e:
            if e.errno == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
                pass
            else:
                raise
        try:
            ssl.sslwrap_simple(socket.socket(socket.AF_INET)._sock)
        except IOError, e:
            if e.errno == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
                pass
            else:
                raise
Exemplo n.º 9
0
 def ssl(sock, keyfile = None, certfile = None):
     import ssl as _realssl
     warnings.warn('socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.', DeprecationWarning, stacklevel=2)
     return _realssl.sslwrap_simple(sock, keyfile, certfile)