HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/urllib3/util/__pycache__/request.cpython-37.pyc
B

���g��	@s�UddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZejr`dd	l
mZd
Zeddd
g�ZdZy.yddlZWnek
r�ddlZYnXWnek
r�Yn
Xed7ZyddlZWnek
r�Yn
Xed7ZGdd�de�ZejZded<ejeefZddddddhZ d5dddddddd�d d!�Z!d"d#d#d$�d%d&�Z"d'd(d)d*�d+d,�Z#Gd-d.�d.ej$�Z%d/d0d1d.d2�d3d4�Z&dS)6�)�annotationsN)�	b64encode)�Enum�)�UnrewindableBodyError�)�to_bytes)�Finalz@@@SKIP_HEADER@@@zaccept-encoding�hostz
user-agentzgzip,deflatez,brz,zstdc@seZdZdZdS)�_TYPE_FAILEDTELLrN)�__name__�
__module__�__qualname__�token�rr�>/usr/local/lib/python3.7/site-packages/urllib3/util/request.pyr'srzFinal[_TYPE_FAILEDTELL]�_FAILEDTELL�GET�HEAD�DELETE�TRACE�OPTIONSZCONNECTzbool | Nonezbool | list[str] | str | Nonez
str | Nonezdict[str, str])�
keep_alive�accept_encoding�
user_agent�
basic_auth�proxy_basic_auth�
disable_cache�returncCs�i}|r6t|t�rnt|t�r*d�|�}nt}||d<|rB||d<|rNd|d<|rndt|�d������|d<|r�dt|�d������|d	<|r�d
|d<|S)a�
    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 either the ``brotli`` or
        ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead.
        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'}
    �,zaccept-encodingz
user-agentz
keep-alive�
connectionzBasic zlatin-1�
authorizationzproxy-authorizationzno-cachez
cache-control)�
isinstance�str�list�join�ACCEPT_ENCODINGr�encode�decode)rrrrrr�headersrrr�make_headers7s&/

r*z
typing.Anyz_TYPE_BODY_POSITION | None)�body�posrcCsN|dk	rt||�n6t|dd�dk	rJy|��}Wntk
rHt}YnX|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�getattrr-�OSErrorr)r+r,rrr�set_file_position�s
r1ztyping.IO[typing.AnyStr]�_TYPE_BODY_POSITION�None)r+�body_posrc
Cs�t|dd�}|dk	rZt|t�rZy||�Wq�tk
rV}ztd�|�Wdd}~XYq�Xn&|tkrltd��ntdt|��d���dS)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 �.)r/r"�intr0rr�
ValueError�type)r+r4�	body_seek�errrr.�sr.c@seZdZUded<ded<dS)�ChunksAndContentLengthztyping.Iterable[bytes] | None�chunksz
int | None�content_lengthN)rr
r�__annotations__rrrrr<�s
r<ztyping.Any | Noner#r7)r+�method�	blocksizercs��dkr$d}|��tkrd}q�d}n�t�ttf�rJt��f}t|d�}n�t�d�rtdd���fdd�}|�}d}ndyt��}WnJt	k
r�yt
��}d}Wn$t	k
r�t	d����d�YnXYnX�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�readztyping.Iterable[bytes])rc3s:t�tj�}x(����}|sP|r,|�d�}|VqWdS)Nz
iso-8859-1)r"�io�
TextIOBaserBr')r'�	datablock)rAr+rr�chunk_readable�s

z&body_to_chunks.<locals>.chunk_readablezO'body' must be a bytes-like object, file-like object, or iterable. Instead was )r=r>)
�upper�_METHODS_NOT_EXPECTING_BODYr"r#�bytesr�len�hasattr�
memoryview�	TypeError�iter�nbytesr<)r+r@rAr=r>rF�mvr)rAr+r�body_to_chunks�s2


rQ)NNNNNN)'�
__future__rrC�typing�base64r�enumr�
exceptionsr�utilr�
TYPE_CHECKING�typing_extensionsr	�SKIP_HEADER�	frozenset�SKIPPABLE_HEADERSr&Z
brotlicffiZ_unused_module_brotli�ImportError�brotliZ	zstandardZ_unused_module_zstdrrrr?�Unionr7r2rHr*r1r.�
NamedTupler<rQrrrr�<module>sNI