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/hgext/lfs/wireprotolfsserver.pyc
�
1�3\c@@s�ddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
ejZejZejZejZejZejZejZd�Zdd�Zd	�Zd
�Zd�Zd�ZdS(
i(tabsolute_importN(tcommon(tpycompattutili(t	blobstorec@sO|��|��rtS�jjjdd�s5tStj�jjd�sQtS�js^tSyq�jdkr����d�t	�j�|�S�jj
d�r�t�j�|���fd��StSWnytj
k
rJ}x$|jD]\}}||j|<q�Wtj|jtj|��|_|jdtj|��tSXd	S(
s�Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS
    request if it is left unprocessed by the wrapped method.
    texperimentals	lfs.servetlfslocalblobstores.git/info/lfs/objects/batchtpulls.hg/lfs/objectsc@s���|�S(N((tperm(t	checkpermtrctxtreq(sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyt<lambda>:ss0
%s
N(tTruetrepotuit
configbooltFalseRtsafehasattrtsvfstdispatchpatht_processbatchrequestt
startswitht_processbasictransferthgwebcommont
ErrorResponsetheaderst
statusmessagetcodeRtbytestrtstatustsetbodybytes(torigR
RtresR	tetktv((R	R
RsB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pythandlewsgirequest"s,	!cC@s6tj|d|�|_d|jd<|jd�dS(Ntmessagestext/plain; charset=utf-8sContent-Typet(RRRRR(R!RR&((sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyt
_sethttperrorGs
cC@smtjtj��}|jd}d}|jrA||j7}n|d|j7}|jd||f�dS(s=Write information about the current exception to wsgi.errors.swsgi.errorsR't/s4Exception happened while processing request '%s':
%sN(Rtsysbytest	tracebackt
format_exctrawenvtapppathRtwrite(Rttbterrorlogturi((sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyt
_logexceptionLs
		c	C@sx|jdkr t|t�tS|jddkrDt|t�tS|jddkrht|t�tStj|j	j
��}d|jddg�kr�t|td�tS|jd�}|dkr�t|td|�tS|j
j}gt||jdg�||�D]}|^q}idd
6|d6}tjt�|_d|jd<|jtjtj|���tS(s�Handle a request for the Batch API, which is the gateway to granting file
    access.

    https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
    tPOSTsContent-Typesapplication/vnd.git-lfs+jsontAccepttbasict	transferss0Only the basic LFS transfer handler is supportedt	operationtuploadtdownloads&Unsupported LFS transfer operation: %stobjectsttransfer(R9R:(tmethodR(tHTTP_METHOD_NOT_ALLOWEDR
RtHTTP_UNSUPPORTED_MEDIA_TYPEtHTTP_NOT_ACCEPTABLEtjsontloadstbodyfhtreadtgettHTTP_BAD_REQUESTRRt_batchresponseobjectsRRtHTTP_OKRRRRtdumps(	RRR!tlfsreqR8t
localstoretpR;trsp((sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyRYs:


		

c#@s�x�|D]�}|jd�jd�}i|d6|jd�d6}t}t}y5|j|�}|r�|dkr�|j|�nWnatk
r�}	|	jtjkr�t	��idd6|	j
p�dd6|d	<|Vqnt}nX|d
krH|sidd6dd6|d	<|VqqY|sYid
d6dd6|d	<|VqqYn|rY|Vqntjj�tj
dd�}
�fd�}iid�j�j|fd6|
jd�d6|�d6d|6|d<|VqWdS(s4Yield one dictionary of attributes for the Batch API response for each
    object in the list.

    req: The parsedrequest for the Batch API request
    objects: The list of objects in the Batch API object request list
    action: 'upload' or 'download'
    store: The local blob store for servicing requeststoidtasciitsizeR9i�RsInternal Server ServerR&terrorR:i�sThe object does not existi�sThe object is corrupttminutesi
c@sBidd6}�jjdd�}|jd�r>||d<n|S(Nsapplication/vnd.git-lfsR5t
AuthorizationR'sBasic (RRER(thdrtauth(R(sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyt_buildheader�s

s%s%s/.hg/lfs/objects/%sthrefs%Y-%m-%dT%H:%M:%SZt
expires_attheaders%stactionsN(REtencodeR
RtverifytlinkfromusercachetIOErrorterrnotENOENTR3tstrerrortdatetimetnowt	timedeltatbaseurlR.tstrftime(RR;tactiontstoretobjRNRMtexiststverifiestinstt	expiresatRV((RsB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyRG�sZ
	

	c	C@s�|j}|jd}|jj}t|j�dkrHt|t�tS|dkr�|d�|j|�}t	j
}y2|j||j�||r�t
nt�|_Wn0tjk
r�t|�|dd�|_nXd|jd<|jd	�tS|d
kr�|d�t	j
t
�|_d|jd<y|j|j|��Wn@tjk
r�t|�t	j
dd�|_|jd	�nXtSt|td
d|�tSdS(spHandle a single file upload (PUT) or download (GET) action for the Basic
    Transfer Adapter.

    After determining if the request is for an upload or download, the access
    must be checked by calling ``checkperm()`` with either 'pull' or 'upload'
    before accessing the files.

    https://github.com/git-lfs/git-lfs/blob/master/docs/api/basic-transfers.md
    i����itPUTR9i�scorrupt blobstext/plain; charset=utf-8sContent-TypeR'tGETRsapplication/octet-streamR&s#Unsupported LFS transfer method: %sN(R=t
dispatchpartsRRtlenR(tHTTP_NOT_FOUNDR
thasRRR:RCRHtHTTP_CREATEDRRtLfsCorruptionErrorR3RRRDR>(	RRR!R	R=RNRKtexistedR((sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyRsB	


	





(t
__future__RRbR_RAR+tmercurial.hgwebRRt	mercurialRRR'RRHRtRFRrR>R@R?R%tNoneR(R3RRGR(((sB/usr/lib64/python2.7/site-packages/hgext/lfs/wireprotolfsserver.pyt<module>s(								%	
	E	u