403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.141.38.5
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/connector.cpython-37.pyc
B

�k�a���@sRddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddl
mZmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"ddl#Z#d	d
l$m%Z%m&Z&d	dl'm(Z(d	dl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3d	d
l4m5Z5d	dl6m7Z7m8Z8m9Z9d	dl&m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?d	dl@mAZAd	dlBmCZCd	dlDmEZEyddlFZFeFjGZGWneHk
�r�dZFeIZGYnXdZJe�r�d	dlKmLZLd	dl6mMZMd	dlNmOZOGdd�d�ZPGdd�d�ZQGdd�d�ZRGdd�d�ZSGdd �d �ZTGd!d"�d"eS�ZUGd#d$�d$eS�ZVGd%d&�d&eS�ZWdS)'�N)�defaultdict�deque)�suppress)�SimpleCookie)�cycle�islice)�	monotonic)�
TracebackType)�
TYPE_CHECKING�Any�	Awaitable�Callable�DefaultDict�Dict�Iterator�List�Optional�Set�Tuple�Type�Union�cast�)�hdrs�helpers)�AbstractResolver)
�ClientConnectionError�ClientConnectorCertificateError�ClientConnectorError�ClientConnectorSSLError�ClientHttpProxyError�ClientProxyConnectionError�ServerFingerprintMismatch�UnixClientConnectorError�cert_errors�
ssl_errors)�ResponseHandler)�
ClientRequest�Fingerprint�_merge_ssl_params)�PY_36�ceil_timeout�get_running_loop�
is_ip_address�noop�sentinel)�	RESPONSES)�EventResultOrError)�DefaultResolver)�
BaseConnector�TCPConnector�
UnixConnector�NamedPipeConnector)�
ClientTimeout)�
ConnectionKey)�Tracec@s@eZdZdZeedd�dd�Zed�dd�Zdd�d	d
�ZdS)�_DeprecationWaiter)�
_awaitable�_awaitedN)�	awaitable�returncCs||_d|_dS)NF)r;r<)�selfr=�r@�D/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/connector.py�__init__Qsz_DeprecationWaiter.__init__)r>cCsd|_|j��S)NT)r<r;�	__await__)r?r@r@rArCUsz_DeprecationWaiter.__await__cCs|jst�dt�dS)NzDConnector.close() is a coroutine, please use await connector.close())r<�warnings�warn�DeprecationWarning)r?r@r@rA�__del__Ysz_DeprecationWaiter.__del__)	�__name__�
__module__�__qualname__�	__slots__rrrBrCrGr@r@r@rAr:Nsr:c@s�eZdZdZdZddeejdd�dd�Ze	d�dd	�Z
efedd
�dd�Z
eejd�d
d��Zeeejd�dd��Zeeed�dd��Zegdfdd�dd�Zdd�dd�Zdd�dd�Zdd�dd�Zeed�dd��ZdS)�
ConnectionNr3r8)�	connector�key�protocol�loopr>cCs<||_||_||_||_g|_|��r8t�t�	d��|_
dS)Nr)�_key�
_connector�_loop�	_protocol�
_callbacks�	get_debug�	traceback�
extract_stack�sys�	_getframe�_source_traceback)r?rMrNrOrPr@r@rArBgszConnection.__init__)r>cCsd|j�d�S)NzConnection<�>)rQ)r?r@r@rA�__repr__wszConnection.__repr__)�	_warningsr>cCs�|jdk	r�trd|i}ni}|jd|��tf|�|j��r@dS|jj|j|jdd�|dd�}|j	dk	rt|j	|d<|j�
|�dS)N�sourcezUnclosed connection T)�should_closezUnclosed connection)Zclient_connection�message�source_traceback)rTr*rE�ResourceWarningrS�	is_closedrR�_releaserQr[�call_exception_handler)r?r^�kwargs�contextr@r@rArGzs





zConnection.__del__cCstjdtdd�|jS)Nz%connector.loop property is deprecated�)�
stacklevel)rDrErFrS)r?r@r@rArP�szConnection.loopcCs|jdkrdS|jjS)N)rT�	transport)r?r@r@rArk�s
zConnection.transportcCs|jS)N)rT)r?r@r@rArO�szConnection.protocol)�callbackr>cCs|dk	r|j�|�dS)N)rU�append)r?rlr@r@rA�add_callback�szConnection.add_callbackc
CsB|jdd�g}|_x&|D]}tt��|�WdQRXqWdS)N)rUr�	Exception)r?�	callbacks�cbr@r@rA�_notify_release�s

