HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/botocore/__pycache__/httpsession.cpython-36.pyc
3

�T_�,�@s�ddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZddlmZddlmZddlmZdd	lmZmZmZydd
lmZWn e k
r�ddl
mZYnXddl!Z"ddl#m$Z$dd
l%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-mZm.Z.mZmZe(�ej/e0�Z1dZ2dZ3ej4j5ej4j6e7�d�Z8yddl9m:Z:Wne k
�r~dd�Z:YnXdd�Z;ddd�Z<Gdd�de=�Z>Gdd�de=�Z?dS)�N)�	b64encode)�PoolManager�ProxyManager�proxy_from_url�Timeout)�Retry)�ssl�OP_NO_SSLv2�OP_NO_SSLv3�OP_NO_COMPRESSION�DEFAULT_CIPHERS)�SSLError)�ReadTimeoutError)�ConnectTimeoutError)�NewConnectionError�
ProtocolError�
ProxyError)�orig_util_SSLContext)�
SSLContext)�six)�unquote)�filter_ssl_warnings�urlparse)�ConnectionClosedError�EndpointConnectionError�HTTPClientErrorr�ProxyConnectionErrorrr
�<�
z
cacert.pem)�wherecCstS)N)�DEFAULT_CA_BUNDLE�r!r!�!/usr/lib/python3.6/httpsession.pyr'srcCs|dk	r|St�S)NT)r)�verifyr!r!r"�
get_cert_path+sr$cCs�t|p
tj�}|dkrtjn|}|dkrDd}|tO}|tO}|tO}|j|O_t|dd�rl|j	|pht
�||_t|dd�dk	r�d|_|S)z� This function is a vendored version of the same function in urllib3

        We vendor this function to ensure that the SSL contexts we construct
        always use the std lib SSLContext instead of pyopenssl.
    NrZsupports_set_ciphersT�check_hostnameF)
rrZPROTOCOL_SSLv23�
CERT_REQUIREDr	r
r�options�getattrZset_ciphersrZverify_moder%)Zssl_version�	cert_reqsr'Zciphers�contextr!r!r"�create_urllib3_context2sr+c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ProxyConfigurationz�Represents a proxy configuration dictionary.

    This class represents a proxy configuration dictionary and provides utility
    functions to retreive well structured proxy urls and proxy headers from the
    proxy configuration dictionary.
    NcCs|dkri}||_dS)N)�_proxies)�self�proxiesr!r!r"�__init__^szProxyConfiguration.__init__cCs(t|�}|jj|j�}|r$|j|�}|S)z7Retrieves the corresponding proxy url for a given url. )rr-�get�scheme�_fix_proxy_url)r.�url�
parsed_url�proxyr!r!r"�
proxy_url_forcs

z ProxyConfiguration.proxy_url_forcCs2i}|j|�\}}|r.|r.|j||�}||d<|S)zARetrieves the corresponding proxy headers for a given proxy url. zProxy-Authorization)�_get_auth_from_url�_construct_basic_auth)r.�	proxy_url�headers�username�passwordZ
basic_authr!r!r"�proxy_headers_forksz$ProxyConfiguration.proxy_headers_forcCs6|jd�s|jd�r|S|jd�r*d|Sd|SdS)Nzhttp:zhttps:z//zhttp://)�
startswith)r.r:r!r!r"r3ts

z!ProxyConfiguration._fix_proxy_urlcCs,dj||�}t|jd��j�j�}dj|�S)Nz{0}:{1}�asciiz	Basic {0})�formatr�encode�strip�decode)r.r<r=Zauth_strZencoded_strr!r!r"r9|sz(ProxyConfiguration._construct_basic_authcCs:t|�}yt|j�t|j�fSttfk
r4dSXdS)N)NN)rrr<r=�AttributeError�	TypeError)r.r4r5r!r!r"r8�s
z%ProxyConfiguration._get_auth_from_url)N)
�__name__�
__module__�__qualname__�__doc__r0r7r>r3r9r8r!r!r!r"r,Ws
	r,c@speZdZdZdddeddfdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�ZdS)�URLLib3Sessiona_A basic HTTP client that supports connection pooling and proxies.

    This class is inspired by requests.adapters.HTTPAdapter, but has been
    boiled down to meet the use cases needed by botocore. For the most part
    this classes matches the functionality of HTTPAdapter in requests v2.7.0
    (the same as our vendored version). The only major difference of note is
    that we currently do not support sending chunked requests. While requests
    v2.7.0 implemented this themselves, later version urllib3 support this
    directly via a flag to urlopen so enabling it if needed should be trivial.
    TNcCs�||_t|d�|_tjjtjjd�|_|dkr2t}t	|t
