https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/url.cpython-310.pyc
o

�]Lb;b�@s�ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZ
mZmZmZmZmZddlmZmZejZejZejZejZd/dd	�ZGd
d�de�ZGdd
�d
ej�Zdd�Ze�ed�ZGdd�dej �Zdd�Z!dd�Z"Gdd�dej#�Z$Gdd�dej �Z%Gdd�de$�Z&er�Gdd�dej �Z'Gdd �d ej(ej)�Z)Gd!d"�d"ej*�Z*Gd#d$�d$ej+�Z+Gd%d&�d&ej,�Z-gZ.				'		(d0d)d*�Z/d1d+d,�Z0d-d.�Z1dS)2�)�absolute_importN�)�_)�getattr)�encoding�error�httpconnection�	keepalive�pycompat�sslutil�urllibcompat�util)�
stringutil�urlutilcCs8|�dd�}|�dd�}|�dd�}|r|�dd�}|S)	a1Replace special characters "&", "<" and ">" to HTML-safe sequences.
    If the optional flag quote is true, the quotation mark character (")
    is also translated.

    This is the same as cgi.escape in Python, but always operates on
    bytes, whereas cgi.escape in Python 3 only works on unicodes.
    �&s&amp;�<s&lt;�>s&gt;�"s&quot;)�replace)�s�quote�r�//usr/lib/python3/dist-packages/mercurial/url.py�escape'src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�passwordmgrcCs||_||_dS�N)�ui�passwddb)�selfrrrrr�__init__8s
zpasswordmgr.__init__cCs|j�||||�Sr)r�add_password)r�realm�uri�user�passwdrrrr <szpasswordmgr.add_passwordc
Cs�t|td�tf�sJ�t|t�sJ�|j�||�}|\}}t�|�t�|�}}|r<|r<|�||�t�|�t�|�fS|r@|sat	�
|j||�}|ra|\}}|�d�|�d�}}|j�
d|�|re|s�t�t�|��}	d|	_|j��s�t�td�t�t|	����|j�td�t�t|	���|j�td�t�|��|r�|j�td�|�n
|jjtd�dd	�}|s�|j��}|dur�d
S|j�||||�|�||�t�|�t�|�fS)Nsusernamespassword�#using auth.%s.* for authentication
s"http authorization required for %ss#http authorization required for %s
s
realm: %s
s	user: %s
suser:)�default)NN)�
isinstance�type�strr�find_user_passwordr
�bytesurl�_writedebug�strurl�httpconnectionmod�readauthforurir�get�debugr�url�query�interactiver�Abortr�hidepassword�bytes�write�prompt�getpassr )
rr!�authuri�authinfor#r$�res�group�auth�urrrr*?sN
����
zpasswordmgr.find_user_passwordcCs0td�}|j�|||rdt|�pdf�dS)N� http auth: user %s, password %s
�*�not set)rrr1�len)rr#r$�msgrrrr,ps(zpasswordmgr._writedebugcCs|j�d|�Sr)rr*)rr;rrr�find_stored_passwordt�z passwordmgr.find_stored_passwordN)�__name__�
__module__�__qualname__rr r*r,rFrrrrr7s1rc@�eZdZdd�Zdd�ZdS)�proxyhandlercCs|�dd�ptj�d�}|r{|�d�s|�d�sd|d}t�|�}|js4|�dd�|_|�dd�|_d	d
g}|�	dd�|�
dd
�D��|�	dd�tj�dd��d�D��|�dd�rbg|_
n||_
t|�}||d�}|�dt�t|���ni}tj�||�||_dS)Ns
http_proxyshostshttp:shttps:shttp://�/suserspasswds	localhosts	127.0.0.1cSsg|]}|���qSr)�lower��.0�prrr�
<listcomp>�sz)proxyhandler.__init__.<locals>.<listcomp>snocSs g|]}|��r|�����qSr)�striprNrOrrrrR�s�
�sno_proxy��,salways)�http�httpssproxying through %s
)�configr�environr0�
startswithrr2r#r$�extend�
configlist�split�
configbool�no_listr)r1r6r7�urlreqrLrr)rr�proxyurl�proxyr_�proxiesrrrrysB���
���
�
zproxyhandler.__init__cCs�t�t�|���d�d}|jD]+}||krdS|�d�r*|�|dd��r*dS|�d�r;|�|dd��r;dSqtj	�
||||�S)N�:rs*.��.r)r
r+r�gethostr]r_rZ�endswithr`rL�
proxy_open)r�reqrb�type_�host�errrri�s
�zproxyhandler.proxy_openN)rHrIrJrrirrrrrLxs0rLcs�fdd�}|S)NcsBt|tj�r|�d�t�|�D]}�||�qdS�||�dS�Nr)r'r.�httpsendfile�seekr
�
filechunkiter)r�data�chunk��orgsendrr�	_sendfile�s
�z _gen_sendfile.<locals>._sendfiler)rurvrrtr�
_gen_sendfile�s
rwshttpshandlerc@s eZdZeejj�Zdd�ZdS)rcCs4t|dd�}|r|jr|��d|_|Stj�|�S)N�proxyres)r�
will_close�closerxr	�HTTPConnection�getresponse)rrxrrrr|�szhttpconnection.getresponseN)rHrIrJrwr	r{�sendr|rrrrr�srcCs�|j}|r|dd�dvrd|}d}nt�|�}d}|s$|t�|�krOt�t�|��}|s3|jdkrOd�	|j
|jp;dg�|_|j
��|_
|j
�|jj�dSd|_d|_
dS)	N�)zhttp://zhttps:/zhttps://TFshttpsrds443)�_tunnel_hostr�getselector�
getfullurlrr2r
r+�scheme�joinrl�port�realhostport�headers�copy�update�parent�
addheaders)�handler�hrj�tunnel_host�
new_tunnelr@rrr�_generic_start_transaction�s 

r�c	s^�fdd��jD�}��d�j�t�|�D]	}��d|�q��d�i}tjs0�j|d<�j�jfd�j	i|���	��
�\}}}|tjkrKnt
t�fd	d
�d��q>|�_|���_�jdkrot
t�jjd��dS|d
krwd�_n|�d�r�d�_n
|dkr�d�_nt�|���jdkr�d�_d�_d�_t�t���_dSt��j��_d�j_�j�d�}|r�|��dkr�d�_d�_nd�_�� ��_�j�d�}|r�js�zt!|��_Wnt"y�d�_Yn
w�jdkr�d�_nd�_|tj#k�s|tj$k�sd|k�rdk�sn�j	dk�rd�_�j�s*�j�s*�jdu�r*d�_��_%dS)Ncs2i|]}|���d�rt�|�t��j|��qS)zproxy-)rNrZr
�bytestrr�)rP�x�rrr�
<dictcomp>�s��z(_generic_proxytunnel.<locals>.<dictcomp>sCONNECT %s HTTP/1.0
s%s: %s
s
sstrict�methodTcs�j����Sr)�fp�readlinerSr)r=rr�<lambda>sz&_generic_proxytunnel.<locals>.<lambda>rT��sHTTP/1.0�
sHTTP/1.�sHTTP/0.9�	rrFstransfer-encodingschunkedscontent-length�dsHEAD)&r�r}r�r
�	iteritems�ispy3�strict�response_class�sock�_method�_read_status�httplib�CONTINUE�list�iter�statusrS�reasonr�r��versionrZ�UnknownProtocol�length�chunkedry�HTTPMessage�stringiorE�	getheaderrN�
chunk_left�_check_close�int�
ValueError�
NO_CONTENT�NOT_MODIFIEDrx)	r�proxyheaders�header�kwargsr�r�r��trencr�r)r=rr�_generic_proxytunnel�s~
�


�







�
�r�c@rK)�httphandlercCs|�t|�Sr)�do_openr�rrjrrr�	http_openRszhttphandler.http_opencC�t|||�tj�|||�Sr)r�r	�HTTPHandler�_start_transaction�rr�rjrrrr�U�zhttphandler._start_transactionN)rHrIrJr�r�rrrrr�Qsr�c@s*eZdZdd�Zejdkrdd�ZdSdS)�logginghttpconnectioncOs$tjj|g|�Ri|��||_dSr)r	r{r�_create_connection)r�
createconn�argsr�rrrr[�
zlogginghttpconnection.__init__)rer~r~cCs2|�|j|jf|j|j�|_|jr|��dSdSr)r�rlr��timeout�source_addressr�r�_tunnelr�rrr�connectbs��zlogginghttpconnection.connectN)rHrIrJr�sys�version_infor�rrrrr�Zs

�r�cs2eZdZdZd	�fdd�	Zdd�Zdd�Z�ZS)
�logginghttphandlerz"HTTP handler that logs socket I/O.Ncs(tt|�j|d�||_||_||_dS�N�r�)�superr�r�_logfh�_logname�
_observeropts)r�logfh�name�observeroptsr���	__class__rrrms
zlogginghttphandler.__init__cCs|�|j|�Sr)r��_makeconnectionr�rrrr�wrGzlogginghttphandler.http_opencs"�fdd�}t|g|�Ri|��S)Ncs,tj|i|��}tj�j|�jfi�j��Sr)�socket�create_connectionr
�makeloggingsocketr�r�r�)r�r�r�r�rr�createconnection{s
��z<logginghttphandler._makeconnection.<locals>.createconnection)r�)rr�r�r�rr�rr�zsz"logginghttphandler._makeconnectionr)rHrIrJ�__doc__rr�r��
__classcell__rrr�rr�js

r�c@sFeZdZejZejZe	ej
�Ze�ej
�Z			ddd�Zdd�ZdS)�httpsconnectionNcOs.tjj|||g|�Ri|��||_||_dSr)r	r{r�key_file�	cert_file)rrlr�r�r�r�r�rrrr�s	
zhttpsconnection.__init__cCsht�|j|jf�|_|j}|jrt|�|j�dd�d}tj	|j|j
|j|j|d�|_t�
|j�dS)Nrdrr)r�serverhostname)r�r�rlr�r�r�r��rsplitr�
wrapsocketr�r�r�validatesocket)rrlrrrr��s�zhttpsconnection.connect)NNN)rHrIrJr	�HTTPResponser�r��
HTTPS_PORT�default_portrw�safesendr}�wrapgetresponser{r|rr�rrrrr��s

�
r�c@s0eZdZd
dd�Zdd�Zdd�Zd
dd	�ZdS)�httpshandlerNcCs8tjj||d�tj�|�||_t|j|jj�|_dSr�)	r	�KeepAliveHandlerrr`r�rr�httppasswordmgrdb�pwmgr)rrr�rrrr�szhttpshandler.__init__cCr�r)r�r	r�r�r�rrrr��r�zhttpshandler._start_transactioncCsbt�|�}|j�|�\}}t�|j||�}|r'|\}}||_|j�d|�nd|_|�	|j
|�S)Nr%)rr�r�rFr.r/rr?r1r�r�)rrjr2r#�passwordr=r>r?rrr�
https_open�s
zhttpshandler.https_opencOs�d}d}t|�dkr|d}t|�dkr|d}|dd�}|jr5d|jvr5d|jvr5|jd}|jd}t||||g|�Ri|��}|j|_|S)Nrrreskeyscert)rDr?r�r)rrlr�r�r��keyfile�certfile�connrrrr��s&