zConnection._notify_releasecCs2|��|jdk	r.|jj|j|jdd�d|_dS)NT)r`)rrrTrRrerQ)r?r@r@rA�close�s
zConnection.closecCs6|��|jdk	r2|jj|j|j|jjd�d|_dS)N)r`)rrrTrRrerQr`)r?r@r@rA�release�s

zConnection.releasecCs|jdkp|j��S)N)rT�is_connected)r?r@r@rA�closed�szConnection.closed)rHrIrJr[�
_transportr&�asyncio�AbstractEventLooprB�strr]rDrrG�propertyrPr�	TransportrkrOr
rnrrrsrt�boolrvr@r@r@rArLbs*
	rLc@seZdZdZdd�dd�ZdS)�_TransportPlaceholderz.placeholder for BaseConnector.connect functionN)r>cCsdS)Nr@)r?r@r@rArs�sz_TransportPlaceholder.close)rHrIrJ�__doc__rsr@r@r@rAr~�sr~c	@s�eZdZdZdZdZdZedddddd�ee	de
feeeee
ejdd	�d
d�Zefedd�d
d�Zdd�dd�Zedd�dd�Zdd�dd�ZdDe
eee
ee
edd�dd�Zeed�dd��Zeed�dd��Zeed�dd��Zdd�d d!�Zd"e dd#�d$d%�Z!dd�d&d'�Z"e#dd�d(d)�Z$dd�d*d+�Z%eed�d,d-��Z&d"ed.�d/d0�Z'd1e(d2d3e)d4�d5d6�Z*d"e
e d.�d7d8�Z+dd�d9d:�Z,d"e dd;�d<d=�Z-dd>�d"e edd?�d@dA�Z.d1e(d2d3e d4�dBdC�Z/dS)Er3a�Base connector class.

    keepalive_timeout - (optional) Keep-alive timeout.
    force_close - Set to True to force close and do reconnect
        after each request (and between redirects).
    limit - The total number of simultaneous connections.
    limit_per_host - Number of simultaneous connections to one host.
    enable_cleanup_closed - Enables clean-up closed ssl transports.
                            Disabled by default.
    loop - Optional event loop.
    TNg@F�dr)�keepalive_timeout�force_close�limit�limit_per_host�enable_cleanup_closedrP)r�r�r�r�r�rPr>cCs�|r|dk	r*|tk	r*td��n|tkr*d}t|�}d|_|��rRt�t�d��|_	i|_
||_||_t
�|_tt
�|_tt|�|_||_tt�|_||_tjt|d�|_t�|_d|_d|_||_ g|_!|�"�dS)Nz6keepalive_timeout cannot be set if force_close is Trueg.@Fr)rP)#r/�
ValueErrorr,�_closedrVrWrXrYrZr[�_conns�_limit�_limit_per_host�set�	_acquiredr�_acquired_per_hostr�float�_keepalive_timeout�_force_closer�_waitersrS�	functools�partialr&�_factoryrZcookies�_cleanup_handle�_cleanup_closed_handle�_cleanup_closed_disabled�_cleanup_closed_transports�_cleanup_closed)r?r�r�r�r�r�rPr@r@rArB�s6
zBaseConnector.__init__)r^r>cCs�|jr
dS|jsdSdd�|j��D�}|��tr>d|i}ni}|jd|��tf|�||dd�}|jdk	rx|j|d<|j�	|�dS)NcSsg|]}t|��qSr@)�repr)�.0�cr@r@rA�
<listcomp>sz)BaseConnector.__del__.<locals>.<listcomp>r_zUnclosed connector zUnclosed connector)rM�connectionsrarb)
r�r��values�_closer*rErcr[rSrf)r?r^�connsrgrhr@r@rArG
s 


zBaseConnector.__del__)r>cCst�dt�|S)NzH"witn Connector():" is deprecated, use "async with Connector():" instead)rDrErF)r?r@r@rA�	__enter__%szBaseConnector.__enter__)�excr>cGs|��dS)N)rs)r?r�r@r@rA�__exit__-szBaseConnector.__exit__c�s|S)Nr@)r?r@r@rA�
__aenter__0szBaseConnector.__aenter__)�exc_type�	exc_value�
exc_tracebackr>c�s|��IdHdS)N)rs)r?r�r�r�r@r@rA�	__aexit__3szBaseConnector.__aexit__cCs|jS)z1Ultimately close connection on releasing if True.)r�)r?r@r@rAr�;szBaseConnector.force_closecCs|jS)z�The total number for simultaneous connections.

        If limit is 0 the connector has no limit.
        The default limit size is 100.
        )r�)r?r@r@rAr�@szBaseConnector.limitcCs|jS)z�The limit for simultaneous connections to the same endpoint.

        Endpoints are the same if they are have equal
        (host, port, is_ssl) triple.
        )r�)r?r@r@rAr�IszBaseConnector.limit_per_hostcCs
|jr|j��d|_|j��}|j}|jr�i}||}x�|j��D]�\}}g}x�|D]z\}}	|��r�|	|dkr�|j}
|�	�|j
r�|js�|j�
|
�q�|�
||	f�qV|j}
|�	�|j
rV|jsV|j�
|
�qVW|rD|||<qDW||_|j�rt�|d||j�|_dS)zCleanup unused transports.Nr�_cleanup)r��cancelrS�timer�r��itemsrurkrs�is_sslr�r�rmr�weakref_handle)r?�now�timeoutr�ZdeadlinerNr��alive�protoZuse_timerkr@r@rAr�Rs8

zBaseConnector._cleanupr8)rN�valr>cCs4|j}||krdS||}|�|�|s0|j|=dS)N)r��remove)r?rNr�Zacquired_per_hostr�r@r@rA�_drop_acquired_per_host{s
z%BaseConnector._drop_acquired_per_hostcCsV|jr|j��x|jD]}|dk	r|��qWg|_|jsRt�|d|j|j�|_dS)z~Double confirmation for transport close.

        Some broken ssl servers may leave socket open without proper close.
        Nr�)	r�r�r��abortr�rr��_cleanup_closed_periodrS)r?rkr@r@rAr��s
zBaseConnector._cleanup_closedcCs|��tt��S)zClose all opened transports.)r�r:r.)r?r@r@rArs�szBaseConnector.closecCs�|jr
dSd|_z�|j��r dS|jr0|j��|jr@|j��x,|j��D]}x|D]\}}|��qVWqLWx|j	D]}|��qvWx|j
D]}|dk	r�|��q�WWd|j��|j	��|j
��d|_|j
��d|_XdS)NT)r�rSrdr�r�r�r�r�rsr�r�r��clearr�)r?�datar��t0rkr@r@rAr��s0






zBaseConnector._closecCs|jS)z;Is connector closed.

        A readonly property.
        )r�)r?r@r@rArv�szBaseConnector.closed)rNr>cCs�|jrV|jt|j�}|jr�|dkr�||jkr�|j�|�}|dk	sFt�|jt|�}n<|jr�||jkr�|j�|�}|dk	s~t�|jt|�}nd}|S)z�
        Return number of available connections.

        The limit, limit_per_host and the connection key are taken into account.

        If it returns less than 1 means that there are no connections
        available.
        rNr)r��lenr�r�r��get�AssertionError)r?rN�	availableZacquiredr@r@rA�_available_connections�s	
z$BaseConnector._available_connectionsr'r9r7)�req�tracesr�r>c�s�|j}|�|�}|dks$||jk�r|j��}|j|�|�|r^x|D]}|��IdHqHWzny|IdHWnZtk
r�}z<||jkr�y|j|�|�Wnt	k
r�YnX|�Wdd}~XYnXWd||jkr�|j|s�|j|=X|�rx|D]}|�
�IdHq�W|�|�}	|	dk�r&tt
t��}
|j�|
�|j|�|
�|�rnx|D]}|��IdH�qVWy0|�|||�IdH}	|j�r�|	��td��Wn@tk
�r�|j�s�|j�|
�|�||
�|���Yn"X|j�s|j�|
�|�||
�|�r�x�|D]}|��IdH�qWnd|�r�tt
t��}
|j�|
�|j|�|
�x|D]}|��IdH�qZW|j�|
�|�||
�|j�|	�|j|�|	�t|||	|j�S)z'Get from pool or create new connection.rNzConnector is closed.)�connection_keyr�r�rSZ
create_futurermZsend_connection_queued_start�
BaseExceptionr�r�Zsend_connection_queued_end�_getrr&r~r��addr�Zsend_connection_create_start�_create_connectionr�rsrr��_release_waiterZsend_connection_create_endZsend_connection_reuseconnrL)r?r�r�r�rNr��fut�trace�er��placeholderr@r@rA�connect�st










zBaseConnector.connectcCs�y|j|}Wntk
r"dSX|j��}x�|r�|��\}}|��r�|||jkr~|j}|��|j	r�|j
s�|j�|�q�|s�|j|=|Sq0|j}|��|j	r0|j
s0|j�|�q0W|j|=dS)N)
r��KeyErrorrSr��poprur�rkrsr�r�r�rm)r?rNr��t1r�r�rkr@r@rAr�?s,
zBaseConnector._getcCsv|js
dSt|j���}t�|�xN|D]F}|�|�dkr<q(|j|}x&|rl|��}|��sH|�d�dSqHWq(WdS)z�
        Iterates over all waiters until one to be released is found.

        The one to be released is not finsihed and
        belongs to a host that has available connections.
        Nr)	r��list�keys�random�shuffler��popleft�done�
set_result)r?ZqueuesrN�waiters�waiterr@r@rAr�^s



zBaseConnector._release_waiter)rNr�r>cCsH|jr
dSy|j�|�|�||�Wntk
r:Yn
X|��dS)N)r�r�r�r�r�r�)r?rNr�r@r@rA�_release_acquiredxszBaseConnector._release_acquired)r`)rNrOr`r>cCs�|jr
dS|�||�|jr d}|s*|jrR|j}|��|jr�|js�|j�	|�nV|j
�|�}|dkrtg}|j
|<|�	||j�
�f�|jdkr�t�|d|j|j�|_dS)NTr�)r�r�r�r`rkrsr�r�r�rmr�r�rSr�r�rr�r�)r?rNrOr`rkr�r@r@rAre�s"

zBaseConnector._releasec�s
t��dS)N)�NotImplementedError)r?r�r�r�r@r@rAr��sz BaseConnector._create_connection)NNN)0rHrIrJrr�r[r�r/r�objectr�r}�intrrxryrBrDrrGr�r�r�rr�r	r�r{r�r�r�r�r&r�r�rrsr�rvr�rrLr�r�r�r�rer�r@r@r@rAr3�sV".*	%"
Q
r3c@s�eZdZdeedd�dd�Zeed�dd�Ze	e
efee
e
efdd�d	d
�Ze	e
efdd�dd
�Zdd�dd�Ze	e
efee
e
efd�dd�Ze	e
efed�dd�ZdS)�_DNSCacheTableN)�ttlr>cCsi|_i|_||_dS)N)�	_addrs_rr�_timestamps�_ttl)r?r�r@r@rArB�sz_DNSCacheTable.__init__)�hostr>cCs
||jkS)N)r�)r?r�r@r@rA�__contains__�sz_DNSCacheTable.__contains__)rN�addrsr>cCs,t|�t|�f|j|<|jr(t�|j|<dS)N)rr�r�r�rr�)r?rNr�r@r@rAr��sz_DNSCacheTable.add)rNr>cCs&|j�|d�|jr"|j�|d�dS)N)r�r�r�r�)r?rNr@r@rAr��sz_DNSCacheTable.remove)r>cCs|j��|j��dS)N)r�r�r�)r?r@r@rAr��s
z_DNSCacheTable.clearcCs(|j|\}}tt||��}t|�|S)N)r�r�r�next)r?rNrP�lengthr�r@r@rA�
next_addrs�sz_DNSCacheTable.next_addrscCs$|jdkrdS|j||jt�kS)NF)r�r�r)r?rNr@r@rA�expired�s
z_DNSCacheTable.expired)N)rHrIrJrr�rBr�r}r�rrzr�rrrr�r�r�r�r�r@r@r@rAr��s&$r�cs`eZdZdZdddddddddedddddd�eeeeeeeee	e
deee	feee
efeee
deefeeeeeejd��fd	d
�Zedd��fdd
�Zeed�dd��Zeed�dd��Zd<ee
eedd�dd�Zd=e
eeedeee
efd�dd�Zdedded�dd�Ze e!�"d�ee	d�dd ���Z#dee	d!�d"d#�Z$ded$d!�d%d&�Z%e&d'�edde'e(eeej)efd(�d)d*�Z*ddd!�d+d,�Z+dd�d-d.�Z,ed�d/d0�Z-ej)ddd1�d2d3�Z.e&fej)dde'e(eej/efd4�d5d6�Z0e&d'�dedde'e(eej)efd7�d8d9�Z1deddeej/efd�d:d;�Z2�Z3S)>r4a/TCP connector.

    verify_ssl - Set to True to check ssl certifications.
    fingerprint - Pass the binary sha256
        digest of the expected certificate in DER format to verify
        that the certificate the server presents matches. See also
        https://en.wikipedia.org/wiki/Transport_Layer_Security#Certificate_pinning
    resolver - Enable DNS lookups and use this
        resolver
    use_dns_cache - Use memory cache for DNS lookups.
    ttl_dns_cache - Max seconds having cached a DNS entry, None forever.
    family - socket address family
    local_addr - local tuple of (host, port) to bind socket to

    keepalive_timeout - (optional) Keep-alive timeout.
    force_close - Set to True to force close and do reconnect
        after each request (and between redirects).
    limit - The total number of simultaneous connections.
    limit_per_host - Number of simultaneous connections to one host.
    enable_cleanup_closed - Enables clean-up closed ssl transports.
                            Disabled by default.
    loop - Optional event loop.
    TN�
rFr�)�
verify_ssl�fingerprint�
use_dns_cache�
ttl_dns_cache�family�ssl_context�ssl�
local_addr�resolverr�r�r�r�r�rPcsjt�j|
|||
||d�t||||�|_|	dkr<t|jd�}	|	|_||_t|d�|_	i|_
||_||_dS)N)r�r�r�r�r�rP)rP)r�)
�superrBr)�_sslr2rS�	_resolver�_use_dns_cacher��
_cached_hosts�_throttle_dns_events�_family�_local_addr)r?r�r�r�r�r�r�r�r�r�r�r�r�r�r�rP)�	__class__r@rArB�s zTCPConnector.__init__)r>cs&x|j��D]}|��qWt���S)zClose all ongoing DNS calls.)r�r�r�r�rs)r?Zev)r�r@rArsszTCPConnector.closecCs|jS)zSocket family like AF_INET.)r�)r?r@r@rAr� szTCPConnector.familycCs|jS)z%True if local DNS caching is enabled.)r�)r?r@r@rAr�%szTCPConnector.use_dns_cache)r��portr>cCsJ|dk	r"|dk	r"|j�||f�n$|dk	s2|dk	r<td��n
|j��dS)z8Remove specified host/port or clear all dns local cache.Nz5either both host and port or none of them are allowed)r�r�r�r�)r?r�r�r@r@rA�clear_dns_cache*s

