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/hgext/lfs/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/hgext/lfs/__pycache__/wireprotolfsserver.cpython-310.pyc
o

�]Lb
/�@s�ddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZmZm
Z
ddlmZejZejZejZejZejZejZejZe
�
�Ze�e
d�dd	��Zdd
d�Zdd
�Zdd�Zdd�Zdd�ZdS)�)�absolute_importN)�common)�	exthelper�pycompat�util�wireprotoserver�)�	blobstoreshandlewsgirequestc
s|��|��r	dS�jj�dd�sdSt��jjd�sdS�js"dSz+�jdkr6���d�t�j�|�WS�j�d�rKt	�j�|���fd	d
��WSWdSt
jy�}z)|jD]	\}}||j|<qYt
�
|jt�|��|_|�dt�|��WYd}~dSd}~ww)
z�Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS
    request if it is left unprocessed by the wrapped method.
    Tsexperimentals	lfs.serveF�lfslocalblobstores.git/info/lfs/objects/batch�pulls.hg/lfs/objectscs���|�S�N�)�perm��	checkperm�rctx�reqr
�>/usr/lib/python3/dist-packages/hgext/lfs/wireprotolfsserver.py�<lambda>>sz#handlewsgirequest.<locals>.<lambda>s0
%s
N)�repo�ui�
configboolr�safehasattr�svfs�dispatchpath�_processbatchrequest�
startswith�_processbasictransfer�hgwebcommon�
ErrorResponse�headers�
statusmessage�coder�bytestr�status�setbodybytes)�origrr�resr�e�k�vr
rr�handlewsgirequest%s2
���r+cCs(tj||d�|_d|jd<|�d�dS)N��message�text/plain; charset=utf-8�Content-Type�)rr!r$r r%)r'r"r-r
r
r�
_sethttperrorLs
r1cCsPt�t���}|jd}d}|jr||j7}|d|j7}|�d||f�dS)z=Write information about the current exception to wsgi.errors.swsgi.errorsr0�/s4Exception happened while processing request '%s':
%sN)r�sysbytes�	traceback�
format_exc�rawenv�apppathr�write)r�tb�errorlog�urir
r
r�
_logexceptionRs


�r<cCs|jdkrt|t�dS|jddkrt|t�dS|jddkr(t|t�dSt�|j�	��}d|�
ddg�vrAt|td�dS|�
d	�}t�|�}|d
vrYt|td|�dS|j
j}dd
�t||�
dg�||�D�}d|d�}t�t�|_d|jd<|�t�t�|���dS)z�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
    sPOSTTr/sapplication/vnd.git-lfs+jsonsAccept�basic�	transferss0Only the basic LFS transfer handler is supported�	operation)�upload�downloads&Unsupported LFS transfer operation: %scSsg|]}|�qSr
r
)�.0�pr
r
r�
<listcomp>�s��z(_processbatchrequest.<locals>.<listcomp>�objects)�transferrE)�methodr1�HTTP_METHOD_NOT_ALLOWEDr �HTTP_UNSUPPORTED_MEDIA_TYPE�HTTP_NOT_ACCEPTABLEr�
json_loads�bodyfh�read�get�HTTP_BAD_REQUESTr#rr
�_batchresponseobjectsrr!�HTTP_OKr$r%�json�dumps)rrr'�lfsreqr?�
localstorerE�rspr
r
rrasN



�

����
rc
#sp�|D]�}|�d�}|�d�}||�d�d�}d}d}	z|�|�}	|	r,|dkr,|�|�Wn1ty^}
z%|
jtjkrRt��d|
jpDd	d
�|d<|VWYd}
~
qd}WYd}
~
nd}
~
ww|d
kr~|spddd
�|d<|Vq|	s}ddd
�|d<|Vqn|	r�|Vqt	j	�
�t	jdd�}�fdd�}dt�
|�t�
d�j�j|f�|�d�|�d�i|d<|VqdS)a4Yield 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 requests�oid�ascii�size)rWrYTFr@i�zInternal Server Server)r"r-�errorNrAi�zThe object does not exist�zThe object is corrupt�
)�minutescs2ddi}�j�dd�}|�d�rt�|�|d<|S)N�Acceptzapplication/vnd.git-lfss
Authorizationr0sBasic �
Authorization)r rNrr�strurl)�hdr�auth�rr
r�_buildheaders

z+_batchresponseobjects.<locals>._buildheaderz%ss%s%s/.hg/lfs/objects/%sz%Y-%m-%dT%H:%M:%SZ)�href�
expires_at�header�actions)rN�encode�verify�linkfromusercache�IOError�errno�ENOENTr<�strerror�datetime�now�	timedeltarr`�baseurlr7�strftime)
rrE�action�store�obj�soidrWrV�exists�verifies�inst�	expiresatrdr
rcrrP�sp�

�	

�
���
�
��
�����rPc	CsL|j}|jd}|jj}t|j�dkrt|t�dS|dkra|d�|�|�}tj	}z|�
||j|jd�||r;t
nt�|_WntjyTt|�|dd�|_Ynwd	|jd
<|�d�dS|dkr�|d
�t�	t
�|_d|jd
<z|�|�|��WdStjy�t|�t�	dd�|_|�d�YdSwt|td|d�dS)apHandle 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
    ����TsPUTr@sContent-Lengthr[scorrupt blobr.r/r0sGETrsapplication/octet-streams#Unsupported LFS transfer method: %sr,)rG�
dispatchpartsrr
�lenr1�HTTP_NOT_FOUND�hasrr!�downloadrLr rQ�HTTP_CREATEDr$r	�LfsCorruptionErrorr<r%rMrH)	rrr'rrGrWrU�existedr!r
r
rr*sN


�


��	�rr)�
__future__rrprmrRr4�mercurial.hgwebrr�	mercurialrrrr�r	rQr�rOr�rHrJrI�eh�wrapfunctionr+r1r<rrPrr
r
r
r�<module>s.


&Rw

https://t.me/RX1948 - 2025