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__/wireprotoserver.cpython-310.pyc
o

�]Lb�E�@s(ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZmZejZejZejZdZd	Zd
ZdZejZdd
�Ze�ej�Gdd�de��Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&e�ej�Gdd�de��Z'd d!�Z(Gd"d#�d#e�Z)dS)$�)�absolute_importN�)�_)�encoding�error�pycompat�util�wireprototypes�wireprotov1server)r)�compression�
stringutil��sapplication/mercurial-0.1sapplication/mercurial-0.2sapplication/hg-errorcCsLg}d}	|j�d||f�}|durn
|�t�|��|d7}qd�|�S)zjDecode a long value from multiple HTTP request headers.

    Returns the value as a bytes, not a str.
    rTs%s-%dN�)�headers�get�appendr�bytesurl�join)�req�headerprefix�chunks�i�v�r�;/usr/lib/python3/dist-packages/mercurial/wireprotoserver.py�decodevaluefromheaders*s�
rc@sfeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	e
jd
d��Zdd�Z
dd�Zdd�ZdS)�httpv1protocolhandlercCs||_||_||_d|_dS�N)�_req�_ui�
_checkperm�
_protocaps)�selfr�ui�	checkpermrrr�__init__=s
zhttpv1protocolhandler.__init__cCsdS)Nshttp-v1r�r"rrr�nameCszhttpv1protocolhandler.namecs�|��}i�|��}|D],}|dkr0i}|��D]}|dkr*||vr*||d||<q|�d<q||d�|<q�fdd�|D�S)N�*�cmdrc�g|]}�|�qSrr��.0�k��datarr�
<listcomp>T�z1httpv1protocolhandler.getargs.<locals>.<listcomp>)�_args�split�keys)r"�args�	knownargsr4r-�star�keyrr.r�getargsGs�
zhttpv1protocolhandler.getargscCsj|jj��}t|jj�dd��}|r#|�tj|jj	�
|�dd��|St|jd�}|�tj|dd��|S)N�
X-HgArgs-PostrT)�keep_blank_valuessX-HgArg)r�qsparams�
asdictoflists�intrr�update�urlreq�parseqs�bodyfh�readr)r"r5�postlen�argvaluerrrr2Vs��zhttpv1protocolhandler._argscCs,|jdurt|jd�}t|�d��|_|jS)Ns	X-HgProto� )r!rr�setr3)r"�valuerrr�getprotocapses
z"httpv1protocolhandler.getprotocapscCs:t|jjd�}|t|jj�dd��8}tj|jj|d�S)NsContent-Lengthr:r)�limit)r>rrrr�
filechunkiterrB)r"�lengthrrr�
getpayloadksz httpv1protocolhandler.getpayloadccsZ�|jj}|jj}t��}z||j_||j_|VW||j_||j_dS||j_||j_wr)r�fout�ferrr�stringio)r"�oldout�olderr�outrrr�mayberedirectstdiots��
z(httpv1protocolhandler.mayberedirectstdiocCs.d|jjt�|jjpd�t�|jjpd�fS)Nsremote:%s:%s:%sr)r�	urlschemer@�quote�
remotehost�
remoteuserr&rrr�client�s
�zhttpv1protocolhandler.clientcCs~|�d�|�d|j�dd��|j�dd�r|�d�|�d�t�|jtj�}|r=d�d	d
�|D��}|�d|�|S)N�batchs
httpheader=%d�serversmaxhttpheaderlensexperimentalshttppostargsshttpmediatype=0.1rx,0.1tx,0.2tx�,css �|]}t�|��j�VqdSr)r@rV�wireprotosupportr')r,�errr�	<genexpr>�s�
�z8httpv1protocolhandler.addcapabilities.<locals>.<genexpr>scompression=%s)	rr#�	configint�
configboolr	�supportedcompenginesr�
SERVERROLEr)r"�repo�caps�compengines�	comptypesrrr�addcapabilities�s 
�

�
�z%httpv1protocolhandler.addcapabilitiescCs
|�|�Sr)r �r"�permrrrr$��
zhttpv1protocolhandler.checkpermN)�__name__�
__module__�__qualname__r%�propertyr'r9r2rIrM�
contextlib�contextmanagerrTrYrhr$rrrrr;s
	