���zhttpshandler._makeconnectionr)rHrIrJrr�r�r�rrrrr��s

r�c@�$eZdZdd�Zdd�Zdd�ZdS)�httpdigestauthhandlercOs$tjj|g|�Ri|��d|_dSr)r`r�r�retried_req�rr�r�rrrr�r�zhttpdigestauthhandler.__init__cC�dSrrr�rrr�reset_retry_count��z'httpdigestauthhandler.reset_retry_countcC�*||jur||_d|_tj�|||||�Srn)r��retriedr`r��http_error_auth_reqed�r�auth_headerrlrjr�rrrr��

�z+httpdigestauthhandler.http_error_auth_reqedN)rHrIrJrr�rrrrrr��sr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�httpbasicauthhandlercOs*d|_tjj|g|�Ri|��d|_dSr)r?r`rrr�r�rrrr�s
zhttpbasicauthhandler.__init__cC�|jr|�|j|j�|Sr�r?�add_unredirected_headerr�r�requestrrr�http_request��z!httpbasicauthhandler.http_requestcCrrrr	rrr�
https_request�rz"httpbasicauthhandler.https_requestcCr�rrr�rrrr�r�z&httpbasicauthhandler.reset_retry_countcCr�rn)r�rr`rrrrrrrrz*httpbasicauthhandler.http_error_auth_reqedcCs�|j�|t�|��\}}|durCdt�|�t�|�f}dt�t�|��	��}|�
|jd�|kr3dS||_|�
|j|�|j�|�SdS)Ns%s:%szBasic %s)r$r*rr�r
r+r-�base64�	b64encoderS�
get_headerrr?rr��open)rrlrjr!r#�pw�rawr?rrr�retry_http_basic_auths
�z*httpbasicauthhandler.retry_http_basic_authN)	rHrIrJrrr
r�rrrrrrr�s	rc@r�)�
cookiehandlerc
Cs�d|_|�dd�}|s
dSt�|�}ztj�t�|��}|��||_WdStjj	yH}z|�
td�|t�
|�f�WYd}~dSd}~ww)Nsauths
cookiefiles?(error loading cookie file %s: %s; continuing without cookies)
)�	cookiejarrXr
�
expandpath�	cookielib�MozillaCookieJarr
�fsdecode�load�	LoadError�warnrr�forcebytestr)rr�
cookiefilerrmrrrr!s*
������zcookiehandler.__init__cC�|jr	|j�|�|Sr�r�add_cookie_headerr	rrrr8�zcookiehandler.http_requestcCr rr!r	rrrr
>r#zcookiehandler.https_requestN)rHrIrJrrr
rrrrr sr�sTcsz��tdd�}g}|r|�t|||pi|d��n|�t|d��tr,|�t�|d��|�t���t��j	��|durk|\}	}
}}��
|
d�\}
}||
ksR|rZ��|	|
||���d||rfdt
|�pgdf�|�t��t��f�|���fd	d
�tD��|�t���tj|�}d|_d|_d|_|s�dt��}dt�|�fg|_n	dt�|�fg|_|r�|j�d
�|S)a@
    construct an opener suitable for urllib2
    authinfo will be added to the password manager

    The opener can be configured to log socket events if the various
    ``logging*`` arguments are specified.

    ``loggingfh`` denotes a file object to log events to.
    ``loggingname`` denotes the name of the to print when logging.
    ``loggingopts`` is a dict of keyword arguments to pass to the constructed
    ``util.socketobserver`` instance.

    ``sendaccept`` allows controlling whether the ``Accept`` request header
    is sent. The header is sent by default.
    shttpstimeoutr�NrrArBrCcsg|]}|����qSrr)rPr���passmgrrrrrR�szopener.<locals>.<listcomp>s"mercurial/proto-1.0 (Mercurial %s)z
