ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/connector.cpython-38.pyc

U

'�7`ا�@sNddlZddlZddlZddlZddlZddlZddlmZmZddl	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/m0Z0m1Z1m2Z2d	d
l3m4Z4d	dl5m6Z6m7Z7m8Z8d	dl&m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>d	dl?m@Z@d	dlAmBZBd	dlCmDZDzddlEZEeEjFZFWneGk
�r�dZEeHZFYnXdZIe�r�d	dlJmKZKd	dl5mLZLd	dlMmNZNGdd�d�ZOGdd�d�ZPGdd�d�ZQGdd�d�ZRGdd �d �ZSGd!d"�d"eR�ZTGd#d$�d$eR�ZUGd%d&�d&eR�ZVdS)'�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�cert_errors�
ssl_errors)�ResponseHandler)�
ClientRequest�Fingerprint�_merge_ssl_params)�PY_36�CeilTimeout�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�NFr:)�selfr=�rA�D/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/connector.py�__init__Isz_DeprecationWaiter.__init__�r>cCsd|_|j��S�NT)r<r;�	__await__�r@rArArBrFMsz_DeprecationWaiter.__await__cCs|jst�dt�dS)NzDConnector.close() is a coroutine, please use await connector.close())r<�warnings�warn�DeprecationWarningrGrArArB�__del__Qs
�z_DeprecationWaiter.__del__)	�__name__�
__module__�__qualname__�	__slots__rrrCrFrKrArArArBr9Fsr9c@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)�
ConnectionNr2r7)�	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@rQrRrSrTrArArBrC_szConnection.__init__rDcCsd|j�d�S)NzConnection<�>)rUrGrArArB�__repr__oszConnection.__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)rXr)rI�ResourceWarningrW�	is_closedrV�_releaserUr_�call_exception_handler)r@rc�kwargs�contextrArArBrKrs





zConnection.__del__cCstjdtdd�|jS)Nz%connector.loop property is deprecated�)�
stacklevel)rHrIrJrWrGrArArBrT�s�zConnection.loopcCs|jdkrdS|jjS�N)rX�	transportrGrArArBrr�s
zConnection.transportcCs|jSrq)rXrGrArArBrS�szConnection.protocol)�callbackr>cCs|dk	r|j�|�dSrq)rY�append)r@rsrArArB�add_callback�szConnection.add_callbackc
Cs>|jdd�g}|_|D]}tt��|�W5QRXqdSrq)rYr�	Exception)r@Z	callbacks�cbrArArB�_notify_release�s
zConnection._notify_releasecCs2|��|jdk	r.|jj|j|jdd�d|_dS)NTre)rxrXrVrkrUrGrArArB�close�s
zConnection.closecCs6|��|jdk	r2|jj|j|j|jjd�d|_dS)Nre)rxrXrVrkrUrfrGrArArB�release�s
�zConnection.releasecCs|jdkp|j��Srq)rX�is_connectedrGrArArB�closed�szConnection.closed)rLrMrNr_�
_transportr%�asyncio�AbstractEventLooprC�strrarHrrK�propertyrTr�	TransportrrrSr
rurxryrz�boolr|rArArArBrPZs,�	rPc@seZdZdZdd�dd�ZdS)�_TransportPlaceholderz0 placeholder for BaseConnector.connect function NrDcCsdSrqrArGrArArBry�sz_TransportPlaceholder.close)rLrMrN�__doc__ryrArArArBr��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)Er2a�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_closedrT)r�r�r�r�r�rTr>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�rT)#r.�
ValueErrorr+�_closedrZr[r\r]r^r_�_conns�_limit�_limit_per_host�set�	_acquiredr�_acquired_per_hostr�float�_keepalive_timeout�_force_closer�_waitersrW�	functools�partialr%�_factoryrZcookies�_cleanup_handle�_cleanup_closed_handle�_cleanup_closed_disabled�_cleanup_closed_transports�_cleanup_closed)r@r�r�r�r�r�rTrArArBrC�s<���
zBaseConnector.__init__rbcCs�|jr
dS|jsdSdd�|j��D�}|��tr>d|i}ni}|jd|��tf|�||dd�}|jdk	rx|j|d<|j�	|�dS)NcSsg|]}t|��qSrA)�repr)�.0�crArArB�
<listcomp>sz)BaseConnector.__del__.<locals>.<listcomp>rdzUnclosed connector zUnclosed connector)rQ�connectionsrgrh)
r�r��values�_closer)rIrir_rWrl)r@rc�connsrmrnrArArBrKs"
�

zBaseConnector.__del__rDcCst�dt�|S)NzH"witn Connector():" is deprecated, use "async with Connector():" instead)rHrIrJrGrArArB�	__enter__s
�zBaseConnector.__enter__)�excr>cGs|��dSrq�ry)r@r�rArArB�__exit__%szBaseConnector.__exit__c�s|SrqrArGrArArB�
__aenter__(szBaseConnector.__aenter__)�exc_type�	exc_value�
exc_tracebackr>c�s|��IdHdSrqr�)r@r�r�r�rArArB�	__aexit__+szBaseConnector.__aexit__cCs|jS)z1Ultimately close connection on releasing if True.)r�rGrArArBr�3szBaseConnector.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�rGrArArBr�8szBaseConnector.limitcCs|jS)z�The limit_per_host for simultaneous connections
        to the same endpoint.

        Endpoints are the same if they are have equal
        (host, port, is_ssl) triple.

        )r�rGrArArBr�As	zBaseConnector.limit_per_hostcCs|jr|j��d|_|j��}|j}|jr�i}||}|j��D]�\}}g}|D]z\}}	|��r�|	|dkr�|j}
|�	�|j
r�|js�|j�
|
�q�|�
||	f�qR|j}
|�	�|j
rR|jsR|j�
|
�qR|rB|||<qB||_|jr�t�|d||j�|_dS)zCleanup unused transports.Nr�_cleanup)r��cancelrW�timer�r��itemsr{rrry�is_sslr�r�rtr�weakref_handle)r@Znow�timeoutr�ZdeadlinerRr�Zalive�protoZuse_timerrrArArBr�Ls@


�zBaseConnector._cleanupr7)rR�valr>cCs4|j}||krdS||}|�|�|s0|j|=dSrq)r��remove)r@rRr�Zacquired_per_hostr�rArArB�_drop_acquired_per_hostus
z%BaseConnector._drop_acquired_per_hostcCsR|jr|j��|jD]}|dk	r|��qg|_|jsNt�|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_periodrW)r@rrrArArBr��s


�zBaseConnector._cleanup_closedcCs|��tt��S)zClose all opened transports.)r�r9r-rGrArArBry�szBaseConnector.closecCs�|jr
dSd|_z�|j�	�r$W�~dS|jr4|j�
�|jrD|j�
�|j��D]}|D]\}}|��qVqN|jD]}|��qp|jD]}|dk	r�|�
�q�W5|j��|j��|j��d|_|j��d|_XdSrE)r�r��clearr�r�r�r�r�rWrjr�r�ryr�)r@�datar��t0rrrArArBr��s0









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

        A readonly property.
        )r�rGrArArBr|�szBaseConnector.closed�rRr>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 taking into account
        the limit, limit_per_host and the connection key.

        If it returns less than 1 means that there is no connections
        availables.
        rNr)r��lenr�r�r��get�AssertionError)r@rR�	availableZacquiredrArArB�_available_connections�s"	���z$BaseConnector._available_connectionsr&r8r6��req�tracesr�r>c�sb|j}|�|�}|dks$||jk�r|j��}|j|�|�|rZ|D]}|��IdHqFznz|IdHWnZtk
r�}z<||jkr�z|j|�|�Wnt	k
r�YnX|�W5d}~XYnXW5||jkr�|j|s�|j|=X|�r|D]}|�
�IdHq�|�|�}	|	dk�rtt
t��}
|j�|
�|j|�|
�|�rb|D]}|��IdH�qLz0|�|||�IdH}	|j�r�|	��td��Wn@tk
�r�|j�s�|j�|
�|�||
�|���Yn"X|j�s�|j�|
�|�||
�|�r6|D]}|��IdH�q�n |�r6|D]}|��IdH�q |j�|	�|j|�|	�t|||	|j�S)z'Get from pool or create new connection.rNzConnector is closed.)�connection_keyr�r�rWZ
create_futurertZsend_connection_queued_start�
BaseExceptionr�r�Zsend_connection_queued_end�_getrr%r�r��addr�Zsend_connection_create_start�_create_connectionr�ryrr��_release_waiterZsend_connection_create_endZsend_connection_reuseconnrP)r@r�r�r�rRr��fut�trace�er�ZplaceholderrArArB�connect�sj





zBaseConnector.connectcCs�z|j|}Wntk
r$YdSX|j��}|r�|��\}}|��r�|||jkr~|j}|��|j	r�|j
s�|j�|�q�|s�|j|=|Sq0|j}|��|j	r0|j
s0|j�|�q0|j|=dSrq)
r��KeyErrorrWr��popr{r�rrryr�r�r�rt)r@rRr��t1r�r�rrrArArBr�2s,
zBaseConnector._getcCsp|js
dSt|j���}t�|�|D]D}|�|�dkr:q&|j|}|r&|��}|��sD|�d�dSqDq&dS)z�
        Iterates over all waiters till found one that is not finsihed and
        belongs to a host that has available connections.
        Nr)	r��list�keys�randomZshuffler��popleftZdoneZ
set_result)r@ZqueuesrR�waitersZwaiterrArArBr�Qs


zBaseConnector._release_waiter)rRr�r>cCsH|jr
dSz|j�|�|�||�Wntk
r:Yn
X|��dSrq)r�r�r�r�r�r�)r@rRr�rArArB�_release_acquirediszBaseConnector._release_acquiredre)rRrSrfr>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�rfrrryr�r�r�rtr�r�rWr�r�rr�r�)r@rRrSrfrrr�rArArBrkxs*

�zBaseConnector._releasec�s
t��dSrq)�NotImplementedError)r@r�r�r�rArArBr��sz BaseConnector._create_connection)NNN)0rLrMrNr�r�r_r�r.r�objectr�r��intrr~rrCrHrrKr�r�r�rr�r	r�r�r�r�r�r�r%r�r�rryr�r|r�rrPr�r�r�r�rkr�rArArArBr2�s���7�
�
*�%"�M��"�r2c@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|_||_dSrq)�	_addrs_rr�_timestamps�_ttl)r@r�rArArBrC�s�z_DNSCacheTable.__init__)�hostr>cCs
||jkSrq)r�)r@r�rArArB�__contains__�sz_DNSCacheTable.__contains__)rR�addrsr>cCs,t|�t|�f|j|<|jr(t�|j|<dSrq)rr�r�r�rr�)r@rRr�rArArBr��sz_DNSCacheTable.addr�cCs&|j�|d�|jr"|j�|d�dSrq)r�r�r�r��r@rRrArArBr��sz_DNSCacheTable.removerDcCs|j��|j��dSrq)r�r�r�rGrArArBr��s
z_DNSCacheTable.clearcCs(|j|\}}tt||��}t|�|Srq)r�r�r�next)r@rRrTZlengthr�rArArB�
next_addrs�sz_DNSCacheTable.next_addrscCs$|jdkrdS|j||jt�kSr?)r�r�rr�rArArB�expired�s
z_DNSCacheTable.expired)N)rLrMrNrr�rCr�r�r�rr�r�rrrr�r�r�r�r�rArArArBr��s&$r�cs�eZdZdZdddddddddedddddd�eeeeeeeee	e
deee	feee
efeee
deefeeeeeejd��fd	d
�Zedd��fdd
�Zeed�dd��Zeed�dd��Zd0ee
eedd�dd�Zd1e
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*e&d'�dedde'e(eej)efd+�d,d-�Z+deddeej)efd�d.d/�Z,�Z-S)2r3a/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�rTcsjt�j|
|||
||d�t||||�|_|	dkr<t|jd�}	|	|_||_t|d�|_	i|_
||_||_dS)Nr�r�)r�)
�superrCr(�_sslr1rW�	_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�rT��	__class__rArBrC�s$�	�zTCPConnector.__init__rDcs"|j��D]}|��q
t���S)zClose all ongoing DNS calls.)r�r�r�r�ry)r@ZevrrArBry
s
zTCPConnector.closecCs|jS)zSocket family like AF_INET.)r�rGrArArBr�szTCPConnector.familycCs|jS)z%True if local DNS caching is enabled.)r�rGrArArBr�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�rrArArB�clear_dns_caches

zTCPConnector.clear_dns_cacher8)r�rr�r>c
�st|�r||||jddd�gS|js~|rB|D]}|�|�IdHq,|jj|||jd�IdH}|rz|D]}|�|�IdHqd|S||f}||jkr�|j�|�s�|j�	|�}|r�|D]}|�
|�IdHq�|S||jk�r|j|}|r�|D]}|�
|�IdHq�|��IdHn�t
|j�|j|<|�r@|D]}|�|�IdH�q(z�z~|�rf|D]}|�|�IdH�qN|jj|||jd�IdH}	|�r�|D]}|�|�IdH�q�|j�||	�|j|��Wn8tk
�r�}
z|j|j|
d��W5d}
~
XYnXW5|j�|�X|j�	|�S)Nr)�hostnamer�rr�r��flags)r�)r�)r,r�r�Zsend_dns_resolvehost_startr�ZresolveZsend_dns_resolvehost_endr�r�r�Zsend_dns_cache_hitr��waitr0rWZsend_dns_cache_missr�r�r�r�)r@r�rr�r��resrR�resultZeventr�r�rArArB�
_resolve_host&sd��
zTCPConnector._resolve_hostr&r6r�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�rArArBr�rszTCPConnector._create_connection)�verifiedr>c
Cs�|rt��St�tj�}|jtjO_|jtjO_z|jtjO_Wn2tk
r~}zt	�
d�|��W5d}~XYnX|��|SdS)Nz�{!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_SSLv23ZoptionsZOP_NO_SSLv2ZOP_NO_SSLv3ZOP_NO_COMPRESSION�AttributeErrorrHrI�formatZset_default_verify_paths)r�
sslcontextZattr_errrArArB�_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�
isinstancerrr�)r@r�rrArArB�_get_ssl_context�s


zTCPConnector._get_ssl_contextr'cCs,|j}t|t�r|S|j}t|t�r(|SdSrq)r�rr'r�)r@r�ZretrArArB�_get_fingerprint�s

zTCPConnector._get_fingerprint��client_error)�argsr�r�rrmr>c
�s�z8t|j��$|jj||�IdHW5QR�WSQRXWn�tk
rh}zt|j|�|�W5d}~XYn^tk
r�}zt|j|�|�W5d}~XYn0t	k
r�}z||j|�|�W5d}~XYnXdSrq)
r*�sock_connectrWZcreate_connectionr#rr�r$r�OSError)r@r�r�rrrmr�rArArB�_wrap_create_connection�s,z$TCPConnector._wrap_create_connection)r�r�r�rr>c�s�|�|�}|�|�}|jj}|dk	s(t�|j}|dk	s:t�tj|j|||d�|j	d�}	zt�
|	�IdH}
Wn`tjk
r�ddd�dd�}|	�|��Yn0t
k
r�}zt|j|�|�W5d}~XYnXd}
|
D�]
}|d}|d}zN|j|j|||||d	|d
|d|�r|dnd|j||d
�IdH\}}Wn0tk
�rh}z|}
WY�q�W5d}~XYnX|���r�|�r�z|�|�WnLtk
�r�}z,|��|j�s�|j�|�|}
WY�q�W5d}~XYnX||fS|
dk	�s�t�|
�dS)N)r�r�z$asyncio.Future[List[Dict[str, Any]]])r�r>c	Ss$tttj��|��W5QRXdSrq)rrvr~�CancelledErrorr)r�rArArB�drop_exception�sz>TCPConnector._create_direct_connection.<locals>.drop_exceptionr�rr�r�rr)	r�r�r�r�r�server_hostnamer�r�r)rr�urlZraw_hostr�rr~Z
ensure_futurer	rWZshieldrZadd_done_callbackrrr�rr�r�r�Zcheckr"ryr�r�rt)r@r�r�r�rrr�r�rZ
host_resolvedZhostsrr��last_excZhinfoZtranspr�rArArBr�sh

�
 
�z&TCPConnector._create_direct_connectionc�s*i}|jdk	r|j}|jtj|tj<|j}|dk	s8t�ttj|||j|j	|j
d�}|j|g|td�IdH\}}|�
�|j�tjd�}	|	dk	r�|��s�|	|jtj<n|	|jtj<|���r"|�|�}
tj|_|j|_tj|jdddd�}t||||j	�}|�|�IdH}
�z
z0|j}|dk	�s$t�|��|
�|�IdH}Wn(tk
�rf|
��|���Yn�Xd|_d|_ zp|j!dk�r�|j"}|dk�r�t#|j!d}t$|
j%|j&|j!||jd��|j'ddd�}|dk�r�t(d	��|�)�}W5|��X|j*|j+||
||j,|d
�IdH\}}W5|
��X||fS)N)�headers�authrTr�r)r
�
proxy_authZproxy_headers_hash��r)�statusrgr#Zsocket)�defaultz)Transport does not expose socket instance)r�r�Zsockr r�)-Z
proxy_headersr#rZHOSTr
r�r&ZMETH_GETr%rWr�rr!r�r�Z
AUTHORIZATIONr�ZPROXY_AUTHORIZATIONrZMETH_CONNECT�methodr!�attrZevolver�rP�sendryrXZset_response_params�startr�r}r'�reasonr/r Zrequest_info�historyZget_extra_infor�duprr�r�)r@r�r�r�r#r!Z	proxy_reqrrr�r$rrRZconnZ
proxy_resprSZresprgZrawsockrArArBrs�
�
�


�
�

�	
z%TCPConnector._create_proxy_connection)NN)N).rLrMrNr�r.r�r�bytesr�rrr'rr�rr�r�r~rrCrryr�r�r�rrrrr	r%r��staticmethodr��	lru_cacherrrrrrvr�rrr�
__classcell__rArArrBr3�s���)���
�M�!����M�r3c	sxeZdZdZdedddfeeeee	dfe
e
eej
dd��fdd�
Zeed	�d
d��Zded
ded�dd�Z�ZS)r4a�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�rTr>cs t�j|||||d�||_dS)N�r�r�r�r�rT)r�rC�_path�r@r5r�r�r�r�rTrrArBrC�s	�zUnixConnector.__init__rDcCs|jS)zPath to unix socket.�r7rGrArArBr5�szUnixConnector.pathr&r8r6r�c
�srz6t|j��"|j�|j|j�IdH\}}W5QRXWn0tk
rf}zt|j|�|�W5d}~XYnXt	t
|�Srq)r*rrWZcreate_unix_connectionr�r7rrr�rr%�r@r�r�r�r
r�r�rArArBr��s� z UnixConnector._create_connection�rLrMrNr�r.r�r�rr�r�r�rr~rrCr�r5rr%r�r3rArArrBr4�s,���r4c	sxeZdZdZdedddfeeeee	dfe
e
eej
dd��fdd�
Zeed	�d
d��Zded
ded�dd�Z�ZS)r5aNamed 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�rNr4cs6t�j|||||d�t|jtj�s,td��||_dS)Nr6z9Named Pipes only available in proactor loop under windows)r�rCrrWr~ZProactorEventLooprr7r8rrArBrC�s	��zNamedPipeConnector.__init__rDcCs|jS)zPath to the named pipe.r9rGrArArBr5�szNamedPipeConnector.pathr&r8r6r�c
�s�zFt|j��2|j�|j|j�IdH\}}t�d�IdHW5QRXWn0tk
rv}zt	|j
|�|�W5d}~XYnXtt|�S)Nr)
r*rrWZcreate_pipe_connectionr�r7r~�sleeprrr�rr%r:rArArBr��s� z%NamedPipeConnector._create_connectionr;rArArrBr5�s,���r5)Wr~r�r�r]r[rH�collectionsrr�
contextlibrZhttp.cookiesr�	itertoolsrrr�r�typesr	�typingr
rrr
rrrrrrrrrrr*�rr�abcrZclient_exceptionsrrrrr r!r"r#r$Zclient_protor%Z
client_reqrepr&r'r(r)r*r+r,r-r.Zhttpr/Zlocksr0r�r1r�r�ImportErrorr��__all__Zclientr6r7�tracingr8r9rPr�r2r�r3r4r5rArArArB�<module>s^@, 

Zg)<1

Zerion Mini Shell 1.0