Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/httppeer.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s
ddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZd�Zde
jfd��YZdefd��YZd	�ZdS(
i�(tnullid(t_Nccs�tj�}yEx>tj|�D]-}x$|rK|j|d�V|j}q(WqWWn)tjk
r|tdt
d���nX|j�VdS(Niisconnection ended unexpectedlyi(tzlibt
decompressobjtutilt
filechunkitert
decompresstunconsumed_tailthttplibt
HTTPExceptiontIOErrortNoneRtflush(tftzdtchunk((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt
zgenerators	thttppeercBskeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cCs�||_d|_d|_d|_tj|�}|jsE|jrmtj	t
d�|jpc|j��n|j�\|_}||_
|j
jd|j�tj||�|_dS(Nsunsupported URL component: "%s"s	using %s
(tpathRtcapsthandlert	urlopenerRturltquerytfragmenttAbortRtauthinfot_urltuitdebugtopener(tselfRRtuR((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt__init__s					cCsG|jrCx7|jjD]&}|j�t|dd���qWndS(Nt	close_allcSsdS(N(R(((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt<lambda>1s(Rthandlerstclosetgetattr(Rth((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt__del__-s	
cCs|jS(N(R(R((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyR3scCs"t|jd�j��|_dS(Ntcapabilities(tsett_calltsplitR(R((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt
_fetchcaps8scCss|jdkrly|j�Wn tjk
r?t�|_nX|jjddj|jpadg��n|jS(Nscapabilities: %s
t tnone(	RRR-terrort	RepoErrorR*RRtjoin(R((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt
_capabilities;s cCstjtd���dS(Ns!operation not supported over http(RRR(R((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pytlockEscKs�|dkrd|d<n|jdd�}d}tj|d�rO|j}n|dk	rjt|�}n|jdi�}|dk	r�d|kr�d|d<n|r�|jjd	d
t�r�d|d<d
|d<n|jj	d|�d|fg}d}t|�dkrE|j
d�}|rEt|jd�d�}qEn|dkr(t
jt|j���}	d}
|t|
dd�}d}xOtdt|	�|�D]5}
|d7}|
t|�}|	|
|
|!||<q�Wgtd|d�D]}|
t|�^q�dj|�|d<n|t|j��7}dt
j|�}d|j|f}tj|||�}|dk	r�|jj	d|�|jdd|�ny|jj|�}Wn�tjk
r}|jdkrtjtd���n�nktj k
rM}|jj	d|�|jj!�t"d|��n&t#k
rrtjtd ���nX|j$�}|j%|�r�|t|� }n|jj&d!�|j&d!�kr�jj's�jj(td"�|�q�||_y|j)d#�}Wn&t*k
r3|j+j,d#d�}nXtj-|j�}|j.d$�rmt/j0|j1���n|j.d%�p�|j.d&�r�|j+j,d'�p�|j.d(�s�jj	d)tj-|��t/j2td*�||p�+|j1d,�f��n|j.d%�r�yH|jd-d�d}t3g|jd.�D]}t|�^q9�}Wn0t4k
r�t/j2td/�||f��nX|d1kr�t/j2td0�||f��q�n|S(2NtpushkeyttdataitlengththeaderssContent-Typesapplication/mercurial-0.1Rtusehttp2s100-ContinuetExpectt1s	X-HgHttp2ssending %s command
tcmdt
httpheadert,s
X-HgArg-%st000s: 
itVarys?%ss%s%sssending %s bytes
sContent-Lengths%di�sauthorization faileds$http error while sending %s command
s,http error, possibly caused by proxy settingt/sreal URL is %s
scontent-typesapplication/hg-errorsapplication/mercurial-s
text/plainscontent-lengthsapplication/hg-changegroupsrequested URL: '%s'
sI'%s' does not appear to be an hg repository:
---%%<--- (%s)
%s
---%%<---
sno content-typeit-t.s+'%s' sent a broken Content-Type header (%s)s'%s' uses newer protocol %s(ii(5tpopRRtsafehasattrR8tlenRt
configbooltFalseRtcapabletintR,turllibt	urlencodetsortedtitemstxrangetstrtrangeR2Rturllib2tRequesttadd_unredirected_headerRtopent	HTTPErrortcodeRRRR	t	tracebackR
t
IndexErrortgeturltendswithtrstriptquiettwarnt	getheadertAttributeErrorR9tgetthidepasswordt
startswithR0tOutOfBandErrortreadR1ttuplet
ValueError(RR=targsR7tsizeR9tqt
headersizeR>tencargst	headerfmtt
contentlent	headernumtitheaderR'tvaryheaderstqstcutreqtresptinsttresp_urltprototsafeurltversiontntversion_info((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt_callstreamHs�




0

! 	
	%2
cKs2|j||�}z|j�SWd|j�XdS(N(RRfR%(RR=Ritfp((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyR+�sc
Ks�|jd�}y|jd�}Wntk
r>dg}nXx'|D]}|tjkrF|}PqFqFWtj|d|�}tj|j	|d�}idd6}	z�ye|j
|d|d|	|�}
|
jd	d
�}t|�dkrtj
td�|
��n|SWnntjk
r{}|jd
tjtjfkrbtjtd�|jd
��ntj|jd
��nXWd|j�tj|�XdS(NtunbundleR?R6trbsapplication/mercurial-0.1sContent-TypeR7R9s
iisunexpected response:ispush failed: %s(RJR,RatchangegrouptbundletypestwritebundleRthttpconnectionthttpsendfileRR+RGR0t
ResponseErrorRtsocketRiterrnot
ECONNRESETtEPIPERRR%tostunlink(
RR=tcgRittypestxttypettempnameR�R9trtvalsterr((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt	_callpush�s2



#
cCs
|�dS(N((Rt	exception((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt_abort�scCstjt|��S(N(RtchunkbufferR(Rtstream((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt_decompress�s(
t__name__t
__module__R!R(RR-R3R4RR+R�R�R�(((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyRs					
		b		$	t	httpspeercBseZd�ZRS(cCs8tjs!tjtd���ntj|||�dS(Ns1Python support for SSL and HTTPS is not installed(Rt	has_httpsRRRRR!(RRR((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyR!�s	(R�R�R!(((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyR��scCs�|rtjtd���nys|jd�rBt||�}nt||�}y|j�Wn*tjk
r�|j	t
t
fg�nX|SWnatjk
r�y.tj|d||�}|j
d�|SWq�jk
r�|�q�XdS(Ns!cannot create new http repositoryshttps:sstatic-s(falling back to static-http)
(RRRRdR�RR-R0R1tbetweenRtstatichttprepotinstancetnote(RRtcreateRxt
httpexceptionR�((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyR��s$
(tnodeRti18nRR�R�R0R�RRt	wireprotoR�RLRSRRR�R�RtwirepeerRR�R�(((s6/sys/lib/python2.7/site-packages/mercurial/httppeer.pyt<module>	sT<	�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.