User-agent)�Acceptzapplication/mercurial-0.1)�
configwith�float�appendr�r��	has_httpsr�rLrr�rFr r1rDr[rr��handlerfuncsrr`�buildopener�
requestscount�sentbytescount�receivedbytescountr
r�r
�sysstrr�)rr<�	useragent�	loggingfh�loggingname�loggingopts�
sendacceptr��handlersr!�urisr#r$�	saveduser�	savedpass�opener�agentrr%rr;HsN��	���
r;cCstt�|�}|jr|j��|_|��\}}nt�t�|��}dt�	t
�t�|���}d}t
|||d��t�|�|�S)Nsfile://)r6)rr2r�rNr<r
�normpath�abspathr
r+r`�pathname2urlrr;rr-)r�url_rrr6r@r<�pathrrrr�s
�
�rcs&|j�G�fdd�d|j�}||_dS)z�Wrap a response object with common error handlers.

    This ensures that any I/O from any consumer raises the appropriate
    error and messaging.
    cseZdZd�fdd�	ZdS)z!wrapresponse.<locals>.readerproxyNc
s�z�|�WStjy5}z#|jr$t|j�}|j|}td�||f}ntd�}tj|td�d��d}~wtjyN}z
tjtd�|td�d��d}~ww)NsBHTTP request error (incomplete response; expected %d bytes got %d)s(HTTP request error (incomplete response)svthis may be an intermittent network failure; if the error persists, consider contacting the network or server operator)�hintsHTTP request error (%s))	r��IncompleteRead�expectedrD�partialrr�PeerTransportError�
HTTPException)r�sizerm�got�totalrE��origreadrr�read�s8


�����
����z&wrapresponse.<locals>.readerproxy.readr)rHrIrJrMrrKrr�readerproxy�srNN)rMr�)�resprNrrKr�wrapresponse�s
"rPr)NNNr$NT)NT)2�
__future__rrr�r��i18nrr
r�rrrr.r	rrr
�utilsrrr�r��urlerrr`r�objectrrLrw�safehasattrr+r{r�r�r�r�r�r�r�r�r�r�r�basehandlerrr,r;rrPrrrr�<module>sN	(

A>d	$01%
�
a

https://t.me/RX1948 - 2025