local import

master
inpos 2017-12-18 10:22:46 +03:00
parent 6e662a291a
commit f4237f9bf6
6 changed files with 31 additions and 30 deletions

View File

@ -38,9 +38,9 @@ import socket
from logging import getLogger
from os import path
from datetime import timedelta
from err import openssl_error
from err import SSL_ERROR_NONE
from util import _EC_KEY, _BIO
from .err import openssl_error
from .err import SSL_ERROR_NONE
from .util import _EC_KEY, _BIO
import ctypes
from ctypes import CDLL
from ctypes import CFUNCTYPE

View File

@ -34,18 +34,19 @@ has the following effects:
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 ssl import PROTOCOL_SSLv23, CERT_NONE
from types import MethodType
from weakref import proxy
import errno
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 SSL_BUILD_CHAIN_FLAG_NONE, SSL_BUILD_CHAIN_FLAG_UNTRUSTED, \
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 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
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():
@ -158,11 +159,11 @@ def _SSLSocket_init(self, sock=None, keyfile=None, certfile=None,
else:
socket.__init__(self, _sock=sock.get_socket(True)._sock)
# Copy instance initialization from SSLSocket class
for attr in _delegate_methods:
try:
delattr(self, attr)
except AttributeError:
pass
#for attr in _delegate_methods:
# try:
# delattr(self, attr)
# except AttributeError:
# pass
if certfile and not keyfile:
keyfile = certfile

View File

@ -50,17 +50,17 @@ from os import urandom
from select import select
from weakref import proxy
from err import openssl_error, InvalidSocketError
from err import raise_ssl_error
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_NO_CIPHER, ERR_HANDSHAKE_TIMEOUT, ERR_PORT_UNREACHABLE
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 x509 import _X509, decode_cert
from tlock import tlock_init
from openssl import *
from util import _Rsrc, _BIO
from .err import openssl_error, InvalidSocketError
from .err import raise_ssl_error
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_NO_CIPHER, ERR_HANDSHAKE_TIMEOUT, ERR_PORT_UNREACHABLE
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 .x509 import _X509, decode_cert
from .tlock import tlock_init
from .openssl import *
from .util import _Rsrc, _BIO
_logger = getLogger(__name__)

View File

@ -25,7 +25,7 @@ threading support. It does not have client-visible components.
"""
from logging import getLogger
from openssl import *
from .openssl import *
try:
import threading

View File

@ -35,10 +35,10 @@ from logging import getLogger
import ssl
import socket
from patch import do_patch
from .patch import do_patch
do_patch()
from sslconnection import SSLContext, SSL
import err as err_codes
from .sslconnection import SSLContext, SSL
import .err as err_codes
_logger = getLogger(__name__)

View File

@ -31,8 +31,8 @@ interpreter.
"""
from logging import getLogger
from openssl import *
from util import _Rsrc, _BIO
from .openssl import *
from .util import _Rsrc, _BIO
_logger = getLogger(__name__)