tf�sTt|d|dd�}d|_
d|_t	|t�rr||_
nt	|t�r�|\|_
|_||_||_||_|dkr�g|_i|_tf|j��|_|j|j_dS)N)r/)Zhttp�httpsr�)Zconnect�read)�_verifyr,�
_proxy_config�botocore�
awsrequestZAWSHTTPConnectionPoolZAWSHTTPSConnectionPool�_pool_classes_by_scheme�DEFAULT_TIMEOUT�
isinstance�int�floatr�
_cert_file�	_key_file�str�tuple�_timeout�_max_pool_connections�_socket_options�_proxy_managersr�_get_pool_manager_kwargs�_manager�pool_classes_by_scheme)r.r#r/�timeoutZmax_pool_connections�socket_optionsZclient_certr!r!r"r0�s,

zURLLib3Session.__init__cKs2d|j|j|j�|j|j|jd�}|jf|�|S)NT)�strictrc�maxsizeZssl_contextrdZ	cert_fileZkey_file)r\r]�_get_ssl_contextr^rXrY�update)r.Zextra_kwargsZpool_manager_kwargsr!r!r"r`�s
z'URLLib3Session._get_pool_manager_kwargscCst�S)N)r+)r.r!r!r"rg�szURLLib3Session._get_ssl_contextcCsJ||jkr@|jj|�}|j|d�}t|f|�}|j|_||j|<|j|S)N)�
proxy_headers)r_rPr>r`rrSrb)r.r:riZproxy_manager_kwargsZ
proxy_managerr!r!r"�_get_proxy_manager�s

z!URLLib3Session._get_proxy_managercCs.t|�}|j}|sd}|jr*|d|j}|S)N�/�?)r�pathZquery)r.r4r5rmr!r!r"�	_path_url�szURLLib3Session._path_urlcCs4|j�jd�r$|r$d|_t|�|_nd|_d|_dS)NrLr&Z	CERT_NONE)�lowerr?r)r$Zca_certs)r.�connr4r#r!r!r"�_setup_ssl_cert�s
zURLLib3Session._setup_ssl_certcCs|r|j|�}n|j}|S)N)rjra)r.r4r:�managerr!r!r"�_get_connection_manager�sz&URLLib3Session._get_connection_managercCs |r|jd�r|S|j|�SdS)Nzhttp:)r?rn)r.r4r:r!r!r"�_get_request_target�sz"URLLib3Session._get_request_targetcCs|jdd�dkS)NzTransfer-Encoding��chunked)r1)r.r;r!r!r"�_chunked�szURLLib3Session._chunkedc
Csy�|jj|j�}|j|j|�}|j|j�}|j||j|j�|j|j|�}|j|j	||j
|jtd�ddd|j
|j�d�	}tjj|j|j|j|�}|js�|j|Stk
r�}zt|j|d��WYdd}~X�n8ttjfk
�r}zt|j|d��WYdd}~X�ntk
�r6}zt||d��WYdd}~Xn�tk
�rf}zt|j|d��WYdd}~Xn�tk
�r�}zt|j|d��WYdd}~Xnrt k
�r�}zt!|||jd��WYdd}~Xn@t"k
�r}z"d}	t#j$|	dd�t%|d	��WYdd}~XnXdS)
NF)	�methodr4�bodyr;ZretriesZassert_same_hostZpreload_contentZdecode_contentrv)�endpoint_url�error)r:r{)r{�requestrzz4Exception received when sending urllib3 HTTP requestT)�exc_info)r{)&rPr7r4rsZconnection_from_urlrqrOrtZurlopenrxryr;rrwrQrRZAWSResponseZstatusZ
stream_outputZcontent�URLLib3SSLErrorr
r�socketZgaierrorrrr�URLLib3ConnectTimeoutErrorr�URLLib3ReadTimeoutErrorrrr�	Exception�logger�debugr)
r.r|r:rrrpZrequest_targetZurllib_responseZ
http_response�e�messager!r!r"�send�sV  zURLLib3Session.send)N)rGrHrIrJ�MAX_POOL_CONNECTIONSr0r`rgrjrnrqrsrtrwr�r!r!r!r"rK�s 

	
	rK)NNNN)@Zos.path�osZloggingr�base64rZurllib3rrrrZurllib3.util.retryrZurllib3.util.ssl_rr	r
rrZurllib3.exceptionsr
r~rr�rr�rrrZurllib3.contrib.pyopensslrr�ImportErrorZbotocore.awsrequestrQZbotocore.vendoredrZ(botocore.vendored.six.moves.urllib_parserZbotocore.compatrrZbotocore.exceptionsrrrrZ	getLoggerrGr�rTr�rm�join�dirname�__file__r Zcertifirr$r+�objectr,rKr!r!r!r"�<module>sB$

$2