HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/botocore/__pycache__/awsrequest.cpython-310.pyc
o

�hpZ�@s^ddlZddlZddlmZddlZddlmZmZddl	m
Z
mZddlZ
ddlmZmZmZmZmZmZmZddlmZe�e�ZGdd�de�ZGd	d
�d
�ZGdd�dee�ZGd
d�dee�ZGdd�de
�ZGdd�de�Z 	d%dd�Z!dd�Z"dd�Z#Gdd�d�Z$Gdd�d�Z%Gdd�d�Z&Gdd �d �Z'Gd!d"�d"�Z(Gd#d$�d$e�Z)dS)&�N)�Mapping)�HTTPConnection�VerifiedHTTPSConnection)�HTTPConnectionPool�HTTPSConnectionPool)�HTTPHeaders�HTTPResponse�MutableMapping�	urlencode�urlparse�urlsplit�
urlunsplit)�UnseekableStreamErrorc@seZdZdd�Zdd�ZdS)�AWSHTTPResponsecOs(|�d�|_tj|g|�Ri|��dS)N�status_tuple)�pop�
_status_tupler�__init__��self�args�kwargs�r�F/usr/local/CyberCP/lib/python3.10/site-packages/botocore/awsrequest.pyr(szAWSHTTPResponse.__init__cCs$|jdur
|j}d|_|St�|�S�N)rr�_read_status)rrrrrr,s


zAWSHTTPResponse._read_statusN)�__name__�
__module__�__qualname__rrrrrrr%srcsxeZdZdZ�fdd�Z�fdd�Zd�fdd�	Zd	d
�Zddd�Zd
d�Z	dd�Z
dd�Z�fdd�Zdd�Z
�ZS)�
AWSConnectiona�Mixin for HTTPConnection that supports Expect 100-continue.

    This when mixed with a subclass of httplib.HTTPConnection (though
    technically we subclass from urllib3, which subclasses
    httplib.HTTPConnection) and we only override this class to support Expect
    100-continue, which we need for S3.  As far as I can tell, this is
    general purpose enough to not be specific to S3, but I'm being
    tentative and keeping it in botocore because I've only tested
    this against AWS services.

    cs0t�j|i|��|j|_d|_d|_d|_dS�NF)�superr�response_class�_original_response_cls�_response_received�_expect_header_set�_send_calledr��	__class__rrrBs

zAWSConnection.__init__cs(t���d|_d|_d|_|j|_dSr )r!�closer$r%r&r#r"�rr'rrr)Os

zAWSConnection.closeNcsb|duri}d|_|�dd�dkrd|_nd|_|j|_t�j||||g|�Ri|��}d|_|S)NF�Expect�s100-continueT)r$�getr%r#r"r!�request)r�method�url�body�headersrr�rvalr'rrr.Ws zAWSConnection.requestcCsBg}|D]}t|t�r|�|�d��q|�|�qd�|�}|S)N�utf-8�
)�
isinstance�str�append�encode�join)r�mixed_buffer�bytes_buffer�chunk�msgrrr�_convert_to_bytesds

zAWSConnection._convert_to_bytescOs�|j�d�|�|j�}|jdd�=t|t�r||7}d}|�|�|jr>t�d�t	j
�|jd�r9|�
|�dSt�d�|durI|�|�dSdS)N)r,r,z"Waiting for 100 Continue response.�zCNo response seen from server, continuing to send the response body.)�_buffer�extendr?r6�bytes�sendr%�logger�debug�urllib3�util�
wait_for_read�sock�_handle_expect_response)r�message_bodyrrr>rrr�_send_outputqs$