zTCPConnector.clear_dns_cacher9)r�r�r�r>c
�s8t|�r||||jddd�gS|js�|rFx|D]}|�|�IdHq.W|jj|||jd�IdH}|r�x|D]}|�|�IdHqjW|S||f}||jkr�|j�|�s�|j�	|�}|r�x|D]}|�
|�IdHq�W|S||jk�r"|j|}|�rx|D]}|�
|�IdHq�W|��IdH�n
t
|j�|j|<|�rXx|D]}|�|�IdH�q>Wz�y�|�r�x|D]}|�|�IdH�qhW|jj|||jd�IdH}	|�r�x|D]}|�|�IdH�q�W|j�||	�|j|��Wn8tk
�r}
z|j|j|
d��Wdd}
~
XYnXWd|j�|�X|j�	|�S)Nr)�hostnamer�r�r�r��flags)r�)r�)r-r�r�Zsend_dns_resolvehost_startr��resolveZsend_dns_resolvehost_endr�r�r�Zsend_dns_cache_hitr��waitr1rSZsend_dns_cache_missr�r�r�r�)r?r�r�r�r��resrN�result�eventr�r�r@r@rA�
_resolve_host5s`








zTCPConnector._resolve_hostr'r7)r�r�r�r>c�s<|jr |�|||�IdH\}}n|�|||�IdH\}}|S)zcCreate connection.

        Has same keyword arguments as BaseEventLoop.create_connection.
        N)�proxy�_create_proxy_connection�_create_direct_connection)r?r�r�r��_r�r@r@rAr��szTCPConnector._create_connection)�verifiedr>c
Cs�|rt��St�tj�}|jtjO_|jtjO_d|_tj|_	y|jtj
O_Wn2tk
r�}zt�
d�|��Wdd}~XYnX|��|SdS)NFz�{!s}: The Python interpreter is compiled against OpenSSL < 1.0.0. Ref: https://docs.python.org/3/library/ssl.html#ssl.OP_NO_COMPRESSION)r�Zcreate_default_context�
SSLContextZPROTOCOL_TLS_CLIENT�optionsZOP_NO_SSLv2ZOP_NO_SSLv3Zcheck_hostnameZ	CERT_NONEZverify_modeZOP_NO_COMPRESSION�AttributeErrorrDrE�formatZset_default_verify_paths)r�
sslcontextZattr_errr@r@rA�_make_ssl_context�szTCPConnector._make_ssl_context)r�r>cCsz|��rrtdkrtd��|j}t|tj�r.|S|dk	r@|�d�S|j}t|tj�rV|S|dk	rh|�d�S|�d�SdSdS)a*Logic to get the correct SSL context

        0. if req.ssl is false, return None

        1. if ssl_context is specified in req, use it
        2. if _ssl_context is specified in self, use it
        3. otherwise:
            1. if verify_ssl is not specified in req, use self.ssl_context
               (will generate a default context according to self.verify_ssl)
            2. if verify_ssl is True in req, generate a default SSL context
            3. if verify_ssl is False in req, generate a SSL context that
               won't verify
        NzSSL is not supported.FT)r�r��RuntimeError�
isinstancerrr�)r?r�rr@r@rA�_get_ssl_context�s


zTCPConnector._get_ssl_contextr(cCs,|j}t|t�r|S|j}t|t�r(|SdS)N)r�rr(r�)r?r��retr@r@rA�_get_fingerprint�s

zTCPConnector._get_fingerprint)�client_error)�argsr�r�rrgr>c
�s�y8t|j�4IdH�|jj||�IdHSQIdHRXWn�tk
rh}zt|j|�|�Wdd}~XYn^tk
r�}zt|j|�|�Wdd}~XYn0t	k
r�}z||j|�|�Wdd}~XYnXdS)N)
r+�sock_connectrS�create_connectionr$rr�r%r�OSError)r?r�r�rrrgr�r@r@rA�_wrap_create_connection�s$z$TCPConnector._wrap_create_connectioncCs8|��sdS|j}|dk	st�|jdkr,dS|��dS)aWRaise a :py:exc:`RuntimeError` on missing ``start_tls()``.

        One case is that :py:meth:`asyncio.loop.start_tls` is not yet
        implemented under Python 3.6. It is necessary for TLS-in-TLS so
        that it is possible to send HTTPS queries through HTTPS proxies.

        This doesn't affect regular HTTP requests, though.
        N�https)r�rr��scheme�_check_loop_for_start_tls)r?r�Z	proxy_urlr@r@rA�_fail_on_no_start_tls�s	
z"TCPConnector._fail_on_no_start_tlsc
Cs>y|jjWn,tk
r8}ztd�|�Wdd}~XYnXdS)Na�An HTTPS request is being sent through an HTTPS proxy. This needs support for TLS in TLS but it is not implemented in your runtime for the stdlib asyncio.

Please upgrade to Python 3.7 or higher. For more details, please see:
* https://bugs.python.org/issue37179
* https://github.com/python/cpython/pull/28073
* https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support
* https://github.com/aio-libs/aiohttp/discussions/6044
)rS�	start_tlsrr)r?Zattr_excr@r@rAr�s
z&TCPConnector._check_loop_for_start_tlscCs*y|��Wntk
r dSXdSdS)NFT)rr)r?r@r@rA�_loop_supports_start_tlss
z%TCPConnector._loop_supports_start_tls)�underlying_transportr�r>cCs<|jjjdkrdSt|dd�}|r&dStjdt|dd�dS)z6Issue a warning if the requested URL has HTTPS scheme.rNZ_start_tls_compatibleFaAn HTTPS request is being sent through an HTTPS proxy. This support for TLS in TLS is known to be disabled in the stdlib asyncio. This is why you'll probably see an error in the log below.

It is possible to enable it via monkeypatching under Python 3.7 or higher. For more details, see:
* https://bugs.python.org/issue37179
* https://github.com/python/cpython/pull/28073

You can temporarily patch this as follows:
* https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support
* https://github.com/aio-libs/aiohttp/discussions/6044
�)r_rj)�request_info�urlr�getattrrDrE�RuntimeWarning)r?r#r�Zasyncio_supports_tls_in_tlsr@r@rA�_warn_about_tls_in_tlssz#TCPConnector._warn_about_tls_in_tls)r#r�r�rr>c
�s�|��}ttj|�|��}ylt|j�4IdH�Jy$|jj||||j	|j
d�IdH}Wntk
rr|���YnXWdQIdHRXWn�t
k
r�}zt|j|�|�Wdd}~XYn�tk
r�}zt|j|�|�Wdd}~XYn�tk
�r}z||j|�|�Wdd}~XYnhtk
�rp}	z>td|j	�d|jd�d|j�d|j�pNd�d	|	�d
��|	�Wdd}	~	XYnX|�|�||fS)z$Wrap the raw TCP transport with TLS.N)�server_hostnameZssl_handshake_timeoutz2Cannot initialize a TLS-in-TLS connection to host �:�dz4 through an underlying connection to an HTTPS proxy z ssl:�defaultz [�])r�rr�rrr+rrSr!r��totalr�rsr$rr�r%rr�	TypeErrorrr�rZconnection_made)
r?r#r�r�rZ	tls_protorZ
tls_transportr�Ztype_errr@r@rA�_start_tls_connection3s64z"TCPConnector._start_tls_connection)r�r�r�rr>c�s�|�|�}|�|�}|jj}|dk	s(t�|j}|dk	s:t�tj|j|||d�|j	d�}	yt�
|	�IdH}
Wn`tjk
r�ddd�dd�}|	�|��Yn0t
k
r�}zt|j|�|�Wdd}~XYnXd}
�x|
D]�}|d}|d}yN|j|j|||||d	|d
|d|�r|dnd|j||d
�IdH\}}Wn*tk
�rd}z
|}
w�Wdd}~XYnX|���r�|�r�y|�|�WnFtk
�r�}z&|��|j�s�|j�|�|}
w�Wdd}~XYnX||fSW|
dk	�s�t�|
�dS)N)r�)rPz$asyncio.Future[List[Dict[str, Any]]])r�r>c	Ss$tttj��|��WdQRXdS)N)rrorx�CancelledErrorr)r�r@r@rA�drop_exception�sz>TCPConnector._create_direct_connection.<locals>.drop_exceptionr�r�r�r�rr�)	r�r�r�r�rr*r�r�r)rrr&Zraw_hostr�r�rxZ
ensure_futurerrSZshieldr2�add_done_callbackrrr�rr�r�r��checkr"rsr�r�rm)r?r�r�r�rrr�r�r�Z
host_resolvedZhostsr3r��last_excZhinfoZtranspr�r@r@rAr	lsb


 
z&TCPConnector._create_direct_connectionc�s�|�|�|��}i}|jdk	r&|j}|jtj|tj<|j}|dk	sJt�ttj	|||j
|j|jd�}|j
|g|td�IdH\}}	|	��|j�tjd�}
|
dk	r�|��s�|
|jtj<n|
|jtj<|���r�|r�|�||�tj|_|j|_tj|jdddd�}t|||	|j�}|�|�IdH}
�zdy4|j}|dk	�s<t�|j|d�|
�|�IdH}Wn*t k
�r�|
�!�|�!��Y�nXd|_d|_"z�yv|j#dk�r�|j$}|dk�r�t%|j#d}t&|
j'|j(|j#||jd��|�s|j)ddd	�}|dk�rt*d
��|�+�}Wn t k
�r*|�!��YnXWd|�s>|�!�X|�sp|�,|�}|j-|j.||||j/|d�IdHS|j0|||d�IdHSWd|
�!�X||	fS)
N)�headers�authrPr�)r)r�
proxy_authZproxy_headers_hash)Zread_until_eof��r)�statusrar7�socket)r-z)Transport does not expose socket instance)r�r��sockr*r�)r�r�)1r r"Z
proxy_headersr7rZHOSTrr�r'ZMETH_GETr9rSr�r	r!r�r�Z
AUTHORIZATIONr�ZPROXY_AUTHORIZATIONr)ZMETH_CONNECT�methodr&�attrZevolver�rL�sendrTZset_response_params�startr�rsrwr;�reasonr0r r%�historyZget_extra_infor�duprrr�r�r1)r?r�r�r�Zruntime_has_start_tlsr7r&Z	proxy_reqrkr�r8rNZconnZ
proxy_resprOZrespraZrawsockrr@r@rAr�s�










z%TCPConnector._create_proxy_connection)NN)N)4rHrIrJrr/r}r�bytesr�rrr(rrzrr�r�rxryrBrrsr{r�r�r�rrrrr&r��staticmethodr��	lru_cacherrrrrror|rr rr"r)Z
BaseTransportr1r	r�
__classcell__r@r@)r�rAr4�s^l
K
!
&9F
r4c	sxeZdZdZdedddfeeeee	dfe
e
eej
dd��fdd�
Zeed	�d
d��Zded
ded�dd�Z�ZS)r5a�Unix socket connector.

    path - Unix socket path.
    keepalive_timeout - (optional) Keep-alive timeout.
    force_close - Set to True to force close and do reconnect
        after each request (and between redirects).
    limit - The total number of simultaneous connections.
    limit_per_host - Number of simultaneous connections to one host.
    loop - Optional event loop.
    Fr�rN)�pathr�r�r�r�rPr>cs t�j|||||d�||_dS)N)r�r�r�r�rP)r�rB�_path)r?rIr�r�r�r�rP)r�r@rArBFs	zUnixConnector.__init__)r>cCs|jS)zPath to unix socket.)rJ)r?r@r@rArIXszUnixConnector.pathr'r9r7)r�r�r�r>c
�s�yDt|j�4IdH�"|j�|j|j�IdH\}}WdQIdHRXWn4tk
rx}zt|j|j	|�|�Wdd}~XYnXt
t|�S)N)r+rrSZcreate_unix_connectionr�rJrr#rIr�rr&)r?r�r�r�r
r�r�r@r@rAr�]s*$z UnixConnector._create_connection)rHrIrJrr/rzr}rr�r�r�rrxryrBr{rIrr&r�rHr@r@)r�rAr5:s
 

