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: //usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyo
�
1�3\c@@sUddlmZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
e
jZdZdZ
dZdZd	Zd
ZdZdZd
ZdZdZd�Zd�ZegZdefd��YZdefd��YZd�Zdd�Z d�Z!d�Z"d�Z#d�Z$dd�Z%d�Z&d�Z'dS(i(tabsolute_importNi(tencodingtpycompattutili�i�i0i�i�i�i�i�i�i�i�cC@s|dgkp||kS(s�Check if username is a member of userlist.

    If userlist has a single '*' member, all users are considered members.
    Can be overridden by extensions to provide more complex authorization
    schemes.
    t*((tuitusernametuserlist((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pytismember&sc	C@s�|j}|jdd�}|rR|s@t|jj||�rRttd��n|jdd�}|r�t|jj||�r�ttd��n|dkr�|jr�ttd��n|dks�|dkr�dS|dkr|j	d	kr6d
}tt
|��q6n'|j	dkr6d}tt
|��n|jdd
�ri|jdkritt
d��n|jdd�}|r�|s�t|jj||�r�ttd��n|jdd�}|o�t|jj||�s�ttd��ndS(s�Check permission for operation based on request data (including
    authentication info). Return if op allowed, else raise an ErrorResponse
    exception.twebt	deny_readsread not authorizedt
allow_readtpullspull not authorizedNtuploadtPUTsupload requires PUT requesttPOSTspush requires POST requesttpush_sslthttpssssl requiredt	deny_pushspush not authorizeds
allow-push(t
remoteusert
configlistRtrepoRt
ErrorResponsetHTTP_UNAUTHORIZEDt	allowpulltNonetmethodtHTTP_METHOD_NOT_ALLOWEDt
configboolt	urlschemetHTTP_FORBIDDEN(	thgwebtreqtoptuserR
Rtmsgtdenytallow((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt
checkauthz/s4	%!%RcB@seZddd�ZRS(cC@s_|dkrt|�}ntj|tj|��||_|dkrRg}n||_dS(N(Rt_statusmessaget	Exceptiont__init__Rtsysstrtcodetheaders(tselfR+tmessageR,((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyR)es		N(t__name__t
__module__RR)(((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyRdstcontinuereadercB@s,eZdZd�Zdd�Zd�ZRS(s.File object wrapper to handle HTTP 100-continue.

    This is used by servers so they automatically handle Expect: 100-continue
    request headers. On first read of the request body, the 100 Continue
    response is sent. This should trigger the client into actually sending
    the request body.
    cC@s||_||_t|_dS(N(tft_writetFalset	continued(R-R2twrite((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyR)vs		i����cC@s2|js"t|_|jd�n|jj|�S(NsHTTP/1.1 100 Continue

(R5tTrueR3R2tread(R-tamt((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyR8{s		cC@s&|dkrt|j|�St�dS(Ntclosetreadlinet	readlinest__iter__(R:R;R<R=(tgetattrR2tAttributeError(R-tattr((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt__getattr__�s(R/R0t__doc__R)R8RA(((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyR1ns	cC@s)tjj}tj|j|d�d�S(NtErrors
Unknown errori(RCs
Unknown error(t
httpservertbasehttprequesthandlert	responsesRtbytesurltget(R+RF((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyR'�scC@sd||pt|�fS(Ns%d %s(R'(R+R.((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt
statusmessage�scC@sEtjj||�}tjj|�r4tj|�Stj|�SdS(s%stat fn if it exists, spath otherwiseN(tostpathtjointexistststat(tspathtfntcl_path((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pytget_stat�s
cC@st|d�tjS(Ns
00changelog.i(RRRNtST_MTIME(RO((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt	get_mtime�scC@sp|jd�}xZ|D]R}|dtjtjfksdtj|ksdtjdk	rtj|krtSqWtS(s9Determine if a path is safe to use for filesystem access.t/tN(	tsplitRtoscurdirtospardirtosseptosaltsepRR4R7(RKtpartstpart((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt
ispathsafe�s
c
C@sut|�sdStjj|jd��}t|t�rF|g}nx9|D]1}tjj||�}tjj|�rMPqMqMWy~tj|�t	j
tjt	j
|��dp�d�}t|d��}|j�}WdQX||jd<|j|�|SWnntk
r"ttd��nOtk
rp}	|	jtjkrRtt��qqtttj|	j���nXdS(s+return a file inside directory with guessed Content-Type header

    fname always uses '/' as directory separator and isn't allowed to
    contain unusual path components.
    Content-Type is guessed using the mimetypes module.
    Return an empty string if fname is illegal or file not found.

    NRUis
text/plaintrbsContent-Typesillegal filename(R^RJRKRLRWt
isinstancetstrRMRNRtsysbytest	mimetypest
guess_typetfsdecodetopenR8R,tsetbodybytest	TypeErrorRtHTTP_SERVER_ERRORtOSErrorterrnotENOENTtHTTP_NOT_FOUNDRt
strtolocaltstrerror(
t	directorytfnametrestfpathtdRKtcttfhtdataterr((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt
staticfile�s2	

%


cc@s�|r/|r/|||}|||d@}nd}d}x>tr{|V|d7}|r>||kr>d|}d}q>q>WdS(s5count parity of horizontal stripes for easier readingiiN(R7(tstripecounttoffsettcounttparity((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt	paritygen�s	

cC@s4|dd�p3|dd�p3tjjd�p3dS(s�Return repo contact information or empty string.

    web.contact is the primary source, but if that is not set, try
    ui.username or $EMAIL as a fallback to display something useful.
    R	tcontactRRtEMAILRV(RtenvironRH(tconfig((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pytget_contact�scC@s|ddl}|jdddt�}d}|rrd|krrtj|j�j�jd�}|j	d|�}n||fS(sObtain the Content-Security-Policy header and nonce value.

    Returns a 2-tuple of the CSP header value and the nonce value.

    First value is ``None`` if CSP isn't enabled. Second value is ``None``
    if CSP isn't enabled or if the CSP header doesn't need a nonce.
    iNR	tcspt	untrusteds%nonce%t=(
tuuidR�R4Rtbase64turlsafe_b64encodetuuid4tbytestrstriptreplace(RR�R�tnonce((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt	cspvalues�s!((t
__future__RR�RkRcRJRNRVRRRRDtHTTP_OKtHTTP_CREATEDtHTTP_NOT_MODIFIEDtHTTP_BAD_REQUESTRRRmRtHTTP_NOT_ACCEPTABLEtHTTP_UNSUPPORTED_MEDIA_TYPERiRR&t	permhooksR(RtobjectR1R'RRIRRRTR^RyR~R�R�(((s</usr/lib64/python2.7/site-packages/mercurial/hgweb/common.pyt<module>	s@				2	
					&