AlkantarClanX12

Your IP : 18.191.87.157


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/__pycache__/response.cpython-311.pyc

�

�܋f���	�~�ddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZ		ddlZn#e$rddlZYnwxYwn
#e$rdZYnwxYw	ddlZeeeejdej��� ������xZ!Z!e!dkrdZn#e"ee#f$rdZYnwxYwd	d
l$m%Z%d	dl&m'Z'd	dl(m)Z)d	d
l*m+Z+m,Z,m-Z-d	dl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8d	dl9m:Z:m;Z;d	dl<m=Z=e	j>rddl?m@Z@d	dlAmBZBejCeD��ZEGd�d��ZFGd�deF��ZGGd�d��ZHGd�deF��ZIe�Gd�deF��ZJe�Gd�deF��ZKGd�d eF��ZLd+d$�ZMGd%�d&��ZNGd'�d(ejO��ZPGd)�d*eP��ZdS),�)�annotationsN)�contextmanager)�HTTPMessage)�HTTPResponse)�timeoutz^([0-9]+)\.([0-9]+))r��)�util)�
_TYPE_BODY)�HTTPHeaderDict)�BaseSSLError�HTTPConnection�
HTTPException)
�BodyNotHttplibCompatible�DecodeError�	HTTPError�IncompleteRead�InvalidChunkLength�
InvalidHeader�
ProtocolError�ReadTimeoutError�ResponseNotChunked�SSLError)�is_fp_closed�is_response_to_head)�Retry)�Literal)�HTTPConnectionPoolc��eZdZdd�Zdd�ZdS)	�ContentDecoder�data�bytes�returnc��t����N��NotImplementedError��selfr!s  �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/urllib3/response.py�
decompresszContentDecoder.decompressE���!�#�#�#�c��t���r%r&�r)s r*�flushzContentDecoder.flushHr,r-N�r!r"r#r"�r#r")�__name__�
__module__�__qualname__r+r0�r-r*r r Ds<������$�$�$�$�$�$�$�$�$�$r-r c�&�eZdZd	d�Zd
d�Zdd�ZdS)�DeflateDecoderr#�Nonec�R�d|_d|_tj��|_dS)NTr-)�
_first_try�_data�zlib�
decompressobj�_objr/s r*�__init__zDeflateDecoder.__init__Ms$�������
��&�(�(��	�	�	r-r!r"c��|s|S|js|j�|��S|xj|z
c_	|j�|��}|rd|_d|_|S#tj$r\d|_t	jtj��|_	|�|j��d|_cYS#d|_wxYwwxYw)NF)r;r?r+r<r=�errorr>�	MAX_WBITS)r)r!�decompresseds   r*r+zDeflateDecoder.decompressRs����	��K���	.��9�'�'��-�-�-��
�
�d��
�
�	"��9�/�/��5�5�L��
"�"'���!��
�����z�	"�	"�	"�#�D�O��*�D�N�?�;�;�D�I�
"����t�z�2�2�!��
�
�
�
��T��
�!�!�!�!�
	"���s#�+A#�#:C�C�7C�	C
�
Cc�4�|j���Sr%�r?r0r/s r*r0zDeflateDecoder.flushh����y��� � � r-N�r#r9r1r2�r3r4r5r@r+r0r6r-r*r8r8LsP������)�)�)�)�
"�"�"�"�,!�!�!�!�!�!r-r8c��eZdZdZdZdZdS)�GzipDecoderStaterr	�N)r3r4r5�FIRST_MEMBER�
OTHER_MEMBERS�SWALLOW_DATAr6r-r*rKrKls�������L��M��L�L�Lr-rKc�&�eZdZd	d�Zd
d�Zdd�ZdS)�GzipDecoderr#r9c�t�tjdtjz��|_tj|_dS)N�)r=r>rCr?rKrM�_stater/s r*r@zGzipDecoder.__init__ss)���&�r�D�N�':�;�;��	�&�3����r-r!r"c���t��}|jtjks|st	|��S		||j�|��z
}nM#tj$r;|j}tj|_|tj	krt	|��cYS�wxYw|jj
}|st	|��Stj	|_tjdtjz��|_��)NTrS)
�	bytearrayrTrKrOr"r?r+r=rBrN�unused_datar>rC)r)r!�ret�previous_states    r*r+zGzipDecoder.decompressws����k�k���;�*�7�7�7�t�7���:�:��	@�	
��t�y�+�+�D�1�1�1�����:�
�
�
�!%���.�;���!�%5�%C�C�C� ��:�:�%�%�%��
�����9�(�D��
"��S�z�z�!�*�8�D�K��*�2���+>�?�?�D�I�	@s�A�AB�Bc�4�|j���Sr%rFr/s r*r0zGzipDecoder.flush�rGr-NrHr1r2rIr6r-r*rQrQrsT������4�4�4�4�@�@�@�@�*!�!�!�!�!�!r-rQc��eZdZdd�Zdd�ZdS)	�
BrotliDecoderr#r9c���tj��|_t|jd��rt	|d|jj��dSt	|d|jj��dS)Nr+)�brotli�Decompressorr?�hasattr�setattrr+�processr/s r*r@zBrotliDecoder.__init__�s`���+�-�-�D�I��t�y�,�/�/�
?���l�D�I�,@�A�A�A�A�A���l�D�I�,=�>�>�>�>�>r-r"c�b�t|jd��r|j���SdS)Nr0r-)r`r?r0r/s r*r0zBrotliDecoder.flush�s-���t�y�'�*�*�
)��y���(�(�(��3r-NrHr2)r3r4r5r@r0r6r-r*r\r\�s<������	?�	?�	?�	?�	�	�	�	�	�	r-r\c�&�eZdZd	d�Zd
d�Zdd�ZdS)�ZstdDecoderr#r9c�Z�tj�����|_dSr%)�zstd�ZstdDecompressorr>r?r/s r*r@zZstdDecoder.__init__�s"���-�/�/�=�=�?�?�D�I�I�Ir-r!r"c��|sdS|j�|��g}|jjr�|jjr{|jj}t	j�����|_|�|j�|����|jjr|jj�{d�|��S)Nr-)	r?r+�eofrWrgrhr>�append�join)r)r!�
data_partsrWs    r*r+zZstdDecoder.decompress�s����
��s��)�.�.�t�4�4�5�J��)�-�
E�D�I�$9�
E�"�i�3�� �1�3�3�A�A�C�C��	��!�!�$�)�"6�"6�{�"C�"C�D�D�D��)�-�
E�D�I�$9�
E��8�8�J�'�'�'r-c�n�|j���}|jjstd���|S)NzZstandard data is incomplete)r?r0rjr)r)rXs  r*r0zZstdDecoder.flush�s4���)�/�/�#�#�C��9�=�
B�!�"@�A�A�A��Jr-NrHr1r2rIr6r-r*rere�sT������	@�	@�	@�	@�	(�	(�	(�	(�	�	�	�	�	�	r-rec�*�eZdZdZdd�Zd
d�Zdd
�ZdS)�MultiDecodera
    From RFC7231:
        If one or more encodings have been applied to a representation, the
        sender that applied the encodings MUST generate a Content-Encoding
        header field that lists the content codings in the order in which
        they were applied.
    �modes�strr#r9c�N�d�|�d��D��|_dS)Nc�P�g|]#}t|�������$Sr6)�_get_decoder�strip)�.0�ms  r*�
<listcomp>z)MultiDecoder.__init__.<locals>.<listcomp>�s(��L�L�L�a�,�q�w�w�y�y�1�1�L�L�Lr-�,)�split�	_decoders)r)rqs  r*r@zMultiDecoder.__init__�s'��L�L�5�;�;�s�;K�;K�L�L�L����r-r"c�@�|jd���S�Nr)r|r0r/s r*r0zMultiDecoder.flush�s���~�a� �&�&�(�(�(r-r!c�^�t|j��D]}|�|��}�|Sr%)�reversedr|r+)r)r!�ds   r*r+zMultiDecoder.decompress�s3���$�.�)�)�	&�	&�A��<�<��%�%�D�D��r-N)rqrrr#r9r2r1)r3r4r5�__doc__r@r0r+r6r-r*rprp�s^��������M�M�M�M�)�)�)�)������r-rp�moderrr#c���d|vrt|��S|dkrt��St�|dkrt��St�|dkrt��St
��S)Nrz�gzip�brrg)rprQr^r\rgrer8)r�s r*ruru�sh��
�d�{�{��D�!�!�!��v�~�~��}�}��
��d�d�l�l�������D�F�N�N��}�}�����r-c�2�eZdZdZd
d�Zdd�Zdd	�Zdd�ZdS)�BytesQueueBufferaMemory-efficient bytes buffer

    To return decoded data in read() and still follow the BufferedIOBase API, we need a
    buffer to always return the correct amount of bytes.

    This buffer should be filled using calls to put()

    Our maximum memory usage is determined by the sum of the size of:

     * self.buffer, which contains the full data
     * the largest chunk that we will copy in get()

    The worst case scenario is a single chunk, in which case we'll make a full copy of
    the data inside get().
    r#r9c�D�tj��|_d|_dSr~)�collections�deque�buffer�_sizer/s r*r@zBytesQueueBuffer.__init__�s��+6�+<�+>�+>�����
�
�
r-�intc��|jSr%)r�r/s r*�__len__zBytesQueueBuffer.__len__�s
���z�r-r!r"c�t�|j�|��|xjt|��z
c_dSr%)r�rkr��lenr(s  r*�putzBytesQueueBuffer.put�s2������4� � � ��
�
�c�$�i�i��
�
�
�
r-�nc�D�|dkrdS|jstd���|dkrtd���d}tj��}||kr�||z
}|j���}t
|��}||krT|d|�||d�}}|�|��|j�|��|xj	|zc_	n8|�|��|xj	|zc_	||z
}|jsn||k��|�
��S)Nrr-zbuffer is emptyzn should be > 0)r��RuntimeError�
ValueError�io�BytesIO�popleftr��write�
appendleftr��getvalue)	r)r��fetchedrX�	remaining�chunk�chunk_length�
left_chunk�right_chunks	         r*�getzBytesQueueBuffer.get�s6����6�6��3���	0��0�1�1�1�
��U�U��.�/�/�/����j�l�l����k�k��G��I��K�'�'�)�)�E��u�:�:�L��<�'�'�*/�
��
�*;�U�9�:�:�=N�K�
��	�	�*�%�%�%���&�&�{�3�3�3��
�
�i�'�
�
���	�	�%� � � ��
�
�l�*�
�
��|�#�G��;�
��!��k�k�$�|�|�~�~�r-NrH�r#r�)r!r"r#r9)r�r�r#r")r3r4r5r�r@r�r�r�r6r-r*r�r��sn�������� �������� � � � ������r-r�c���eZdZUddgZe�edgz
Ze�edgz
Zgd�Zeej	fZ
ded<e�e
ej	fz
Z
e�e
ejfz
Z
ddd	�dCd�Z
dDd�ZedEd���ZdFd�ZedGd���ZejdHd!���ZedId#���ZedJd$���ZejdKd%���Z	dLdMd+�Z			dNdOd.�Z		dPdMd/�ZdQd0�ZdQd1�ZdQd2�ZdQd3�ZdRd6�ZdEd7�ZdSd:�ZdTd<�Z dUdVd@�Z!dTdA�Z"dGdB�Z#dS)W�BaseHTTPResponser��deflateNr�rg)i-i.i/i3i4ztuple[type[Exception], ...]�DECODER_ERROR_CLASSES)�headers�retriesr��>typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None�statusr��version�reason�
str | None�decode_content�bool�request_urlr��Retry | Noner#r9c��t|t��r||_nt|��|_||_||_||_||_d|_||_||_	d|_
|j�dd�����}d�|�
d��D��}	d|	vrd|_
d|_dS)NFztransfer-encoding�c3�>K�|]}|���V��dSr%)rv)rw�encs  r*�	<genexpr>z,BaseHTTPResponse.__init__.<locals>.<genexpr>Cs*����>�>�S�S�Y�Y�[�[�>�>�>�>�>�>r-rz�chunkedT)�
isinstancerr�r�r�r�r��_has_decoded_content�_request_urlr�r�r��lowerr{�_decoder)
r)r�r�r�r�r�r�r��tr_enc�	encodingss
          r*r@zBaseHTTPResponse.__init__)s����g�~�.�.�	3�"�D�L�L�)�'�2�2�D�L����������,���$)��!�(3�����������!�!�"5�r�:�:�@�@�B�B��>�>�F�L�L��,=�,=�>�>�>�	��	�!�!��D�L�/3��
�
�
r-�str | None | Literal[False]c�V�|j|jvr|j�d��SdS)a
        Should we redirect and where to?

        :returns: Truthy redirect location string if we got a redirect status
            code and valid location. ``None`` if redirect status and no
            location. ``False`` if not a redirect status code.
        �locationF)r��REDIRECT_STATUSESr�r�r/s r*�get_redirect_locationz&BaseHTTPResponse.get_redirect_locationIs/���;�$�0�0�0��<�#�#�J�/�/�/��ur-r"c��t���r%r&r/s r*r!zBaseHTTPResponse.dataU���!�#�#�#r-�
typing.Anyc�^�|j�d��}tj|��S)a
        Parses the body of the HTTP response as JSON.

        To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to the decoder.

        This method can raise either `UnicodeDecodeError` or `json.JSONDecodeError`.

        Read more :ref:`here <json>`.
        zutf-8)r!�decode�_json�loadsr(s  r*�jsonzBaseHTTPResponse.jsonYs)���y����(�(���{�4� � � r-c��t���r%r&r/s r*�urlzBaseHTTPResponse.urlfr�r-r�c��t���r%r&�r)r�s  r*r�zBaseHTTPResponse.urljr�r-�HTTPConnection | Nonec��t���r%r&r/s r*�
connectionzBaseHTTPResponse.connectionnr�r-c��|jSr%)�_retriesr/s r*r�zBaseHTTPResponse.retriesrs
���}�r-c�T�|�|jr|jdj|_||_dS)N���)�history�redirect_locationr�r�)r)r�s  r*r�zBaseHTTPResponse.retriesvs-����7�?����r�*�<�D�H���
�
�
r-��amt�
int | None�bool | None�typing.Iterator[bytes]c��t���r%r&�r)r�r�s   r*�streamzBaseHTTPResponse.stream}s��"�#�#�#r-F�
cache_contentc��t���r%r&)r)r�r�r�s    r*�readzBaseHTTPResponse.read�s��"�#�#�#r-c��t���r%r&r�s   r*�read_chunkedzBaseHTTPResponse.read_chunked�s��
"�#�#�#r-c��t���r%r&r/s r*�release_connzBaseHTTPResponse.release_conn�r,r-c��t���r%r&r/s r*�
drain_connzBaseHTTPResponse.drain_conn�r,r-c��t���r%r&r/s r*�closezBaseHTTPResponse.close�r,r-c�0���j�dd�����}�j�\|�jvrt|���_dSd|vr;�fd�|�d��D��}|rt|���_dSdSdSdS)z=
        Set-up the _decoder attribute if necessary.
        �content-encodingr�Nrzc�n��g|]1}|����jv�|�����2Sr6)rv�CONTENT_DECODERS)rw�er)s  �r*ryz2BaseHTTPResponse._init_decoder.<locals>.<listcomp>�sA��������w�w�y�y�D�$9�9�9��G�G�I�I�9�9�9r-)r�r�r�r�r�rur{)r)�content_encodingr�s`  r*�
_init_decoderzBaseHTTPResponse._init_decoder�s���� �<�+�+�,>��C�C�I�I�K�K���=� ��4�#8�8�8� ,�-=� >� >��
�
�
��(�(�(�����-�3�3�C�8�8����	�
�C�$0�1A�$B�$B�D�M�M�M�!� �)�(�C�Cr-r!�
flush_decoderc�f�|s|jrtd���|S	|jr!|j�|��}d|_nS#|j$rF}|j�dd�����}td|z|��|�d}~wwxYw|r||�	��z
}|S)zN
        Decode the data passed in and potentially flush the decoder.
        �_Calling read(decode_content=False) is not supported after read(decode_content=True) was called.Tr�r�zEReceived response with content-encoding: %s, but failed to decode it.N)
r�r�r�r+r�r�r�r�r�_flush_decoder)r)r!r�r�r�r�s      r*�_decodezBaseHTTPResponse._decode�s����	��(�
�"�<�����K�
	��}�
1��}�/�/��5�5��,0��)����)�	�	�	�#�|�/�/�0B�B�G�G�M�M�O�O���'�)9�:�����	
�����	�����	*��D�'�'�)�)�)�D��s�(A�
B�AB�Bc�|�|jr4|j�d��|j���zSdS)zk
        Flushes the decoder. Should only be called if the decoder is actually
        being used.
        r-)r�r+r0r/s r*r�zBaseHTTPResponse._flush_decoder�s=��
�=�	I��=�+�+�C�0�0�4�=�3F�3F�3H�3H�H�H��sr-�brVc��|�t|����}t|��dkrdS||dt|���<t|��Sr~)r�r�)r)r��temps   r*�readintozBaseHTTPResponse.readinto�sL���y�y��Q��� � ���t�9�9��>�>��1�!�A�k��D�	�	�k�N��t�9�9�r-rc�H�tjdtd���|jS)Nz|HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.rL��category�
stacklevel)�warnings�warn�DeprecationWarningr�r/s r*�
getheaderszBaseHTTPResponse.getheaders�s1���
�
O�'��		
�	
�	
�	
��|�r-�namerr�defaultc�p�tjdtd���|j�||��S)Nz�HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).rLr)rrrr�r�)r)rr	s   r*�	getheaderzBaseHTTPResponse.getheader�sA���
�
V�'��		
�	
�	
�	
��|����g�.�.�.r-c��|jSr%)r�r/s r*�infozBaseHTTPResponse.info�s
���|�r-c��|jSr%)r�r/s r*�geturlzBaseHTTPResponse.geturl�s	���x�r-)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#r9)r#r�r2)r#r��r#r�)r�r�r#r9�r#r�)r#r�)r�r�r#r9�r�N)r�r�r�r�r#r��NNF�r�r�r�r�r�r�r#r"�NNrH)r!r"r�r�r�r�r#r")r�rVr#r�)r#rr%)rrrr	r�r#r�)$r3r4r5r�r^rgr��IOErrorr=rBr��__annotations__�	ZstdErrorr@r��propertyr!r�r��setterr�r�r�r�r�r�r�r�r�r�r�r�rrr
rr6r-r*r�r�s���������	�*��
���T�F�"�����V�H�$��1�1�1��:A�4�:�9N��N�N�N�N�
���&�,��0�����$�.�!2�2��
SW�!%�4�4�4�4�4�4�@
�
�
�
��$�$�$��X�$�!�!�!�!��$�$�$��X�$�	�Z�$�$�$��Z�$��$�$�$��X�$������X��
�^� � � ��^� �FJ�$�$�$�$�$��&*�#�	$�$�$�$�$��&*�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�C�C�C�C�&����<������������/�/�/�/�/����������r-r�c���eZdZdZ																dGdH�fd"�
ZdId#�ZdId$�ZedJd&���ZedKd'���Z	dLd(�Z
dMd)�ZdNd+�Ze
dOd-���ZdPdQd/�Z	dPdQd0�Z			dRdSd4�Z	dTdUd7�ZdLd8�ZdId9�ZedLd:���ZdMd;�ZdId<�ZdLd=�ZdId>�ZdQd?�Z	dVdUd@�ZedWdA���ZejdXdD���ZdYdF�Z�xZS)Zra�
    HTTP Response container.

    Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is
    loaded and decoded on-demand when the ``data`` property is accessed.  This
    class is also compatible with the Python standard library's :mod:`io`
    module, and can hence be treated as a readable object in the context of that
    framework.

    Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`:

    :param preload_content:
        If True, the response's body will be preloaded during construction.

    :param decode_content:
        If True, will attempt to decode the body based on the
        'content-encoding' header.

    :param original_response:
        When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse`
        object, it's convenient to include the original for debug purposes. It's
        otherwise unused.

    :param retries:
        The retries contains the last :class:`~urllib3.util.retry.Retry` that
        was used during the request.

    :param enforce_content_length:
        Enforce content length checking. Body returned by server must match
        value of Content-Length header, if present. Otherwise, raise error.
    r�NrT�bodyrr�r�r�r�r�r�r��preload_contentr�r��original_response�_HttplibHTTPResponse | None�pool�HTTPConnectionPool | Noner�r��msg�_HttplibHTTPMessage | Noner�r��enforce_content_length�request_methodr��
auto_closer#r9c	���t���|||||||���|
|_||_d|_d|_||_d|_||_|r#t|ttf��r||_|	|_|
|_
t|d��r||_d|_|�|��|_t%��|_|r$|js|�|���|_dSdSdS)N)r�r�r�r�r�r�r�rr��r�)�superr@r$r&�_body�_fp�_original_response�_fp_bytes_readr"r�rrr"�_pool�_connectionr`�
chunk_left�_init_length�length_remainingr��_decoded_bufferr�)r)rr�r�r�r�rr�rr r�r"r�r$r%r�r&�	__class__s                 �r*r@zHTTPResponse.__init__s4���&	���������)�#��	�	
�	
�	
�'=��#�$�����
�04���"3����������	�J�t�c�5�\�2�2�	��D�J���
�%����4�� � �	��D�H�'+���!%� 1� 1�.� A� A��� 0�1�1����	B�4�:�	B����.��A�A�D�J�J�J�	B�	B�	B�	Br-c�r�|jr|jsdS|j�|j��d|_dSr%)r.r/�	_put_connr/s r*r�zHTTPResponse.release_connUsB���z�	��!1�	��4��
���T�-�.�.�.�����r-c�x�	|���dS#ttttf$rYdSwxYw)z�
        Read and discard any remaining HTTP response data in the response connection.

        Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.
        N)r�r�OSErrorr