��zAWSConnection._send_outputcCs$d}|dkr|��}|dksdSdS)Nr5)�readline)r�fp�currentrrr�_consume_headers�s�zAWSConnection._consume_headerscCs�|j�dd�}zm|��}|�dd�}|�|�r'|�|�t�d�|�|�n@t	|�dkr`|d�
d�rnt�d�|d�d�t|d	�|d�d�f}t
jt|d
�}||_d|_W|��dSW|��dSW|��dSW|��dS|��w)N�rbr�z5100 Continue response seen, now sending request body.��HTTP/zOReceived a non 100 Continue response from the server, NOT sending request body.�asciir@)rT)rJ�makefilerN�split�_is_100_continue_statusrQrErF�_send_message_body�len�
startswith�decode�int�	functools�partialrr"r$r))rrLrO�maybe_status_line�partsrr"rrrrK�s<

�
�
�����z%AWSConnection._handle_expect_responsecCs|dur|�|�dSdSr)rD)rrLrrrrZ�s�z AWSConnection._send_message_bodycs,|jr|jst�d�d|_dSt��|�S)Nz?send() called, but response already received. Not sending data.T)r$r&rErFr!rD)rr7r'rrrD�s�zAWSConnection.sendcCs2|�dd�}t|�dko|d�d�o|ddkS)NrSrTrrUr@s100)rXr[r\)rrarbrrrrY�s�
�z%AWSConnection._is_100_continue_status�NNr)rrr�__doc__rr)r.r?rMrQrKrZrDrY�
__classcell__rrr'rr5s


&,rc@�eZdZdZdS)�AWSHTTPConnectionz6An HTTPConnection that supports 100 Continue behavior.N�rrrrdrrrrrg��rgc@rf)�AWSHTTPSConnectionz7An HTTPSConnection that supports 100 Continue behavior.Nrhrrrrrj�rirjc@�eZdZeZdS)�AWSHTTPConnectionPoolN)rrrrg�
ConnectionClsrrrrrl�rirlc@rk)�AWSHTTPSConnectionPoolN)rrrrjrmrrrrrn�rirnc
Cs�|}|dur|d}||d<|�d�}t||d|�}|dr<tjj}||d�}	d|vr5|d|	��7}n|d|	��7}||d	<||d
<|durNi|d
<dSdS)a;
    This method prepares a request dict to be created into an
    AWSRequestObject. This prepares the request dict by adding the
    url and the user agent to the request dict.

    :type request_dict: dict
    :param request_dict:  The request dict (created from the
        ``serialize`` module).

    :type user_agent: string
    :param user_agent: The user agent to use for this request.

    :type endpoint_url: string
    :param endpoint_url: The full endpoint url, which contains at least
        the scheme, the hostname, and optionally any path components.
    Nr2z
User-Agent�host_prefix�url_path�query_string�?�&r0�context)r-�_urljoin�botocore�utils�percent_encode_sequence)
�request_dict�endpoint_urlrt�
user_agent�rr2ror0rx�encoded_query_stringrrr�prepare_request_dict�s"
�r~cCs:|}t|d|d|d|d|�d�d�}|d|_|S)aK
    This method takes a request dict and creates an AWSRequest object
    from it.

    :type request_dict: dict
    :param request_dict:  The request dict (created from the
        ``prepare_request_dict`` method).

    :rtype: ``botocore.awsrequest.AWSRequest``
    :return: An AWSRequest object based on the request_dict.

    r/r0r1r2�	auth_path)r/r0�datar2rrt)�
AWSRequestr-rt)ryr|�request_objectrrr�create_request_object$s
�
r�cCs�t|�}|r
|dkr|dsd}n"|d}n|d�d�r-|�d�r-|ddd�|}n|d|}|d}|dur?||}t|d|||d|df�}|S)N�/rS���r@rrT�)r�endswithr\r
)rzrpro�p�new_path�
new_netloc�
reconstructedrrrru=s
ruc@sBeZdZdZdd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dS)�AWSRequestPreparera

    This class performs preparation on AWSRequest objects similar to that of
    the PreparedRequest class does in the requests library. However, the logic
    has been boiled down to meet the specific use cases in botocore. Of note
    there are the following differences:
        This class does not heavily prepare the URL. Requests performed many
        validations and corrections to ensure the URL is properly formatted.
        Botocore either performs these validations elsewhere or otherwise
        consistently provides well formatted URLs.

        This class does not heavily prepare the body. Body preperation is
        simple and supports only the cases that we document: bytes and
        file-like objects to determine the content-length. This will also
        additionally prepare a body that is a dict to be url encoded params
        string as some signers rely on this. Finally, this class does not
        support multipart file uploads.

        This class does not prepare the method, auth or cookies.
    cCs<|j}|�|�}|�|�}|�||�}|j}t|||||�Sr)r/�_prepare_url�
_prepare_body�_prepare_headers�
stream_output�AWSPreparedRequest)r�originalr/r0r1r2r�rrr�preparens

zAWSRequestPreparer.preparecCsb|j}|jr/t|�}|jrdnd}t|jt�rt|j���}n|j}t|dd�}|�	||f�}|S)NrsrrT��doseq)
r0�paramsr�queryr6r�list�itemsr
r:)rr�r0�	url_parts�delim�params_to_encoder�rrrr�wszAWSRequestPreparer._prepare_urlNcCsnt|j���}d|vsd|vr|S|jdvr5|�|�}|dur't|�|d<|St|�}t�d|�d|d<|S)NzTransfer-EncodingzContent-Length)�GET�HEAD�OPTIONSz Failed to determine length of %s�chunked)	�HeadersDictr2r�r/�_determine_content_lengthr7�typerErF)rr��
prepared_bodyr2�length�	body_typerrrr��s

�z#AWSRequestPreparer._prepare_headerscCs8|\}}t|t�r|�d�}t|t�r|�d�}||fS�Nr4)r6r7r9)r�item�key�valuerrr�_to_utf8�s



zAWSRequestPreparer._to_utf8csB|j}|dkr	d}t|t�r�fdd�|��D�}t|dd�}|S)z"Prepares the given HTTP body data.r,Ncsg|]}��|��qSr)r�)�.0r�r*rr�
<listcomp>�sz4AWSRequestPreparer._prepare_body.<locals>.<listcomp>Tr�)r�r6�dictr�r
)rr�r1r�rr*rr��s
z AWSRequestPreparer._prepare_bodycCstj�|�Sr)rvrw�determine_content_length�rr1rrrr���z,AWSRequestPreparer._determine_content_lengthr)
rrrrdr�r�r�r�r�r�rrrrr�Ys	

r�c@s@eZdZdZeZ							d
dd�Zdd�Zedd	��Z	dS)r�a
Represents the elements of an HTTP request.

    This class was originally inspired by requests.models.Request, but has been
    boiled down to meet the specific use cases in botocore. That being said this
    class (even in requests) is effectively a named-tuple.
    NFc
Cst|��|_|durin|}||_||_t�|_||_||_||_||_	|dur5|�
�D]	\}}	|	|j|<q+i|_dSr)�_REQUEST_PREPARER_CLS�_request_preparerr/r0rr2r�r�rr�r�rt)
rr/r0r2r�r�rr�r�r�rrrr�s


	zAWSRequest.__init__cCs|j�|�S)z>Constructs a :class:`AWSPreparedRequest <AWSPreparedRequest>`.)r�r�r*rrrr��szAWSRequest.preparecCs"|��j}t|t�r|�d�}|Sr�)r�r1r6r7r9r�rrrr1�s


zAWSRequest.body)NNNNNNF)
rrrrdr�r�rr��propertyr1rrrrr��s
�$r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r�a�A data class representing a finalized request to be sent over the wire.

    Requests at this stage should be treated as final, and the properties of
    the request should not be modified.

    :ivar method: The HTTP Method
    :ivar url: The full url
    :ivar headers: The HTTP headers to send.
    :ivar body: The HTTP body.
    :ivar stream_output: If the response for this request should be streamed.
    cCs"||_||_||_||_||_dSr)r/r0r2r1r�)rr/r0r2r1r�rrrr�s

