§
    sŠtjz  ã                   óT   — d Z ddlZddlmZmZ ddlmZ  G d„ dej        ¦  «        Z	dS )z*The module containing HTTPProxyDigestAuth.é    N)ÚcookiesÚutilsé   )Ú_digest_auth_compatc                   óœ   ‡ — e Zd ZdZ ej        dej        ¬¦  «        Zˆ fd„Ze	d„ ¦   «         Z
e
j        d„ ¦   «         Z
ˆ fd„Zd„ Zd	„ Zˆ xZS )
ÚHTTPProxyDigestAuthaO  HTTP digest authentication between proxy

    :param stale_rejects: The number of rejects indicate that:
        the client may wish to simply retry the request
        with a new encrypted response, without reprompting the user for a
        new username and password. i.e., retry build_digest_header
    :type stale_rejects: int
    zdigest )Úflagsc                 ó~   •—  t          t          | ¦  «        j        |i |¤Ž d| _        |                      ¦   «          d S )Nr   )Úsuperr   Ú__init__Ústale_rejectsÚinit_per_thread_state)ÚselfÚargsÚkwargsÚ	__class__s      €úf/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/requests_toolbelt/auth/http_proxy_digest.pyr   zHTTPProxyDigestAuth.__init__   sF   ø€ Ø1�Õ! 4Ñ(Ô(Ô1°4ÐB¸6ÐBÐBÐBØˆÔà×"Ò"Ñ$Ô$Ð$Ð$Ð$ó    c                 óD   — t          | dd ¦  «        }|€| j        S |j        S ©NÚ_thread_local©ÚgetattrÚ_stale_rejectsr   )r   Úthread_locals     r   r   z!HTTPProxyDigestAuth.stale_rejects   s+   € å˜t _°dÑ;Ô;ˆØÐØÔ&Ð&ØÔ)Ð)r   c                 óL   — t          | dd ¦  «        }|€	|| _        d S ||_        d S r   r   )r   Úvaluer   s      r   r   z!HTTPProxyDigestAuth.stale_rejects"   s5   € å˜t _°dÑ;Ô;ˆØÐØ"'ˆDÔÐÐà).ˆLÔ&Ð&Ð&r   c                 óz   •— 	 t          t          | ¦  «                             ¦   «          d S # t          $ r Y d S w xY w)N)r   r   r   ÚAttributeError)r   r   s    €r   r   z)HTTPProxyDigestAuth.init_per_thread_state*   sM   ø€ ð	ÝÕ% tÑ,Ô,×BÒBÑDÔDÐDÐDÐDøÝð 	ð 	ð 	àˆDˆDð	øøøs   ƒ', ¬
:¹:c                 óÈ  — |j         dk    �rÕ| j        dk     �rÉ|j                             d¦  «        }|€t	          d¦  «        ‚| j                             |¦  «        s|S t          j        | j         	                    d|d¬¦  «        ¦  «        | _
        d	|j        j        v rod
| j
        v rf| j
        d
                              ¦   «         dk    r| xj        dz  c_        n2| j
        d
                              ¦   «         dk    rt	          d¦  «        ‚|j         |                     ¦   «          |j                             ¦   «         }t!          j        |j        |j        |j        ¦  «         |                     |j        ¦  «         |                      |j        |j        ¦  «        |j        d	<    |j        j        |fi |¤Ž}|j                             |¦  «         ||_        |S |S )z’Handle HTTP 407 only once, otherwise give up

        :param r: current response
        :returns: responses, along with the new response
        i—  é   zproxy-authenticateNzRproxy server violated RFC 7235:407 response MUST contain header proxy-authenticateÚ r   )ÚcountúProxy-AuthorizationÚstaleÚtrueÚfalsezUser or password is invalid)Ústatus_coder   ÚheadersÚgetÚIOErrorÚ_patÚmatchr   Úparse_dict_headerÚsubÚchalÚrequestÚlowerÚcontentÚcloseÚcopyr   Úextract_cookies_to_jarÚ_cookiesÚrawÚprepare_cookiesÚbuild_digest_headerÚmethodÚurlÚ
connectionÚsendÚhistoryÚappend)r   Úrr   Ús_authÚprepÚ_rs         r   Ú
handle_407zHTTPProxyDigestAuth.handle_4071   sÜ  € ð Œ=˜CÒÑ DÔ$6¸Ò$:Ñ$:Ø”Y—]’]Ð#7Ñ8Ô8ˆFØˆ~ÝðJñKô Kð Kð ”Y—_’_ VÑ,Ô,ð Ø�åÔ/Ø”	—’˜b &°�Ñ2Ô2ñ4ô 4ˆDŒIð
 &¨¬Ô):Ð:Ð:Ø˜tœyÐ(Ð(Ø”9˜WÔ%×+Ò+Ñ-Ô-°Ò7Ð7ØÐ&Ô&¨!Ñ+Ð&Ô&Ð&à”Y˜wÔ'×-Ò-Ñ/Ô/°7Ò:Ð:Ý!Ð"?Ñ@Ô@Ð@ð ŒIˆIØ�GŠG‰IŒIˆIØ”9—>’>Ñ#Ô#ˆDÝÔ*¨4¬=¸!¼)ÀQÄUÑKÔKÐKØ× Ò  ¤Ñ/Ô/Ð/à26×2JÒ2JØ”˜TœXñ3'ô 3'ˆDŒLÐ.Ñ/à"�”Ô" 4Ð2Ð2¨6Ð2Ð2ˆBØŒJ×Ò˜aÑ Ô Ð ØˆBŒJàˆIàˆHr   c                 óÂ   — |                       ¦   «          | j        r(|                      |j        |j        ¦  «        |j        d<   |                     d| j        ¦  «         |S )Nr$   Úresponse)r   Ú
last_noncer:   r;   r<   r)   Úregister_hookrE   )r   rA   s     r   Ú__call__zHTTPProxyDigestAuth.__call___   sa   € Ø×"Ò"Ñ$Ô$Ð$àŒ?ð 	Ø/3×/GÒ/GØ”˜!œ%ñ0ô 0ˆAŒIÐ+Ñ,ð 	
�Š˜
 D¤OÑ4Ô4Ð4Øˆr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚreÚcompileÚ
IGNORECASEr,   r   Úpropertyr   Úsetterr   rE   rJ   Ú__classcell__)r   s   @r   r   r   
   sÎ   ø€ € € € € ðð ð ˆ2Œ:�j¨¬Ð6Ñ6Ô6€Dð%ð %ð %ð %ð %ð ð*ð *ñ „Xð*ð Ôð/ð /ñ Ôð/ðð ð ð ð ð,ð ,ð ,ð\ð ð ð ð ð ð r   r   )
rN   rO   Úrequestsr   r   r"   r   ÚauthÚHTTPDigestAuthr   © r   r   ú<module>rY      s   ðà 0Ð 0Ø 	€	€	€	à #Ð #Ð #Ð #Ð #Ð #Ð #Ð #à )Ð )Ð )Ð )Ð )Ð )ð]ð ]ð ]ð ]ð ]˜$Ô-ñ ]ô ]ð ]ð ]ð ]r   