rcCs
|tjvSr)r
�commands)�cmdrrr�iscmd�rkrtc
sddlm}�j}d�jvrdS�jd}t|�sdS�jr2|�d�|_t|j	d<|�
dd�d	St�|j���fd
d��}zt
|�|||�Wd	S|jy�}z)|j	D]	\}	}
|
|j	|	<qV|�|jt�|��|_|�
dt�|��WYd}~d	Sd}~ww)
a�Possibly process a wire protocol request.

    If the current request is a wire protocol request, the request is
    processed by this function.

    ``req`` is a ``parsedrequest`` instance.
    ``res`` is a ``wsgiresponse`` instance.

    Returns a bool indicating if the request was serviced. If set, the caller
    should stop processing the request, as a response has already been issued.
    r��commonr)Fi��Content-Type�0
%s
s	Not FoundTcs���|�Srr)rj�r$�rctxrrr�<lambda>�sz#handlewsgirequest.<locals>.<lambda>N)�hgwebrvrdr<rt�dispatchpath�
statusmessage�status�HGTYPEr�setbodybytesrr#�	_callhttp�
ErrorResponse�coder�forcebytestr)rzr�resr$�hgwebcommonrdrs�protor^r-rrryr�handlewsgirequest�s8


	
�����r�cCs�d|��vr@|rtt��ifSt�|�}t�|tj�D]$}|�	�j
|vr?i}|�dd|�
��}|dur8||d<t||fSqd|�dd�i}tt
jd|fS)z�Determine the appropriate response type and compression settings.

    Returns a tuple of (mediatype, compengine, engineopts).
    s0.2r[s%slevelNslevels	zliblevelszlib)rI�HGTYPE2r�_noopenginer
�clientcompressionsupportr	rbrcr]r'r`r�rrf)r#r��prefer_uncompressed�compformats�engine�opts�levelrrr�_httpresponsetype�s 
��r�cs�ddlm�dd�}d��fdd�	}tj�||�s#|tttd��dS|�tj|j	�t�
|||�}t|t�rA|tt
|d�dSt|tj�rQ|tt
|jd�dSt|tj�ra|tt
|jd	�dSt|tj�r�|j}t|j||j�\}	}
}|
�||�}|	tkr�|||
|�}|t|	|d	�dSt|tj�r�d
|j|jf}|tt
|d�dSt|tj�r�d|j}d�_|tt
|d�dSt|tj�r�|tt|jd�dSt �!d
|��)NrrucssX�|��j}dt|�krdksJ�J�t�dt|��V|V|D]}|Vq$dS)Nr��B)r]r'�len�struct�pack)�genr��
engineoptsr'�chunkrrr�genversion2s�
 �z_callhttp.<locals>.genversion2csR|tkrd�_n��|��_|�jd<|dur��|�|dur'��|�dSdS)Ns200 Script output followsrw)�HTTP_OKrr~rr��
setbodygen)r��contenttype�	bodybytes�bodygen�r�r�rr�setresponse's

�z_callhttp.<locals>.setresponses:requested wire protocol command is not available over HTTP)r�)r�s%d
%srxTshgweb.protocol internal failure)NN)"r|rvr
rr�commandavailabler��	HGERRTYPErr$�
permission�dispatch�
isinstance�bytesr�r	�
bytesresponser/�streamreslegacyr��	streamresr�r#r��compressstreamr��pushresr��output�pusherr�drain�ooberror�messager�ProgrammingError)rdrr�r�rsr�r��rspr��	mediatyper�r�rr�rr�sN
��


�
r�cCs(|�dt|��|�|�|��dS)z-Send a bytes response for protocol version 1.s%d
N)�writer��flush)rNrHrrr�_sshv1respondbytesds
r�cCs&|j}|jD]}||�q|��dSr)r�r�r�)rN�sourcer�r�rrr�_sshv1respondstreamks

