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: //opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/__pycache__/client_proto.cpython-310.pyc
o

;jY1�@s�ddlZddlmZddlmZmZddlmZddlm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZddlmZmZdd	lmZdd
lmZmZmZGdd�deeeeef�ZdS)
�N)�suppress)�Any�Callable�)�BaseProtocol)�ClientConnectionError�
ClientOSError�ClientPayloadError�ServerDisconnectedError�SocketTimeoutError)�
_EXC_SENTINEL�DEFAULT_CHUNK_SIZE�EMPTY_BODY_STATUS_CODES�BaseTimerContext�
set_exception�
set_result)�HttpResponseParser�RawResponseMessage)�HttpProcessingError)�
EMPTY_PAYLOAD�	DataQueue�StreamReadercs�eZdZdZdejddfdd�ZeddejdBfdd��Z	ede
fd	d
��Zede
fdd��ZdGd
d�Z
dGdd�ZdGdd�Zde
fdd�ZdedBddf�fdd�ZdGdd�ZdG�fdd�ZdHde
ddf�fdd�
Zefded eddf�fd!d"�
Z	dId#ed$ed%egdfdBddfd&d'�Zdd(d(dded)d*d*d+d,�
d-edBd.e
d/e
d0e
d1edBd2ed3ed4ed5ed6eddfd7d8�ZdGd9d:�Z dGd;d<�Z!dGd=d>�Z"ededBfd?d@��Z#e#j$d1edBddfdAd@��Z#dGdBdC�Z%dDe&ddfdEdF�Z'�Z(S)J�ResponseHandlerz8Helper class to adapt between Protocol and StreamReader.�loop�returnNcCshtj||dd�t�||�d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_dS)N)r�parserF��)r�__init__r�
_should_close�_payload�
_skip_payload�_payload_parser�_data_received_cbZ_timer�_tail�
_read_timeout�_read_timeout_handle�_timeout_ceil_threshold�_closed�_connection_lost_called)�selfr�r+�H/opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/client_proto.pyrs
zResponseHandler.__init__cCs"|jdur|js|j��|_|jS)a6Future that is set when the connection is closed.

        This property returns a Future that will be completed when the connection
        is closed. The Future is created lazily on first access to avoid creating
        futures that will never be awaited.

        Returns:
            - A Future[None] if the connection is still open or was closed after
              this property was accessed
            - None if connection_lost() was already called before this property
              was ever accessed (indicating no one is waiting for the closure)
        N)r(r)�_loopZ
create_future�r*r+r+r,�closed3szResponseHandler.closedcC�|jS�N)�	_upgradedr.r+r+r,�upgradedE�zResponseHandler.upgradedcCsFt|jp!|jduo|j��p!|jp!|jdup!|jdup!|jp!|j�Sr1)	�boolrr �is_eofr2�
_exceptionr"�_bufferr$r.r+r+r,�should_closeIs������zResponseHandler.should_closecCs
d|_dS�NT)rr.r+r+r,�force_closeUs
zResponseHandler.force_closecC�8d|_|j}|dur|��d|_d|_|��dSdSr1)r7�	transport�closer �
_drop_timeout�r*r=r+r+r,r>X��zResponseHandler.closecCr<r1)r7r=�abortr r?r@r+r+r,rBarAzResponseHandler.abortcCs|jduo
|j��Sr1)r=Z
is_closingr.r+r+r,�is_connectedjszResponseHandler.is_connected�excc	
s�d|_|��|}|}|du}|jdur/|rt|jd�n|dus#J�t|jtd|���|�|jdurMtt��
|j�	�Wd�n1sHwYd}|j
dur�z|j
�	�}Wn.ty�}z"|jdurd|��}|sv|�d|��}t|jt|�|�WYd}~nd}~ww|�
�s�t|t�r�t|j�}|r�t|�}|r�tn|}|dus�J�|dus�J�|�||�d|_d|_
d|_d|_d|_t��|�dS)NTzConnection lost: z#Response payload is not completed: z. F)r)r?r(rrrr"r�	ExceptionZfeed_eof�_parserr r	r6�
isinstance�OSErrorr�argsr
rrZ_reading_paused�super�connection_lost)	r*rDZoriginal_connection_errorZreraised_excZconnection_closed_cleanlyZuncompleted�underlying_excZclient_payload_exc_msgZunderlying_non_eof_exc��	__class__r+r,rKmst
��

�

������

��zResponseHandler.connection_lostcC�|��dSr1)r?r.r+r+r,�eof_received�szResponseHandler.eof_receivedcst���|��dSr1)rJ�
pause_readingr?r.rMr+r,rQ�s
zResponseHandler.pause_readingT�
resume_parsercst��|�|��dSr1)rJ�resume_reading�_reschedule_timeout)r*rRrMr+r,rS�szResponseHandler.resume_reading�	exc_causecs d|_|��t��||�dSr:)rr?rJr)r*rDrUrMr+r,r�szResponseHandler.set_exceptionr�payload�data_received_cbcCs@||_||_||_|��|jr|jd}|_|�|�dSdS)Nr)r r"r#r?r$�
data_received)r*rrVrW�datar+r+r,�
set_parser�s�zResponseHandler.set_parserFri��)
�timer�skip_payload�read_until_eof�auto_decompress�read_timeout�read_bufsize�timeout_ceil_threshold�
max_line_size�max_field_size�max_headersr\r]r^r_r`rarbrcrdrec

Cs\||_||_||_t||j||t|||||	|
d�|_|jr,|jd}|_|�|�dSdS)N)r\Zpayload_exceptionZresponse_with_bodyr^r_rcrdrer)	r!r%r'rr-r	rFr$rX)r*r\r]r^r_r`rarbrcrdrerYr+r+r,�set_response_params�s(��z#ResponseHandler.set_response_paramscCs"|jdur|j��d|_dSdSr1)r&�cancelr.r+r+r,r?s


�zResponseHandler._drop_timeoutcCs>|j}|jdur
|j��|r|j�||j�|_dSd|_dSr1)r%r&rgr-Z
call_later�_on_read_timeout)r*�timeoutr+r+r,rT
s


�
z#ResponseHandler._reschedule_timeoutcCrOr1)rTr.r+r+r,�
start_timeoutszResponseHandler.start_timeoutcCr0r1�r%r.r+r+r,r`r4zResponseHandler.read_timeoutcCs
||_dSr1rk)r*r`r+r+r,r` s
cCs0td�}|�|�|jdurt|j|�dSdS)Nz#Timeout on reading data from socket)rrr )r*rDr+r+r,rh$s


�z ResponseHandler._on_read_timeoutrYc

Cs�|r|��|jdur-|jdur|��|j�|�\}}|r+d|_d|_|r+|�|�dS|js5|jdur>|j|7_dSz|j�|�\}}}Wn<t	y�}z0|j
dur[|j
��t|t
�sa�t|t�rqt|j|j|jd�}nt�}|�||�WYd}~dSd}~ww||_d}|D]&\}	}|	jr�d|_||_|js�|	jtvr�|�|	tfd�q�|�|	|fd�q�|dur�|tur�|�|j�n|��|r�|r�|�|�dSdSdS)N)�code�message�headersTr)rTr"r#Z	feed_datar rXr2rFr$�
BaseExceptionr=r>rGrErrlrmrnrr9rr!rrZon_eofr?)
r*rY�eof�tail�messagesr3rLrDrVrmr+r+r,rX*sb






����zResponseHandler.data_received)rN)Tr1))�__name__�
__module__�__qualname__�__doc__�asyncioZAbstractEventLoopr�propertyZFuturer/r5r3r9r;r>rBrCrorKrPrQrSrrrrrZr
r�float�intrfr?rTrjr`�setterrh�bytesrX�
__classcell__r+r+rMr,rs�


		
K����
����
��������	�
���
�
&


r) rw�
contextlibr�typingrrZ
base_protocolrZclient_exceptionsrrr	r
rZhelpersrr
rrrr�httprrZhttp_exceptionsrZstreamsrrr�tuplerr+r+r+r,�<module>s "