HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyc
�
1�3\c@@sddlmZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZmZd�Zd�Zd	efd
��YZd�Zdd�Zd
�Zd�Zdejfd��YZdefd��YZed�Zddd�ZdS(i(tabsolute_importNi(t_(terrortpycompattutiltwireprotoservertwireprototypestwireprotov1peertwireprotov1server(tprocutilt
stringutilcC@s4|s
|Stjd|�r |Sd|jdd�S(s=quote a string for the remote shell ... which we assume is shs[a-zA-Z0-9@%_+=:,./-]*$s'%s't's'\''(tretmatchtreplace(ts((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_serverquotes
cC@sU|rQtj|�}|rQx0|j�D]}|jtd�|d�q(WqQndS(sYdisplay all data currently available on pipe as remote output.

    This is non blocking.sremote: s
N(R	treadpipet
splitlineststatusR(tuitpipeRtl((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_forwardoutput$s
t
doublepipecB@sbeZdZd�Zd�Zd�Zd�Zd�Zd�Zd
d�Z
d�Zd	�ZRS(s3Operate a side-channel pipe in addition of a main one

    The side-channel pipe contains server output to be forwarded to the user
    input. The double pipe will behave as the "main" pipe, but will ensure the
    content of the "side" pipe is properly processed while we wait for blocking
    call on the "main" pipe.

    If large amounts of data are read from "main", the forward will cease after
    the first bytes start to appear. This simplifies the implementation
    without affecting actual output of sshpeer too much as we rarely issue
    large read for data not yet emitted by the server.

    The main pipe is expected to be a 'bufferedinputpipe' from the util module
    that handle all the os specific bits. This class lives in this module
    because it focus on behavior specific to the ssh protocol.cC@s||_||_||_dS(N(t_uit_maint_side(tselfRtmaintside((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt__init__?s		cC@s�t|jtj�r+|jjr+ttfS|jj�|jj�g}ytj|�}Wnt	k
ru|}nX|jj�|k|jj�|kfS(s�wait until some data are available on main or side

        return a pair of boolean (ismainready, issideready)

        (This will only wait for data if the setup is supported by `util.poll`)
        (
t
isinstanceRRtbufferedinputpipet	hasbuffertTruetfilenoRtpolltNotImplementedError(Rtfdstact((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_waitDs


cC@s|jd|�S(Ntwrite(t_call(Rtdata((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR*XscC@s?|jd|�}|dkr;|r;t|j|j�n|S(Ntreadi(R+RRR(Rtsizetr((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR-[scC@s?|jd|�}|dkr;|r;t|j|j�n|S(Ntunbufferedreadi(R+RRR(RR.R/((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR0fscC@s
|jd�S(Ntreadline(R+(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR1qscC@s�|dk	r|s|jjr6t|j|j�dSxptr�|j�\}}|rmt|j|j�n|r9t|j|�}|dkr�|�S||�Sq9q9WdS(sKcall <methname> on "main", forward output of "side" while blocking
        tN(	tNoneRtclosedRRRR#R)tgetattr(RtmethnameR,t	mainreadyt	sidereadytmeth((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR+ts	cC@s
|jj�S(N(Rtclose(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR:�scC@s
|jj�S(N(Rtflush(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR;�sN(
t__name__t
__module__t__doc__RR)R*R-R0R1R3R+R:R;(((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR.s							cC@s�|r|j�n|r&|j�n|r~y+x$|D]}|jtd�|�q6WWnttfk
rpnX|j�ndS(s)Clean up pipes used by an SSH connection.sremote: N(R:RRtIOErrort
ValueError(RtpipeitpipeotpipeeR((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt
_cleanuppipes�s


cC@s�d||tjdt|�t|�f�f}|jd|�tj|�}tj|ddd|�\}}}	}
|
|||	fS(s�Create an SSH connection to a server.

    Returns a tuple of (process, stdin, stdout, stderr) for the
    spawned process.
    s%s %s %ss%s -R %s serve --stdiosrunning %s
tbufsizeitenv(R	t
shellquoteRtdebugtquotecommandtpopen4(Rtsshcmdtargst	remotecmdtpathtsshenvtcmdtstdintstdouttstderrtproc((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_makeconnection�s	 'cC@sXdh}gtjjtj�D]}|j�j^q}|jddj|��|S(swReturn list of capabilities of this client.

    Returns a list of capabilities that are supported by this client.
    spartial-pullscomp=%st,(Rtcompenginestsupportedwireenginest
CLIENTROLEtwireprotosupporttnametaddtjoin(tprotoparamstetcomps((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_clientcapabilities�s
	.c@s���fd�}�jdd�}tjttj���}dtjfg}tj	j
|�}y�dddddf}dd	d
t|�|g}	�jdd�r��jd
||f�|	j
dd||f�n|r
�jd��jdt|��n�jd��jd�|jdj|	��|j�Wntk
rb|�nXtj}
tjdtj|��}ddg}d}
x�|drq|
rqy�|j�}t���|j|�}|r|jd�}
�jd|
�Pn|ddkr"|dkr"Pn|r;�jd|�n|j|�|
d8}
Wq�tk
rm|�q�Xq�W|�t�}|
tjkr�x�t|�D]=}|jd�r�|j |d j!d�dj!��Pq�q�Wn�|
tjkr�|j�}yt"|�}Wnt#k
r'|�nX|j$|�}|jd �sP|�n�jd!|�|j |j!d�dj!��|j$d�n|s�|�nt���|
|fS("Nc@sDt���td�}�jdd�}tj|d|��dS(Ns#no suitable response from remote hgRtssherrorhintthint(RRtconfigRt	RepoError(tmsgRc(RSR(s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytbadresponse�s
tdevelsdebug.peer-requesttprotos%s-%st0i(shello
sbetween
s	pairs %d
texperimentalssshpeer.advertise-v2ssending upgrade request: %s %s
isupgrade %s %s
s"devel-peer-request: hello+between
s&devel-peer-request:   pairs: %d bytes
ssending hello command
ssending between command
R2s^upgraded %s (.*)$tdummyi�i����isprotocol upgraded to %s
s1
s
sremote: s
capabilities:t:scapabilities: sremote: %s
(%t
configboolRtsysbyteststrtuuidtuuid4RtSSHV2Rturlreqt	urlencodetlenRHtinsertR*R]R;R?RtSSHV1RtcompileR
treescapeR1RR
tgrouptappendtsettreversedt
startswithtupdatetsplittintR@R-(RRQRRRSRgt
requestlogttokentupgradecapstpairsargt	handshaket	protonamet
reupgradedtlinest	max_noiseRtmtcapstlinetvaluelentcapsline((RSRs7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_performhandshake�s�<
	



	


	$

 

t	sshv1peercB@s�eZed�ZdhZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
e
Zed�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zed�ZRS(c		C@s�||_||_||_|rQt|tj|�|�}t|||�}n||_||_||_||_	||_
dS(s�Create a peer from an existing SSH connection.

        ``proc`` is a handle on the underlying SSH process.
        ``stdin``, ``stdout``, and ``stderr`` are handles on the stdio
        pipes for that process.
        ``caps`` is a set of capabilities supported by the remote.
        ``autoreadstderr`` denotes whether to automatically read from
        stderr and to forward its output.
        N(t_urlRt_subprocessRRR!t_pipeot_pipeit_pipeet_capst_autoreadstderr(	RRturlRTRQRRRSR�tautoreadstderr((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyRos							tbatchcC@s|jS(N(R�(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR��scC@sdS(N(R3(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytlocal�scC@s|S(N((R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytpeer�scC@stS(N(R#(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytcanpush�scC@sdS(N((R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR:�scC@s|jS(N(R�(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytcapabilities�scC@st|j|j�dS(N(RRR�(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_readerr�scC@s|j�|�dS(N(t_cleanup(Rt	exception((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_abort�s
cC@s#t|j|j|j|j�dS(N(RDRR�R�R�(R((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR��scC@sS|jjr�|jjdd�r�|jj}d}|||�x�t|j��D]�\}}t|t�s�||d|t|�f�qTxAt|j��D]-\}}	||d||t|	�f�q�WqTWn|jjd|�|j	j
d|�tj|\}
}|j
�}i}
x=|D]5}|dkrO||
d<Pq/|||
|<||=q/Wx�t|
j��D]�\}}|j	j
d	|t|�f�t|t�rx]|j�D]<\}}	|j	j
d	|t|	�f�|j	j
|	�q�Wq{|j	j
|�q{W|j	j�|rL|j�}tj|j|�S|jS(
NRhsdebug.peer-requestsdevel-peer-request: %s
s  %s: %d bytess  %s-%s: %dssending %s command
s%s
t*s%s %d
(Rt	debugflagRnRHtsortedtitemsR tdictRvR�R*RtcommandsR�t	iteritemsR;t
_getamountRtcappedreaderR�(RRPRLtframedtdbgR�tkeytvaluetdktdvt_functnamestkeystwireargstktvtamount((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_sendrequest�sB!,

  
cK@s.tj|�}|j||d||jk�S(NR�(RtbyteskwargsR�t_FRAMED_COMMANDS(RRPRL((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_callstream�scK@s.tj|�}|j||d||jk�S(NR�(RR�R�R�(RRPRL((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_callcompressable�scK@s+tj|�}|j||dt�j�S(NR�(RR�R�R#R-(RRPRL((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR+�sc@s�|j||�}|r"d|fSx-t�fd�d�D]}|j|�q;W|jddt�|j�}|r�d|fS|j�dfS(NR2c@s
�jd�S(Ni(R-((tfp(s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt<lambda>�R2R;(R+titert_writeframedR#t_readframed(RRPR�RLR/td((R�s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt	_callpush�s

c@s~|j||�}|r4tjtd�|��nx-t�fd�d�D]}|j|�qMW|jddt�|jS(Nsunexpected remote reply: %sc@s
�jd�S(Ni(R-((R�(s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�R2R2R;(R+RtAbortRR�R�R#R�(RRPR�RLR/R�((R�s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt_calltwowaystreamscC@s�|jj�}|dkrY|jr1|j�ntd�}|jtjd|��n|jro|j�nyt|�SWn0t	k
r�|jtj
td�|��nXdS(Ns
scheck previous remote outputRcsunexpected response:(R�R1R�R�RR�RtOutOfBandErrorR�R@t
ResponseError(RRRf((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�s	
	

cC@s&|j�}|sdS|jj|�S(NR2(R�R�R-(RR.((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�#scC@sc|jjdt|��|r3|jj|�n|rI|jj�n|jr_|j�ndS(Ns%d
(R�R*RvR;R�R�(RR,R;((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�*s	(R<R=R#RR�R�R�R�R�R:R�R�R�R�t__del__tFalseR�R�R�R+R�R�R�R�R�(((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�ns*										,							t	sshv2peercB@seZdZRS(s9A peer that speakers version 2 of the transport protocol.(R<R=R>(((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyR�3sc	
C@s�yt||||�\}}Wn'tk
rHt||||��nX|tjkrzt|||||||d|�S|tjkr�t|||||||d|�St||||�tj	t
d�|��dS(s�Make a peer instance from existing pipes.

    ``path`` and ``proc`` are stored on the eventual peer instance and may
    not be used for anything meaningful.

    ``stdin``, ``stdout``, and ``stderr`` are the pipes connected to the
    SSH server's stdio handles.

    This function is factored out to allow creating peers that don't
    actually spawn a new process. It is useful for starting SSH protocol
    servers and clients via non-standard means, which can be useful for
    testing.
    R�s#unknown version of SSH protocol: %sN(R�t	ExceptionRDRRxR�RsR�RReR(	RRNRTRQRRRSR�R�R�((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytmakepeer9s
cC@sktj|dtdt�}|jdksC|jsC|jdkr_tjt	d�|��ntj
|�|jdk	r�tjt	d���n|jdd�}|jdd�}t
|jd��}tj|�}	|jp�d	}
tj||j|j|j�}|r�|r/tjt	d
���nd||tjdt|�t|
�f�f}|jd
|�|j|ddd|	�}
|
dkr�tjt	d���q�nt|||||
|	�\}}}}t||||||�}d|j�krgy)|jdddjtt����Wqgtk
rc|j �tjt	d���qgXn|S(siCreate an SSH peer.

    The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
    t
parsequeryt
parsefragmenttsshscouldn't parse location %sspassword in URL not supportedRRMROt.s8cannot create remote SSH repositories with extra optionss%s %s %ss
%s init %ssrunning %s
t
blockedtagtsshpeertenvironiscould not create remote repot	protocapsR�t scapability exchange failedN(!RR�R�tschemethostRNR3RReRtchecksafesshtpasswdRdR�tconfigitemsR	tshellenvirontsshargstusertportRGRRHtsystemRUR�R�R+R]R�RaR?R�(RRNtcreatetintentst
createoptstuRKRMt	sshaddenvROt
remotepathRLRPtresRTRQRRRSR�((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pytinstanceXsB(
!		 

( t
__future__RRRqti18nRR2RRRRRRRtutilsR	R
RRtobjectRRDR3RURaR�twirepeerR�R�R#R�R�(((s7/usr/lib64/python2.7/site-packages/mercurial/sshpeer.pyt<module>s 4			
^			��