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: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/urllib3/util/__pycache__/request.cpython-310.pyc
o

�h� �@s�UddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZejr0dd	lm
Z
d
Zegd��ZdZzzddlZWn
eyNddlZYnwWn	eyYYnwed
7ZzddlmZed7ZWney�z
ddlZed7ZWn	ey�YnwYnwGdd�de�ZejZded<ejeefZ hd�Z!						d7d8d d!�Z"d9d&d'�Z#d:d,d-�Z$Gd.d/�d/ej%�Z&d;d5d6�Z'dS)<�)�annotationsN)�	b64encode)�Enum�)�UnrewindableBodyError�)�to_bytes)�Finalz@@@SKIP_HEADER@@@)�accept-encoding�host�
user-agentzgzip,deflatez,br)�zstdz,zstdc@seZdZdZdS)�_TYPE_FAILEDTELLrN)�__name__�
__module__�__qualname__�token�rr�G/usr/local/CyberCP/lib/python3.10/site-packages/urllib3/util/request.pyr/srzFinal[_TYPE_FAILEDTELL]�_FAILEDTELL>�GET�HEAD�TRACE�DELETE�CONNECT�OPTIONS�
keep_alive�bool | None�accept_encoding�bool | list[str] | str | None�
user_agent�
str | None�
basic_auth�proxy_basic_auth�
disable_cache�return�dict[str, str]cCs�i}|rt|t�r
n
t|t�rd�|�}nt}||d<|r!||d<|r'd|d<|r7dt|�d������|d<|rGdt|�d������|d	<|rMd
|d<|S)ad
    Shortcuts for generating request headers.

    :param keep_alive:
        If ``True``, adds 'connection: keep-alive' header.

    :param accept_encoding:
        Can be a boolean, list, or string.
        ``True`` translates to 'gzip,deflate'.  If the dependencies for
        Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or Zstandard
        (the ``zstandard`` package) algorithms are installed, then their encodings are
        included in the string ('br' and 'zstd', respectively).
        List will get joined by comma.
        String will be used as provided.

    :param user_agent:
        String representing the user-agent you want, such as
        "python-urllib3/0.6"

    :param basic_auth:
        Colon-separated username:password string for 'authorization: basic ...'
        auth header.

    :param proxy_basic_auth:
        Colon-separated username:password string for 'proxy-authorization: basic ...'
        auth header.

    :param disable_cache:
        If ``True``, adds 'cache-control: no-cache' header.

    Example:

    .. code-block:: python

        import urllib3

        print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0"))
        # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
        print(urllib3.util.make_headers(accept_encoding=True))
        # {'accept-encoding': 'gzip,deflate'}
    �,r
rz
keep-alive�
connectionzBasic zlatin-1�
authorizationzproxy-authorizationzno-cachez
cache-control)�
isinstance�str�list�join�ACCEPT_ENCODINGr�encode�decode)rrr r"r#r$�headersrrr�make_headers?s*1

��r2�body�
typing.Any�pos�_TYPE_BODY_POSITION | NonecCsR|durt||�|St|dd�dur'z|��}W|Sty&t}Y|Sw|S)z
    If a position is provided, move file to that point.
    Otherwise, we'll attempt to record a position for future use.
    N�tell)�rewind_body�getattrr7�OSErrorr)r3r5rrr�set_file_position�s
	�
��r;�typing.IO[typing.AnyStr]�body_pos�_TYPE_BODY_POSITION�Nonec
Cstt|dd�}|dur(t|t�r(z||�WdSty'}ztd�|�d}~ww|tur0td��tdt|��d���)z�
    Attempt to rewind body to a certain position.
    Primarily used for request redirects and retries.

    :param body:
        File-like object that supports seek.

    :param int pos:
        Position to seek to in file.
    �seekNzAAn error occurred when rewinding request body for redirect/retry.zRUnable to record file position for rewinding request body during a redirect/retry.z1body_pos must be of type integer, instead it was �.)r9r*�intr:rr�
ValueError�type)r3r=�	body_seek�errrr8�s&������r8c@seZdZUded<ded<dS)�ChunksAndContentLengthztyping.Iterable[bytes] | None�chunksz
int | None�content_lengthN)rrr�__annotations__rrrrrG�s
rG�typing.Any | None�methodr+�	blocksizerBcs��durd}|��tvrd}nWd}nTt�ttf�r%t��f}t|d�}nAt�d�r8d
��fdd�}|�}d}n.zt��}Wn!t	y_zt
��}d}Wnt	y\t	d����d�wYnw�f}|j}t||d	�S)aRTakes the HTTP request method, body, and blocksize and
    transforms them into an iterable of chunks to pass to
    socket.sendall() and an optional 'Content-Length' header.

    A 'Content-Length' of 'None' indicates the length of the body
    can't be determined so should use 'Transfer-Encoding: chunked'
    for framing instead.
    Nr�readr%�typing.Iterable[bytes]c3s8�t�tj�}	����}|sdS|r|�d�}|Vq)NTzutf-8)r*�io�
TextIOBaserNr/)r/�	datablock�rMr3rr�chunk_readable�s�

�z&body_to_chunks.<locals>.chunk_readablezO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rHrI)r%rO)
�upper�_METHODS_NOT_EXPECTING_BODYr*r+�bytesr�len�hasattr�
memoryview�	TypeError�iter�nbytesrG)r3rLrMrHrIrT�mvrrSr�body_to_chunks�s@

������r_)NNNNNN)rrrrr r!r"r!r#r!r$rr%r&)r3r4r5r6r%r6)r3r<r=r>r%r?)r3rKrLr+rMrBr%rG)(�
__future__rrP�typing�base64r�enumr�
exceptionsr�utilr�
TYPE_CHECKINGr	�SKIP_HEADER�	frozenset�SKIPPABLE_HEADERSr.�
brotlicffi�_unused_module_brotli�ImportError�brotli�compressionr
�_unused_module_zstd�	zstandardrrrrJ�UnionrBr>rVr2r;r8�
NamedTuplerGr_rrrr�<module>sd������	�
Q