HEX
Server: nginx/1.30.4
System: Linux d-twindigital-web-1.host-ed.eu 4.18.0-553.141.2.el8_10.x86_64 #1 SMP Wed Jul 8 10:28:18 EDT 2026 x86_64
User: u_twindigital_html (1009)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/ndg/httpsclient/__pycache__/https.cpython-36.opt-1.pyc
3

�Q[�@s�dZdZdZdZdZdZdZddlZddlZddl	Z	e	j
dd	krhdd
lmZddlm
Z
ddlmZn$dd
lmZddlm
Z
ddlmZdd
lmZddlmZeje�ZGdd�de
�ZGdd�de�ZdS)z�ndg_httpsclient HTTPS module containing PyOpenSSL implementation of
httplib.HTTPSConnection

PyOpenSSL utility to make a httplib-like interface suitable for use with 
urllib2
zP J Kershaw (STFC)z09/12/11z2(C) 2012 Science and Technology Facilities Councilz-BSD - see LICENSE file in top-level directoryzPhilip.Kershaw@stfc.ac.ukz$Id$�N�)�
HTTPS_PORT)�HTTPConnection)�AbstractHTTPHandler)�SSL)�	SSLSocketc@s>eZdZdZeZejZdde	j
dfdd�Zdd�Zdd�Z
dS)	�HTTPSConnectionaTThis class allows communication via SSL using PyOpenSSL.
    It is based on httplib.HTTPSConnection, modified to use PyOpenSSL.

    Note: This uses the constructor inherited from HTTPConnection to allow it to
    be used with httplib and HTTPSContextHandler. To use the class directly with
    an SSL context set ssl_context after construction.
    
    @cvar default_port: default port for this class (443)
    @type default_port: int
    @cvar default_ssl_method: default SSL method used if no SSL context is
    explicitly set - defaults to version 2/3.
    @type default_ssl_method: int
    NcCsLtj|||||�t|d�s"d|_|dk	rHt|tj�sBtd|��||_dS)N�ssl_contextzLExpecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r instead)r�__init__�hasattrr	�
isinstancer�Context�	TypeError)�self�host�port�strict�timeoutr	�r�/usr/lib/python3.6/https.pyr
5s
zHTTPSConnection.__init__cCs�t|dd�r0t|jtj�s(td|j��|j}ntj|jj�}tj	|j
|jf|j�}t|dd�rn||_
|j�t||�|_
|j
j�dS)z.Create SSL socket and connect to peer
        r	NzNExpecting OpenSSL.SSL.Context type for "ssl_context" attribute; got %r insteadZ_tunnel_host)�getattrrr	rr
r�	__class__�default_ssl_method�socketZcreate_connectionrrr�sockZ_tunnelrZset_connect_state)rr	rrrr�connectCs
zHTTPSConnection.connectcCst|jd�r|jj�dS)z)Close socket and shut down SSL connection�closeN)rrr)rrrrr[szHTTPSConnection.close)�__name__�
__module__�__qualname__�__doc__rZdefault_portr�TLSv1_2_METHODrrZ_GLOBAL_DEFAULT_TIMEOUTr
rrrrrrr$s

rc@s.eZdZdZejZejZ	ddd�Z
dd�ZdS)	�HTTPSContextHandlerzSHTTPS handler that allows a SSL context to be set for the SSL
    connections.
    rcCsHtj||�|dk	r4t|tj�s,td|��||_ntj|jj�|_dS)z�
        @param ssl_context:SSL context
        @type ssl_context: OpenSSL.SSL.Context
        @param debuglevel: debug level for HTTPSHandler
        @type debuglevel: int
        NzLExpecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r instead)	rr
rrr
rr	r�
SSL_METHOD)rr	Z
debuglevelrrrr
iszHTTPSContextHandler.__init__cCs"tdttfd|ji�}|j||�S)zcOpens HTTPS request
        @param req: HTTP request
        @return: HTTP Response object
        ZCustomHTTPSContextConnectionr	)�typer�objectr	Zdo_open)rZreqZcustomHTTPSContextConnectionrrr�
https_open{szHTTPSContextHandler.https_openN)r)rrrr rZdo_request_Z
https_requestrr!r#r
r&rrrrr"as

r")r �
__author__Z__date__Z
__copyright__Z__license__Z__contact__Z__revision__Zloggingr�sys�version_infoZhttp.clientrrZurllib.requestrZhttplibZurllib2ZOpenSSLrZndg.httpsclient.ssl_socketrZ	getLoggerr�logrr"rrrr�<module>s*
=