rr/s r*r�zHTTPResponse.drain_conn\sC��	��I�I�K�K�K�K�K���7�L�-�@�	�	�	��D�D�	���s��9�9r"c�\�|jr|jS|jr|�d���SdS)NT)r�)r*r+r�r/s r*r!zHTTPResponse.datags9���:�	��:���8�	1��9�9�4�9�0�0�0��tr-c��|jSr%)r/r/s r*r�zHTTPResponse.connectionrs����r-c�*�t|j��Sr%)rr+r/s r*�isclosedzHTTPResponse.isclosedvs���D�H�%�%�%r-c��|jS)z�
        Obtain the number of bytes pulled over the wire so far. May differ from
        the amount of content returned by :meth:``urllib3.response.HTTPResponse.read``
        if bytes are encoded on the wire (e.g, compressed).
        )r-r/s r*�tellzHTTPResponse.tellys
���"�"r-r�c��|j�d��}|��|jrt�d��dS	d�|�d��D��}t
|��dkrtd|z���|���}|dkrd}n#t$rd}YnwxYwd}	t|j��}n#t$rd}YnwxYw|d	vsd
|cxkrdksn|dkrd}|S)
zM
        Set initial length value for Response content if available.
        zcontent-lengthNz�Received response with both Content-Length and Transfer-Encoding set. This is expressly forbidden by RFC 7230 sec 3.3.2. Ignoring Content-Length and attempting to process response as Transfer-Encoding: chunked.c�,�h|]}t|����Sr6)r�)rw�vals  r*�	<setcomp>z,HTTPResponse._init_length.<locals>.<setcomp>�s��I�I�I��3�s�8�8�I�I�Ir-rzr	z8Content-Length contained multiple unmatching values (%s)r)��i0�d���HEAD)r�r�r��log�warningr{r�r�popr�r�r�)r)r%�content_length�lengths�lengthr�s      r*r1zHTTPResponse._init_length�sn��
&*�\�%5�%5�6F�%G�%G���%��|�
���������t�
"�J�I�~�/C�/C�C�/H�/H�I�I�I���w�<�<�!�#�#�'�1�3A�B����!�������A�:�:�!�F���	�
�
�
�����
�����F�	����%�%�F�F���	�	�	��F�F�F�	�����Z���3�&�#6�#6�#6�#6�3�#6�#6�#6�#6�.�F�:R�:R��F��
s%�AB"�"B1�0B1�7C�C�C�"typing.Generator[None, None, None]c#�:K�d}		dV�n�#t$r}t|jdd��|�d}~wt$r=}dt	|��vrt|��|�t|jdd��|�d}~wttf$r}td|��|��|�d}~wwxYwd}|s@|j	r|j	�
��|jr|j�
��|j	r/|j	���r|�
��dSdSdS#|s@|j	r|j	�
��|jr|j�
��|j	r.|j	���r|�
��wwwxYw)z�
        Catch low-level python exceptions, instead re-raising urllib3
        variants, so that low-level exceptions are not leaked in the
        high-level api.

        On exit, release the connection back to the pool.
        FNzRead timed out.zread operation timed outzConnection broken: T)�
SocketTimeoutrr.r
rrrrr8rr,r�r/r<r�)r)�
clean_exitr�s   r*�_error_catcherzHTTPResponse._error_catcher�s!�����
�+	$�
K������� �
S�
S�
S�'�t�z�4�9J�K�K�QR�R������
S�
S�
S�-�S��V�V�;�;�"�1�+�+�1�,�&�t�z�4�9J�K�K�QR�R�����!�7�+�
K�
K�
K�#�$?�!�$?�$?��C�C��J�����
K�����J��
-��*�4��+�1�1�3�3�3�
�#�-��$�*�*�,�,�,��&�
$�4�+B�+K�+K�+M�+M�
$��!�!�#�#�#�#�#�
$�
$�
$�
$���
-��*�4��+�1�1�3�3�3�
�#�-��$�*�*�,�,�,��&�
$�4�+B�+K�+K�+M�+M�
$��!�!�#�#�#�#�
$�
$���s;��D �
B�-�
B�8A2�2B�B�B�D � A:Fr�c��|jsJ�d}|r||ks|jr�|j|kr�tjs�tjst
jdkr�tj��}d}|�|dkrU|�t||��}||z}n|}|j�
|��}|sn|�|��~|�O|dk�U|���S|�|j�
|��n|j�
��S)a_
        Read a response with the thought that reading the number of bytes
        larger than can fit in a 32-bit int at a time via SSL in some
        known cases leads to an overflow error that has to be prevented
        if `amt` or `self.length_remaining` indicate that a problem may
        happen.

        The known cases:
          * 3.8 <= CPython < 3.9.7 because of a bug
            https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900.
          * urllib3 injected with pyOpenSSL-backed SSL-support.
          * CPython < 3.10 only when `amt` does not fit 32-bit int.
        i���)��
iNr)
r+r2r
�IS_SECURETRANSPORT�IS_PYOPENSSL�sys�version_infor�r��minr�r�r�)r)r��	c_int_maxr��
max_chunk_amt�	chunk_amtr!s       r*�_fp_readzHTTPResponse._fp_read�s,���x���x��	��	N��y����)�)�.2�.C�i�.O�.O��+�/P��"�/P�'*�&6��&@�&@��Z�\�\�F�"�M��+������?� #�C�� 7� 7�I��9�$�C�C� -�I��x�}�}�Y�/�/��������T�"�"�"���+������?�?�$�$�$�*-��4�8�=�=��%�%�%�d�h�m�m�o�o�Mr-c��|j�dSt|jdd��}|���5|s|�|��nd}|�T|dkrN|sL|j���|jr,|j�%|jdkrt|j|j���ddd��n#1swxYwY|rA|xjt|��z
c_|j�|xjt|��zc_|S)z7
        Reads `amt` of bytes from the socket.
        N�closedFr-r)
r+�getattrrQr]r�r$r2rr-r�)r)r��	fp_closedr!s    r*�	_raw_readzHTTPResponse._raw_read!sc���8���4��D�H�h��6�6�	�
�
 �
 �
"�
"�	U�	U�-6�?�4�=�=��%�%�%�C�D���3�!�8�8�D�8����� � � ��/�
U��-�9��-��2�2�)��)<�d�>S�T�T�T�-	U�	U�	U�	U�	U�	U�	U�	U�	U�	U�	U����	U�	U�	U�	U�0�	3����3�t�9�9�,����$�0��%�%��T���2�%�%��s�A0B0�0B4�7B4Fr�r�c�4�|���|�|j}|�4d}t|j��|kr|j�|��S|�|��}d}|�d}n
|dkr|sd}|st|j��dkr|S|�!|�|||��}|r||_n�|s|jrtd���|S|�|||��}|j�
|��t|j��|krb|r`|�|��}|�|||��}|j�
|��t|j��|kr|�`|j�|��}|S)aT
        Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
        parameters: ``decode_content`` and ``cache_content``.

        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.

        :param cache_content:
            If True, will save the returned data such that the same result is
            returned despite of the state of the underlying file object. This
            is useful if you want the ``.data`` property to continue working
            after having ``.read()`` the file object. (Overridden if ``amt`` is
            set.)
        NFTrr�)r�r�r�r3r�rbr�r*r�r�r�)r)r�r�r�r!r��decoded_datas       r*r�zHTTPResponse.readKs���4	
�������!�!�0�N��?�!�M��4�'�(�(�C�/�/��+�/�/��4�4�4��~�~�c�"�"���
��;� �M�M�
�A�X�X�d�X� �M��	��D�0�1�1�Q�6�6��K��;��<�<��n�m�D�D�D��
"�!��
��"�
��,��&�@�������<�<��n�m�L�L�L�� �$�$�\�2�2�2��d�*�+�+�c�1�1�d�1��~�~�c�*�*��#�|�|�D�.�-�P�P���$�(�(��6�6�6�
�d�*�+�+�c�1�1�d�1��'�+�+�C�0�0�D��r-r��#typing.Generator[bytes, None, None]c#�lK�|jr3|���r|�||���Ed{V��dSt|j��rt|j��dkrK|�||���}|r|V�t|j���1t|j��dk�IdSdS)a_
        A generator wrapper for the read() method. A call will block until
        ``amt`` bytes have been read from the connection or until the
        connection is closed.

        :param amt:
            How much of the content to read. The generator will return up to
            much data per iteration, but may return less. This is particularly
            likely when using compressed data. However, the empty string will
            never be returned.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        r(Nr)r�r�)r��supports_chunked_readsr�rr+r�r3r�)r)r�r�r!s    r*r�zHTTPResponse.stream�s�����$�<�	�D�7�7�9�9�	��(�(��^�(�L�L�L�L�L�L�L�L�L�L�L�"�4�8�,�,�
��D�4H�0I�0I�A�0M�0M��y�y�S��y�H�H�����J�J�J�	#�4�8�,�,�
��D�4H�0I�0I�A�0M�0M�0M�0M�0M�0Mr-c��dS)NTr6r/s r*�readablezHTTPResponse.readable�s���tr-c���|js |jr|j���|jr|j���|js!t
j�|��dSdSr%)r_r+r�r/r&r��IOBaser/s r*r�zHTTPResponse.close�su���{�	�t�x�	��H�N�N������	%���"�"�$�$�$���	"��I�O�O�D�!�!�!�!�!�	"�	"r-c��|js$tjj�|��S|j�dSt
|jd��r|j���St
|jd��r|jjSdS)NTr<r_)r&r�rkr_�__get__r+r`r<r/s r*r_zHTTPResponse.closed�s}����		��9�#�+�+�D�1�1�1�
�X�
��4�
�T�X�z�
*�
*�	��8�$�$�&�&�&�
�T�X�x�
(�
(�	��8�?�"��4r-c��|j�td���t|jd��r|j���Std���)Nz-HTTPResponse has no file to get a fileno from�filenozOThe file-like object this HTTPResponse is wrapped around has no file descriptor)r+r8r`ror/s r*rozHTTPResponse.fileno�sV���8���I�J�J�J�
�T�X�x�
(�
(�	��8�?�?�$�$�$��0���
r-c��|j�Dt|jd��r1t|jdd��s|j���SdSdSdS)Nr0r_F)r+r`r`r0r/s r*r0zHTTPResponse.flush�s\���H� ����'�*�*�
!��D�H�h��6�6�
!��8�>�>�#�#�#�	
!� � � � � r-c�,�t|jd��S)a
        Checks if the underlying file-like object looks like a
        :class:`http.client.HTTPResponse` object. We do this by testing for
        the fp attribute. If it is present we assume it returns raw chunks as
        processed by read_chunked().
        �fp)r`r+r/s r*rgz#HTTPResponse.supports_chunked_reads�s���t�x��&�&�&r-c��|j�dS|jj���}|�dd��d}	t|d��|_dS#t$r&|���t||��d�wxYw)N�;r	rrS)	r0r+rr�readliner{r�r�r�r)r)�lines  r*�_update_chunk_lengthz!HTTPResponse._update_chunk_length�s����?�&��4��x�{�#�#�%�%���z�z�$��"�"�1�%��	;�!�$��m�m�D�O�O�O���	;�	;�	;��J�J�L�L�L�$�T�4�0�0�d�:�	;���s�A�0Bc�"�d}|�C|j�|j��}|}|j�d��d|_n�|j�7||jkr,|j�|��}|j|z
|_|}n�||jkr>|j�|��}|j�d��d|_|}n@|j�|j��}|j�d��d|_|S)NrL)r+�
_safe_readr0)r)r��returned_chunkr��values     r*�
_handle_chunkzHTTPResponse._handle_chunk�s�����;��H�'�'���8�8�E�"�N��H����"�"�"�"�D�O�O�
�_�
(�S�4�?�-B�-B��H�'�'��,�,�E�"�o��3�D�O�"�N�N�
�D�O�
#�
#��H�'�'��,�,�E��H����"�"�"�"�D�O�"�N�N�!�X�0�0���A�A�N��H����"�"�"�"�D�O��r-c#�DK�|���|jstd���|���st	d���|���5|jr;t|j��r'|j���	ddd��dS|j	j
�	ddd��dS	|���|jdkrn4|�
|��}|�||d���}|r|V��T|r|���}|r|V�|j	�/|j	j
���}|sn|dkrn|j	�/|jr|j���ddd��dS#1swxYwYdS)	a�
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        zHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.zkBody should be http.client.HTTPResponse like. It should have have an fp attribute which returns raw chunks.NTrF)r�r�s
)r�r�rrgrrQr,rr�r+rrrwr0r|r�r�ru)r)r�r�r��decodedrvs      r*r�zHTTPResponse.read_chunkedsy���� 	
�������|�	�$�B���
��*�*�,�,�	�*�P���
�
�
 �
 �
"�
"�)	0�)	0��&�
�+>�t�?V�+W�+W�
��'�-�-�/�/�/��	)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0��x�{�"��)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0�	
"��)�)�+�+�+��?�a�'�'���*�*�3�/�/���,�,��.��'�����"�!�M�M�M�	
"��
"��-�-�/�/���"�!�M�M�M��(�&��x�{�+�+�-�-������7�?�?��
�(�&��&�
0��'�-�-�/�/�/�S)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0�)	0����)	0�)	0�)	0�)	0�)	0�)	0s�$6F�'
F�CF�F�Fc��|jS)z�
        Returns the URL that was the source of this response.
        If the request that generated this response redirected, this method
        will return the final redirect location.
        �r�r/s r*r�zHTTPResponse.urlTs
��� � r-r�rrc��||_dSr%r�r�s  r*r�zHTTPResponse.url]s������r-r�c#�jK�g}|�d���D]|}d|vra|�d��}d�|��|dzdzV�|dd�D]	}|dzV��
|dr
|dg}�dg}�g|�|���}|rd�|��V�dSdS)NTr(�
r-rr	r�)r�r{rlrk)r)r�r��chunks�xs     r*�__iter__zHTTPResponse.__iter__as����� ���[�[��[�5�5�	%�	%�E���~�~����U�+�+���h�h�v�&�&����2�U�:�:�:�:���"���$�$�A��e�)�O�O�O�O��"�:� �$�R�j�\�F�F��F�F��
�
�e�$�$�$�$��	#��(�(�6�"�"�"�"�"�"�"�	#�	#r-)r�NrrNTTNNNNNTNNT)"rrr�r�r�r�r�r�r�r�rr�r�r�rrr r!r�r�r"r#r�r�r$r�r%r�r�r�r&r�r#r9rHr2r)r#r�r�)r%r�r#r�)r#rMr%)r�r�r#r"rrr)r�r�r�r�r#rerr)r�rrr#r9)r#r�) r3r4r5r�r@r�r�rr!r�r<r>r1rrQr]rbr�r�rir�r_ror0rgrwr|r�r�rr��
__classcell__)r4s@r*rr�s����������D�RV���!� $�#�9=�*.�,0�*.� $�'+�%)�"&��#:B�:B�:B�:B�:B�:B�:B�x � � � �	�	�	�	������X��� � � ��X� �&�&�&�&�#�#�#�#�6�6�6�6�p�5$�5$�5$��^�5$�n.N�.N�.N�.N�.N�d�(�(�(�(�(�X�&*�#�	I�I�I�I�I�XFJ������8����"�"�"�"��
�
�
��X�
�	�	�	�	�$�$�$�$�'�'�'�'�;�;�;�;�����.EI�F0�F0�F0�F0�F0�P�!�!�!��X�!�	�Z� � � ��Z� �#�#�#�#�#�#�#�#r-r)r�rrr#r )Q�
__future__rr�r�r�r��logging�rerW�typingrr=�
contextlibr�http.clientr�_HttplibHTTPMessager�_HttplibHTTPResponse�socketrrO�
brotlicffir^�ImportError�	zstandardrg�tuple�mapr��search�__version__�groups�
_zstd_version�AttributeErrorr�r�r
�_base_connectionr�_collectionsrr�r
rr�
exceptionsrrrrrrrrrr�
util.responserr�
util.retryr�
TYPE_CHECKING�typing_extensionsr�connectionpoolr�	getLoggerr3rGr r8rKrQr\rerprur�rkr�r6r-r*�<module>r�s���"�"�"�"�"�"�����	�	�	�	���������	�	�	�	�
�
�
�
�
�
�
�
���������%�%�%�%�%�%�:�:�:�:�:�:�<�<�<�<�<�<�+�+�+�+�+�+���#�#�#�#�#�������
�
�
�
�
�����������
�F�F�F����������%*�E���C����1�4�3C�D�D�K�K�M�M�N�N�%�%��M�M��w���������Z�0�����D�D�D�����������(�(�(�(�(�(�(�(�(�(�(�(�C�C�C�C�C�C�C�C�C�C�������������������������=�<�<�<�<�<�<�<�������	��3�)�)�)�)�)�)�2�2�2�2�2�2��g���!�!��$�$�$�$�$�$�$�$�!�!�!�!�!�^�!�!�!�@��������!�!�!�!�!�.�!�!�!�<
�����������"�������n����*�����>����*
�
�
�
� 8�8�8�8�8�8�8�8�v[�[�[�[�[�r�y�[�[�[�|x	#�x	#�x	#�x	#�x	#�#�x	#�x	#�x	#�x	#�x	#sC�A
�	A�
	A�A�A�A�A$�#A$�(A	B2�2
B?�>B?