local import
parent
6e662a291a
commit
f4237f9bf6
|
@ -38,9 +38,9 @@ import socket
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from os import path
|
from os import path
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from err import openssl_error
|
from .err import openssl_error
|
||||||
from err import SSL_ERROR_NONE
|
from .err import SSL_ERROR_NONE
|
||||||
from util import _EC_KEY, _BIO
|
from .util import _EC_KEY, _BIO
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
from ctypes import CFUNCTYPE
|
from ctypes import CFUNCTYPE
|
||||||
|
|
|
@ -34,18 +34,19 @@ has the following effects:
|
||||||
PROTOCOL_DTLSv1 for the parameter ssl_version is supported
|
PROTOCOL_DTLSv1 for the parameter ssl_version is supported
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from socket import socket, getaddrinfo, _delegate_methods, error as socket_error
|
# from socket import socket, getaddrinfo, _delegate_methods, error as socket_error
|
||||||
|
from socket import socket, getaddrinfo, error as socket_error
|
||||||
from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM
|
from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM
|
||||||
from ssl import PROTOCOL_SSLv23, CERT_NONE
|
from ssl import PROTOCOL_SSLv23, CERT_NONE
|
||||||
from types import MethodType
|
from types import MethodType
|
||||||
from weakref import proxy
|
from weakref import proxy
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
from sslconnection import SSLConnection, PROTOCOL_DTLS, PROTOCOL_DTLSv1, PROTOCOL_DTLSv1_2
|
from .sslconnection import SSLConnection, PROTOCOL_DTLS, PROTOCOL_DTLSv1, PROTOCOL_DTLSv1_2
|
||||||
from sslconnection import DTLS_OPENSSL_VERSION_NUMBER, DTLS_OPENSSL_VERSION, DTLS_OPENSSL_VERSION_INFO
|
from .sslconnection import DTLS_OPENSSL_VERSION_NUMBER, DTLS_OPENSSL_VERSION, DTLS_OPENSSL_VERSION_INFO
|
||||||
from sslconnection import SSL_BUILD_CHAIN_FLAG_NONE, SSL_BUILD_CHAIN_FLAG_UNTRUSTED, \
|
from .sslconnection import SSL_BUILD_CHAIN_FLAG_NONE, SSL_BUILD_CHAIN_FLAG_UNTRUSTED, \
|
||||||
SSL_BUILD_CHAIN_FLAG_NO_ROOT, SSL_BUILD_CHAIN_FLAG_CHECK, SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR, SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR
|
SSL_BUILD_CHAIN_FLAG_NO_ROOT, SSL_BUILD_CHAIN_FLAG_CHECK, SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR, SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR
|
||||||
from err import raise_as_ssl_module_error, patch_ssl_errors
|
from .err import raise_as_ssl_module_error, patch_ssl_errors
|
||||||
|
|
||||||
|
|
||||||
def do_patch():
|
def do_patch():
|
||||||
|
@ -158,11 +159,11 @@ def _SSLSocket_init(self, sock=None, keyfile=None, certfile=None,
|
||||||
else:
|
else:
|
||||||
socket.__init__(self, _sock=sock.get_socket(True)._sock)
|
socket.__init__(self, _sock=sock.get_socket(True)._sock)
|
||||||
# Copy instance initialization from SSLSocket class
|
# Copy instance initialization from SSLSocket class
|
||||||
for attr in _delegate_methods:
|
#for attr in _delegate_methods:
|
||||||
try:
|
# try:
|
||||||
delattr(self, attr)
|
# delattr(self, attr)
|
||||||
except AttributeError:
|
# except AttributeError:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
if certfile and not keyfile:
|
if certfile and not keyfile:
|
||||||
keyfile = certfile
|
keyfile = certfile
|
||||||
|
|
|
@ -50,17 +50,17 @@ from os import urandom
|
||||||
from select import select
|
from select import select
|
||||||
from weakref import proxy
|
from weakref import proxy
|
||||||
|
|
||||||
from err import openssl_error, InvalidSocketError
|
from .err import openssl_error, InvalidSocketError
|
||||||
from err import raise_ssl_error
|
from .err import raise_ssl_error
|
||||||
from err import SSL_ERROR_WANT_READ, SSL_ERROR_SYSCALL
|
from .err import SSL_ERROR_WANT_READ, SSL_ERROR_SYSCALL
|
||||||
from err import ERR_WRONG_VERSION_NUMBER, ERR_COOKIE_MISMATCH, ERR_NO_SHARED_CIPHER
|
from .err import ERR_WRONG_VERSION_NUMBER, ERR_COOKIE_MISMATCH, ERR_NO_SHARED_CIPHER
|
||||||
from err import ERR_NO_CIPHER, ERR_HANDSHAKE_TIMEOUT, ERR_PORT_UNREACHABLE
|
from .err import ERR_NO_CIPHER, ERR_HANDSHAKE_TIMEOUT, ERR_PORT_UNREACHABLE
|
||||||
from err import ERR_READ_TIMEOUT, ERR_WRITE_TIMEOUT
|
from .err import ERR_READ_TIMEOUT, ERR_WRITE_TIMEOUT
|
||||||
from err import ERR_BOTH_KEY_CERT_FILES, ERR_BOTH_KEY_CERT_FILES_SVR, ERR_NO_CERTS
|
from .err import ERR_BOTH_KEY_CERT_FILES, ERR_BOTH_KEY_CERT_FILES_SVR, ERR_NO_CERTS
|
||||||
from x509 import _X509, decode_cert
|
from .x509 import _X509, decode_cert
|
||||||
from tlock import tlock_init
|
from .tlock import tlock_init
|
||||||
from openssl import *
|
from .openssl import *
|
||||||
from util import _Rsrc, _BIO
|
from .util import _Rsrc, _BIO
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ threading support. It does not have client-visible components.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from openssl import *
|
from .openssl import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
|
|
|
@ -35,10 +35,10 @@ from logging import getLogger
|
||||||
|
|
||||||
import ssl
|
import ssl
|
||||||
import socket
|
import socket
|
||||||
from patch import do_patch
|
from .patch import do_patch
|
||||||
do_patch()
|
do_patch()
|
||||||
from sslconnection import SSLContext, SSL
|
from .sslconnection import SSLContext, SSL
|
||||||
import err as err_codes
|
import .err as err_codes
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ interpreter.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from openssl import *
|
from .openssl import *
|
||||||
from util import _Rsrc, _BIO
|
from .util import _Rsrc, _BIO
|
||||||
|
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue