Ë
    Bü´jô'  ã                  ó>  — U d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ ddl	m
Z
 ddlmZ ej                  rd d	lmZ d
Z eg d¢«      ZdZ	 	 d dlZedz  Z	 ej.                  dk\  rd dlmZ nd dlmZ edz  Z G d„ de«      Zej:                  Zded<   ej@                  e!ef   Z"h d£Z#	 	 	 	 	 	 ddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z$	 	 	 	 	 	 d d„Z%d!d„Z& G d„ dejN                  «      Z(	 	 	 	 	 	 	 	 d"d„Z)y# e$ r d dlZY Œ³w xY w# e$ r Y Œ¹w xY w# e$ r Y Œ¢w xY w)#é    )ÚannotationsN)Ú	b64encode)ÚEnumé   )ÚUnrewindableBodyErroré   )Úto_bytes)ÚFinalz@@@SKIP_HEADER@@@)úaccept-encodingÚhostú
user-agentzgzip,deflatez,br)é   é   )Úzstdz,zstdc                  ó   — e Zd ZdZy)Ú_TYPE_FAILEDTELLr   N)Ú__name__Ú
__module__Ú__qualname__Útoken© ó    úR/root/workspace/ytshorts/venv/lib/python3.12/site-packages/urllib3/util/request.pyr   r   ,   s   „ Ø�Er   r   zFinal[_TYPE_FAILEDTELL]Ú_FAILEDTELL>   ÚGETÚHEADÚTRACEÚDELETEÚCONNECTÚOPTIONSzlatin-1)Úbasic_auth_encodingÚproxy_basic_auth_encodingc               ót  — i }|r>t        |t        «      rn(t        |t        «      rdj                  |«      }nt        }||d<   |r||d<   | rd|d<   |r.dt        |j                  |«      «      j                  «       › �|d<   |r.dt        |j                  |«      «      j                  «       › �|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 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. Basic authentication transmits Base64-encoded bytes, not
        Unicode text, so the string is encoded with ``basic_auth_encoding``
        before Base64 encoding.

        Must contain decoded credentials (not percent-encoded).
        For URLs parsed with :func:`parse_url`, use :attr:`Url.auth_decoded_joined`
        to get the properly formatted string.

    :param basic_auth_encoding:
        Text encoding used to encode ``basic_auth`` before Base64 encoding.
        Defaults to "latin-1" for backward compatibility. Use "utf-8" only
        when the peer expects UTF-8 Basic authentication credentials.

        Must contain decoded credentials (not percent-encoded).
        For URLs parsed with :func:`parse_url`, use :attr:`Url.auth_decoded_joined`
        to get the properly formatted string.

    :param proxy_basic_auth:
        Colon-separated username:password string for 'proxy-authorization: basic ...'
        auth header. Basic authentication transmits Base64-encoded bytes, not
        Unicode text, so the string is encoded with ``proxy_basic_auth_encoding``
        before Base64 encoding.

        Must contain decoded credentials (not percent-encoded).
        For URLs parsed with :func:`parse_url`, use :attr:`Url.auth_decoded_joined`
        to get the properly formatted string.

    :param proxy_basic_auth_encoding:
        Text encoding used to encode ``proxy_basic_auth`` before Base64
        encoding. Defaults to "latin-1" for backward compatibility. Use
        "utf-8" only when the proxy expects UTF-8 Basic authentication
        credentials.

        Must contain decoded credentials (not percent-encoded).
        For URLs parsed with :func:`parse_url`, use :attr:`Url.auth_decoded_joined`
        to get the properly formatted string.

    :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Ú
connectionzBasic Úauthorizationzproxy-authorizationzno-cachezcache-control)Ú
isinstanceÚstrÚlistÚjoinÚACCEPT_ENCODINGr   ÚencodeÚdecode)	Ú
keep_aliveÚaccept_encodingÚ
user_agentÚ
basic_authÚproxy_basic_authÚdisable_cacher!   r"   Úheaderss	            r   Úmake_headersr5   <   sØ   € ðh !€GÙÜ�o¤sÔ+ØÜ˜¬Ô.Ø!Ÿh™h Ó7‰Oä-ˆOØ%4ˆÐ!Ñ"áØ *ˆ�ÑáØ ,ˆ�Ñáà”Y˜z×0Ñ0Ð1DÓEÓF×MÑMÓOÐPÐQð 	�Ñ ñ à”YÐ/×6Ñ6Ð7PÓQÓR×YÑYÓ[Ð\Ð]ð 	Ð%Ñ&ñ Ø#-ˆ�Ñ à€Nr   c                ó’   — |�t        | |«       |S t        | dd«      �	 | j                  «       }|S |S # t        $ r
 t        }Y |S w xY w)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   )ÚbodyÚposs     r   Úset_file_positionr=   °   sc   € ð €Ü�D˜#Ôð €Jô 