r�cCs,|�d|�|��|�d�|��dS)Ns%s
-
�
)r�r�)rNrOr�rrr�_sshv1respondooberrorrs
r�c@sbeZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	e
jdd
��Zdd�Z
dd�Zdd�ZdS)�sshv1protocolhandlerz<Handler for requests services via version 1 of SSH protocol.cCs||_||_||_t�|_dSr)r�_fin�_foutrGr!)r"r#�finrNrrrr%}szsshv1protocolhandler.__init__cCstjSr)r	�SSHV1r&rrrr'�szsshv1protocolhandler.namec
s�i�|��}t�t|��D]Z}|j��dd�}|��\}}||vr+t�td�|��|dkr[i}t�t	|��D]}|j��dd�}|��\}}|j�
t	|��}	|	||<q8|�d<q
|j�
t	|��}	|	�|<q
�fdd�|D�S)N���sunexpected parameter %rr(cr*rrr+r.rrr0�r1z0sshv1protocolhandler.getargs.<locals>.<listcomp>)r3r�xranger�r��readliner�Abortrr>rC)
r"r5r4�n�argline�arg�lr7r-�valrr.rr9�s$


zsshv1protocolhandler.getargscCs|jSr)r!r&rrrrI�sz!sshv1protocolhandler.getprotocapsccsH�t|jd�t|j���}|r"|j�|�Vt|j���}|sdSdS)Nr)r�r�r>r�r�rC)r"�countrrrrM�s��zsshv1protocolhandler.getpayloadccs�dVdSrrr&rrrrT�s�
z'sshv1protocolhandler.mayberedirectstdiocCs"tj�dd��dd�d}d|S)Ns
SSH_CLIENTrrFrrsremote:ssh:)r�environrr3)r"rYrrrrY�szsshv1protocolhandler.clientcCs$|jtjkr|�d�|�d�|S)Ns	protocapsrZ)r'r	r�r)r"rdrerrrrh�s

z$sshv1protocolhandler.addcapabilitiescCsdSrrrirrrr$�szsshv1protocolhandler.checkpermN)rlrmrn�__doc__r%ror'r9rIrMrprqrTrYrhr$rrrrr�ys

r�c
Csvd}t|||�}|��s�|dkr�|��dd�}|sd}qtj�||�}|s,t|d�qt�|||�}	|jj	�
�|jj�
�t|	t
�rJt||	�nit|	tj�rWt||	j�n\t|	tj�rct||	�nPt|	tj�rot||	�nDt|	tj�r�t|d�t|d|	j�n0t|	tj�r�t||	j�n#t|	tj�r�t||j|	j�nt�d|	��|dkr�dSt�d|��|��rdSdS)Nsprotov1-servingr�sshutdownrs%ds6unhandled response type from wire protocol command: %ssunhandled ssh server state: %s)r��is_setr�r
rrr�r�r�r#rNr�rOr�r�r	r�r/r�r�r�r�r�r�r�r�r�rr�)
r#rdr�rN�ev�stater��request�	availabler�rrr�
_runsshserver�sV�


����r�c@s&eZdZddd�Zdd�Zdd�ZdS)	�	sshserverNcCsT||_||_|��\|_|_|r(tj||jddd�|_tj||jddd�|_dSdS)N�oT)�logdata�e)r�_repo�
protectfinoutr�r�r�makeloggingfileobjectrO)r"r#rd�logfhrrrr%
s
�
��zsshserver.__init__cCs$|�t���|j�|j|j�dSr)�
serveuntil�	threading�Eventr�
restorefinoutr�r�r&rrr�
serve_foreverszsshserver.serve_forevercCst|j|j|j|j|�dS)z%Serve until a threading.Event is set.N)r�rr�r�r�)r"r�rrrr�szsshserver.serveuntilr)rlrmrnr%r�r�rrrrr�s
r�)*�
__future__rrpr�r��i18nr�rrrrr	r
�
interfaces�
interfaceutil�utilsrrrP�urlerrr@r�r�r�r�r�r�implementer�baseprotocolhandler�objectrrtr�r�r�r�r�r�r�r�r�rrrr�<module>s< 
nF$L
GK

https://t.me/RX1948 - 2025