zAWSPreparedRequest.__init__cCsd}||j|j|j|jfS)NzD<AWSPreparedRequest stream_output=%s, method=%s, url=%s, headers=%s>)r�r/r0r2)r�fmtrrr�__repr__�s�zAWSPreparedRequest.__repr__c
Csvtttf}|jdust|j|�rdSzt�d|j�|j�d�WdSty:}zt�d|�t	|jd��d}~ww)a+Resets the streaming body to it's initial position.

        If the request contains a streaming body (a streamable file-like object)
        seek to the object's initial position to ensure the entire contents of
        the object is sent. This is a no-op for static bytes-like body types.
        NzRewinding stream: %srzUnable to rewind stream: %s)�
stream_object)
rCr7�	bytearrayr1r6rErF�seek�	Exceptionr)r�non_seekable_types�errr�reset_streams

��zAWSPreparedRequest.reset_streamN)rrrrdrr�r�rrrrr��s
r�c@s0eZdZdZdd�Zedd��Zedd��ZdS)	�AWSResponsea�A data class representing an HTTP response.

    This class was originally inspired by requests.models.Response, but has
    been boiled down to meet the specific use cases in botocore. This has
    effectively been reduced to a named tuple.

    :ivar url: The full url.
    :ivar status_code: The status code of the HTTP response.
    :ivar headers: The HTTP headers received.
    :ivar body: The HTTP response body.
    cCs&||_||_t|�|_||_d|_dSr)r0�status_coder�r2�raw�_content)rr0r�r2r�rrrr+s


zAWSResponse.__init__cCs&|jdurd�|j���pd|_|jS)z!Content of the response as bytes.Nr,)r�r:r��streamr*rrr�content3s
zAWSResponse.contentcCs*tj�|j�}|r|j�|�S|j�d�S)a
Content of the response as a proper text type.

        Uses the encoding type provided in the reponse headers to decode the
        response content into a proper text type. If the encoding is not
        present in the headers, UTF-8 is used as a default.
        r4)rvrw�get_encoding_from_headersr2r�r])r�encodingrrr�text@szAWSResponse.textN)rrrrdrr�r�r�rrrrr�s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
_HeaderKeycCs||_|��|_dSr)�_key�lower�_lower�rr�rrrrPsz_HeaderKey.__init__cC�
t|j�Sr)�hashr�r*rrr�__hash__T�
z_HeaderKey.__hash__cCst|t�o
|j|jkSr)r6r�r�)r�otherrrr�__eq__Wsz_HeaderKey.__eq__cCs|jSr)r�r*rrr�__str__Zsz_HeaderKey.__str__cCr�r)�reprr�r*rrrr�]r�z_HeaderKey.__repr__N)rrrrr�r�r�r�rrrrr�Osr�c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)r�z9A case-insenseitive dictionary to represent HTTP headers.cOsi|_|j|i|��dSr)�_dict�updaterrrrrdszHeadersDict.__init__cCs||jt|�<dSr�r�r�)rr�r�rrr�__setitem__hszHeadersDict.__setitem__cCs|jt|�Srr�r�rrr�__getitem__kszHeadersDict.__getitem__cCs|jt|�=dSrr�r�rrr�__delitem__n�zHeadersDict.__delitem__cCsdd�|jD�S)Ncss�|]}t|�VqdSr)r7)r�r�rrr�	<genexpr>rs�z'HeadersDict.__iter__.<locals>.<genexpr>)r�r*rrr�__iter__qr�zHeadersDict.__iter__cCr�r)r[r�r*rrr�__len__tr�zHeadersDict.__len__cCr�r)r�r�r*rrrr�wr�zHeadersDict.__repr__cCst|���Sr)r�r�r*rrr�copyzr�zHeadersDict.copyN)rrrrdrr�r�r�r�r�r�r�rrrrr�asr�rc)*r_�logging�collections.abcr�urllib3.utilrG�urllib3.connectionrr�urllib3.connectionpoolrr�botocore.utilsrv�botocore.compatrrr	r
rrr
�botocore.exceptionsr�	getLoggerrrErrrgrjrlrnr~r�rur�r�r�r�r�r�rrrr�<module>s6
$	
7
�)X:31