Your IP : 216.73.216.220


Current Path : /snap/certbot/5528/lib64/python3.12/site-packages/urllib3/util/__pycache__/
Upload File :
Current File : //snap/certbot/5528/lib64/python3.12/site-packages/urllib3/util/__pycache__/request.cpython-312.pyc

�

tI�i� ��.�UddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZejrdd	lmZd
Zegd��ZdZ		ddlZed
z
Z	ej.dk\rddlmZnddlmZedz
ZGd�de�Zej:Zded<ej@e!efZ"hd�Z#						d													dd�Z$						dd�Z%dd�Z&Gd�dejN�Z(								d d�Z)y#e$rddlZY��wxYw#e$rY��wxYw#e$rY��wxYw)!�)�annotationsN)�	b64encode)�Enum�)�UnrewindableBodyError�)�to_bytes)�Finalz@@@SKIP_HEADER@@@)�accept-encoding�host�
user-agentzgzip,deflatez,br)��)�zstdz,zstdc��eZdZdZy)�_TYPE_FAILEDTELLrN)�__name__�
__module__�__qualname__�token����/build/snapcraft-certbot-53a6961353a63169611ae8a78f6bfa4f/parts/certbot/install/lib/python3.12/site-packages/urllib3/util/request.pyrr,s��
�ErrzFinal[_TYPE_FAILEDTELL]�_FAILEDTELL>�GET�HEAD�TRACE�DELETE�CONNECT�OPTIONSc�t�i}|r>t|t�rn(t|t�rdj|�}nt}||d<|r||d<|rd|d<|r.dt|j
d��j���|d<|r.dt|j
d��j���|d	<|rd
|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 the dependencies for
        Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or
        Zstandard (the ``backports.zstd`` package for Python before 3.14)
        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'}
    �,rr
z
keep-alive�
connectionzBasic zlatin-1�
authorizationzproxy-authorizationzno-cachez
cache-control)�
isinstance�str�list�join�ACCEPT_ENCODINGr�encode�decode)�
keep_alive�accept_encoding�
user_agent�
basic_auth�proxy_basic_auth�
disable_cache�headerss       r�make_headersr3<s���d!�G���o�s�+��
���
.�!�h�h��7�O�-�O�%4��!�"�� *����� ,������Y�z�0�0��;�<�C�C�E�F�G�	�� ���Y�/�6�6�y�A�B�I�I�K�L�M�	�%�&��#-��� ��Nrc��|�t||�|St|dd��	|j�}|S|S#t$r
t}Y|SwxYw)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�getattrr5�OSErrorr)�body�poss  r�set_file_positionr;�sc�����D�#���J�
��v�t�	$�	0�	��)�)�+�C��J�3�J���	��C��J�	�s�3�A�Ac���t|dd�}|�t|t�r
	||�y|t
urt	d��t
dt|��d���#t$r}t	d�|�d}~wwxYw)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 �.)r7r%�intr8rr�
ValueError�type)r9�body_pos�	body_seek�es    rr6r6�s�����f�d�+�I����H�c�!:�	��h��

�[�	 �#�
4�
�	
�
�?��X��?O�q�Q�
�	
���	�'�S���
��	�s�A�	A/�A*�*A/c�"�eZdZUded<ded<y)�ChunksAndContentLengthztyping.Iterable[bytes] | None�chunksz
int | None�content_lengthN)rrr�__annotations__rrrrFrF�s��)�)��rrFc������d}|j�tvrd}nld}nit�ttf�rt��f}t
|d�}n8t�d�rd��fd�}|�}d}n	t��}�f}|j}t||��S#t$r.	t��}d}n#t$rtd����d�wxYwY�CwxYw)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�readc3��K�t�tj�}	�j��}|sy|r|j	d�}|���,�w)Nzutf-8)r%�io�
TextIOBaserKr*)r*�	datablock�	blocksizer9s  ��r�chunk_readablez&body_to_chunks.<locals>.chunk_readable�sK�������b�m�m�4�F�� �I�I�i�0�	� ��� )� 0� 0�� 9�I���
�s�AAzO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rGrH)�returnztyping.Iterable[bytes])
�upper�_METHODS_NOT_EXPECTING_BODYr%r&�bytesr	�len�hasattr�
memoryview�nbytes�	TypeError�iterrF)r9�methodrPrGrHrQ�mvs` `    r�body_to_chunksr^�s����$�|����<�<�>�!<�<��N�!�N�
�D�3��,�	'��4�.�"���V�A�Y���
��v�	�	 � �!����	'��D�!�B��W�F��Y�Y�N�!���O�O���		�
��d���!%����
��8�8<�x�A����
���			�s*�2B�	C�#
B1�0C�1C
�
C�C)NNNNNN)r,�bool | Noner-zbool | list[str] | str | Noner.�
str | Noner/r`r0r`r1r_rRzdict[str, str])r9z
typing.Anyr:�_TYPE_BODY_POSITION | NonerRra)r9ztyping.IO[typing.AnyStr]rB�_TYPE_BODY_POSITIONrR�None)r9ztyping.Any | Noner\r&rPr?rRrF)*�
__future__rrM�sys�typing�base64r�enumr�
exceptionsr�utilr	�
TYPE_CHECKINGr
�SKIP_HEADER�	frozenset�SKIPPABLE_HEADERSr)�
brotlicffi�_unused_module_brotli�ImportError�brotli�version_info�compressionr�_unused_module_zstd�	backportsrrrrI�Unionr?rbrTr3r;r6�
NamedTuplerFr^rrr�<module>rys���"�	�
�
���.��	����"���G�H�� ���/�2��u��O��
���7�"�;�9��w��O��t��(8�'=�'=��
$�=��l�l�3�(8�#8�9��W��#�59�!�!�#'�!%�
O��O�2�O��O��	O�
!�O��
O��O�d�
��5����(
�<�V�.�.��
BP�
�BP�%(�BP�58�BP��BP��W�/�.�/���	��	���	��	�s<�C2�D�2	C>�;D�=C>�>D�D	�D	�D�D