r5c	sxeZdZdZdedddfeeeee	dfe
e
eej
dd��fdd�
Zeed	�d
d��Zded
ded�dd�Z�ZS)r6aNamed pipe connector.

    Only supported by the proactor event loop.
    See also: https://docs.python.org/3.7/library/asyncio-eventloop.html

    path - Windows named pipe path.
    keepalive_timeout - (optional) Keep-alive timeout.
    force_close - Set to True to force close and do reconnect
        after each request (and between redirects).
    limit - The total number of simultaneous connections.
    limit_per_host - Number of simultaneous connections to one host.
    loop - Optional event loop.
    Fr�rN)rIr�r�r�r�rPr>cs6t�j|||||d�t|jtj�s,td��||_dS)N)r�r�r�r�rPz9Named Pipes only available in proactor loop under windows)r�rBrrSrxZProactorEventLooprrJ)r?rIr�r�r�r�rP)r�r@rArBzs	zNamedPipeConnector.__init__)r>cCs|jS)zPath to the named pipe.)rJ)r?r@r@rArI�szNamedPipeConnector.pathr'r9r7)r�r�r�r>c
�s�yTt|j�4IdH�2|j�|j|j�IdH\}}t�d�IdHWdQIdHRXWn0tk
r�}zt	|j
|�|�Wdd}~XYnXtt|�S)Nr)
r+rrSZcreate_pipe_connectionr�rJrx�sleeprrr�rr&)r?r�r�r�r
r�r�r@r@rAr��s$ z%NamedPipeConnector._create_connection)rHrIrJrr/rzr}rr�r�r�rrxryrBr{rIrr&r�rHr@r@)r�rAr6ks
 
r6)Xrxr�r�rYrWrD�collectionsrr�
contextlibrZhttp.cookiesr�	itertoolsrrr�r�typesr	�typingr
rrr
rrrrrrrrrrr?�rr�abcrZclient_exceptionsrrrrr r!r"r#r$r%Zclient_protor&Z
client_reqrepr'r(r)r*r+r,r-r.r/�httpr0�locksr1r�r2r�r�ImportErrorr��__all__Zclientr7r8�tracingr9r:rLr~r3r�r4r5r6r@r@r@rA�<module>s`@0 

Zn)g1

Youez - 2016 - github.com/yon3zu
LinuXploit