'get_protocol_name', 'DER_cert_to_PEM_cert', 'PEM_cert_to_DER_cert'] for name in __imports__[:]: value = getattr(__ssl__, name) globals()[name] = value for name in dir(__ssl__): if not name.startswith('_'): value = getattr(__ssl__, name) if isinstance(value, (int, bytes, str, tuple)): globals()[name] = value __imports__.append(name) rebase(__ssl__.SSLSocket, globals(), '_SSLSocket', globals()) _SSLErrorReadTimeout = SSLError('The read operation timed out') _SSLErrorWriteTimeout = SSLError('The write operation timed out') _SSLErrorHandshakeTimeout = SSLError('The handshake operation timed out') class SSLSocket(_SSLSocket): def _handle_wait_exc(self, e, timeout): errno = e.args[0] if errno in [SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE] and self.timeout != 0.0: try: event = self._read_event if errno == SSL_ERROR_WANT_READ else self._write_event self._wait(event, timeout_exc=_SSLErrorReadTimeout) except socket_error as ex: if ex.args[0] == EBADF:
if not result or result == EISCONN: break elif (result in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or (result == EINVAL and is_windows): self._wait(self._write_event) else: raise error(result, strerror(result)) finally: if timer is not None: timer.cancel() del sock_timeout SocketType = socket for name in __rebase__: value = getattr(__socket__, name) rebase(value, globals(), name, globals()) class BlockingResolver(object): def __init__(self, hub=None): pass def close(self): pass for method in ['gethostbyname', 'gethostbyname_ex', 'getaddrinfo', 'gethostbyaddr', 'getnameinfo']: locals()[method] = staticmethod(getattr(__socket__, method))