��v˜tÓ	$Ð	0ð	Ø—)‘)“+ˆCð €Jˆ3€Jøô ò 	ô ‰Cà€Jð	ús   Ÿ3 ³AÁAc                óþ   — t        | dd«      }|�t        |t        «      r
	  ||«       y|t
        u rt	        d«      ‚|€t	        d«      ‚t        dt        |«      › d�«      ‚# t        $ r}t	        d«      |‚d}~ww xY w)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.zbody does not implement seek.z1body_pos must be of type integer, instead it was ú.)r9   r'   Úintr:   r   r   Ú
ValueErrorÚtype)r;   Úbody_posÚ	body_seekÚes       r   r8   r8   Ä   s¡   € ô ˜˜f dÓ+€IØÐ¤¨H´cÔ!:ð	Ù�hÕð
 
”[Ñ	 Ü#ð4ó
ð 	
ð 
Ð	Ü#Ð$CÓDÐDäØ?ÄÀXÃÐ?OÈqÐQó
ð 	
øô ò 	Ü'ØSóàðûð	ús   ¡A" Á"	A<Á+A7Á7A<c                  ó"   — e Zd ZU ded<   ded<   y)ÚChunksAndContentLengthztyping.Iterable[bytes] | NoneÚchunksz
int | NoneÚcontent_lengthN)r   r   r   Ú__annotations__r   r   r   rH   rH   ä   s   … Ø)Ó)ØÔr   rH   c                ó¦  ‡ ‡— ‰ €d}|j                  «       t        vrd}nld}nit        ‰ t        t        f«      rt        ‰ «      f}t        |d   «      }n8t        ‰ d«      rdˆˆ fd„} |«       }d}n	 t        ‰ «      }‰ f}|j                  }t        ||¬«      S # t        $ r. 	 t        ‰ «      }d}n# t        $ r t        d‰ ›�«      d‚w xY wY ŒCw xY w)aR  Takes 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   Úreadc               3  óš   •K  — t        ‰t        j                  «      } 	 ‰j                  ‰«      }|sy | r|j	                  d«      }|–— Œ,­w)Nzutf-8)r'   ÚioÚ
TextIOBaserM   r,   )r,   Ú	datablockÚ	blocksizer;   s     €€r   Úchunk_readablez&body_to_chunks.<locals>.chunk_readable
  sK   øè ø€ Ü ¤b§m¡mÓ4ˆFØØ ŸI™I iÓ0�	Ù ØÙØ )× 0Ñ 0°Ó 9�IØ’ð ùs   ƒAAzO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rI   rJ   )Úreturnztyping.Iterable[bytes])ÚupperÚ_METHODS_NOT_EXPECTING_BODYr'   r(   Úbytesr	   ÚlenÚhasattrÚ
memoryviewÚnbytesÚ	TypeErrorÚiterrH   )r;   ÚmethodrR   rI   rJ   rS   Ú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*   Á2B Â	CÂ#B1Â0CÂ1C
Ã
CÃC)NNNNNN)r.   úbool | Noner/   zbool | list[str] | str | Noner0   ú
str | Noner1   rb   r2   rb   r3   ra   r!   r(   r"   r(   rT   zdict[str, str])r;   z
typing.Anyr<   ú_TYPE_BODY_POSITION | NonerT   rc   )r;   ztyping.IO[typing.AnyStr]rD   Ú_TYPE_BODY_POSITIONrT   ÚNone)r;   ztyping.Any | Noner^   r(   rR   rA   rT   rH   )*Ú
__future__r   rO   Ú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Ú	backportsr   r   r   rK   ÚUnionrA   rd   rV   r5   r=   r8   Ú
NamedTuplerH   r`   r   r   r   ú<module>r{      sá  ðÞ "ã 	Û 
Û Ý Ý å .Ý à	×ÒÝð "€ÙÒGÓHÐ à €ðð/Û2ð �uÑ€OðØ
×Ñ˜7Ò"Þ;å9ð �wÑ€Oô�tô ð (8×'=Ñ'=€Ð$Ó =à—l‘l 3Ð(8Ð#8Ñ9Ð ò WÐ ð #Ø59Ø!Ø!Ø#'Ø!%ðqð  )Ø%.ñqØðqà2ðqð ðqð ð	qð
 !ðqð ðqð ðqð  #ðqð óqðhØ
ðØ5ðàóó(
ô@˜V×.Ñ.ô ð
BPØ
ðBPØ%(ðBPØ58ðBPàôBPøð_ ò /Ý.ð/ûàò 	Ùð	ûð ò 	Ùð	ús<   ÁC: ÁD Ã:	DÄD	 ÄDÄD	 Ä	DÄDÄDÄD