403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/hgweb/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/hgweb/__pycache__/hgweb_mod.cpython-39.opt-1.pyc
a

�+�bG�@s�ddlmZddlZddlZddlmZmZmZmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZm
Z
mZmZmZmZmZmZmZmZddlmZmZm Z m!Z!d	d
�Z"ddd�Z#ddd�Z$Gdd�de%�Z&Gdd�de%�Z'dd�Z(dS)�)�absolute_importN�)�
ErrorResponse�HTTP_BAD_REQUEST�	cspvalues�	permhooks�
statusmessage�)�getattr)�encoding�error�
extensions�	formatter�hg�hook�	profiling�pycompat�	registrar�repoview�templatefilters�	templater�templateutil�ui�util�wireprotoserver)�request�webcommands�webutil�wsgicgicCs(|j�dd�|dd�df}|t||�fS)N�style�webspaper)�qsparams�get�	_stylemap)�reqZconfigfn�templatepath�styles�r'�?/usr/lib64/python3.9/site-packages/mercurial/hgweb/hgweb_mod.py�getstyle2s
�r)cCs�|D]|}|r|tjtjfvstj|vstjr8tj|vr8qtj�|d�d|df}|D]*}t�	||�\}}|rT|||fSqTqt
d|��dS)z�Return path to mapfile for a given style.

    Searches mapfile in the following locations:
    1. templatepath/style/map
    2. templatepath/map-style
    3. templatepath/map
    smapsmap-sNo hgweb templates found in %rN)rZoscurdirZospardirZossepZosaltsep�os�path�joinrZtry_open_template�RuntimeError)r&r+�styleZ	locations�location�mapfile�fpr'r'r(r#;s$	�����r#�cCs�|�d�r|dd�}|r&d||}|}|�d�r@|dd�}g}|}dg|�d�}t|�D],}|rl|spq�|�||d��tj�|�}q`t�	t|��S)z�Return a 'URL breadcrumb' list

    A 'URL breadcrumb' is a list of URL-name pairs,
    corresponding to each of the path items on a URL.
    This can be used to create path navigation entries.
    �/N���rr2)�url�name)
�endswith�
startswith�split�reversed�appendr*r+�dirnamerZmappinglist)�url�prefix�relpathZ
breadcrumbZurlelZ	pathitemsZpathelr'r'r(�makebreadcrumbXs 

r@c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�requestcontextz�Holds state/context for an individual request.

    Servers can be multi-threaded. Holding state on the WSGI application
    is prone to race conditions. Instances of this class exist to hold
    mutable and race-free state for requests.
    cCs�||_|j|_||_||_|�dd�|_|�dd�|_|�dd�|_|�dd�|_|�	dd�|_
|jdddd	�|_|j
|_
t|jj�\|_|_dS)
Nr s
maxchangessstripessmaxshortchangessmaxfiless
allow-pulls	templatesF��	untrusted)�repo�reponamer$�res�	configintZ
maxchangesZstripecountZmaxshortchangesZmaxfiles�
configboolZ	allowpull�configr%�websubtablerr�csp�nonce)�selfZapprDr$rFr'r'r(�__init__zszrequestcontext.__init__cOs |�dd�|jjj|i|��S�NrCT)�
setdefaultrDrrI�rM�args�kwargsr'r'r(rI�szrequestcontext.configcOs |�dd�|jjj|i|��SrO)rPrDrrHrQr'r'r(rH�szrequestcontext.configboolcOs |�dd�|jjj|i|��SrO)rPrDrrGrQr'r'r(rG�szrequestcontext.configintcOs |�dd�|jjj|i|��SrO)rPrDr�
configlistrQr'r'r(rT�szrequestcontext.configlistcCst�|jj|�S�N)r�archivelistrDr)rMZnodeidr'r'r(rV�szrequestcontext.archivelistcsN��dd�}��dd�}��dd�p2|j�d�d}|�d�sF|d7}i}t|�j�j�\}\}}}	||dkrx||d<t�|d	�}
�js���dd
d�p�|jp�|jp��j	j
�_i}t�|�}|dt
d
��fdd��}
|jd||||j�jtj|
t|j�|�jd�}t�|�}|ddd��fdd��}t��j	j�j	�}tjj||	|||d�S)Nr �logourl�logoimg�	staticurlr3s/static/rr�?r6r2swebsub)Zintypecst�|�j�SrU)rZwebsubrJ)�text�rMr'r(�websubfilter�sz.requestcontext.templater.<locals>.websubfilter)r5rWrXrYsurlbasesrepo�encodingssessionvarsspathdefrsnonce�motdr')Zrequiresc3s��dd�VdS)Nr r_)rI)�context�mappingr\r'r(�motd�sz&requestcontext.templater.<locals>.motd)r1�filters�defaultsZ	resources)rIZapppath�rstripr7r)r%r�sessionvarsrErD�rootr�templatefilter�bytesZadvertisedbaseurlrr@rL�templatekeywordrZtemplateresourcesrrZfrommapfile)rMr$ZlogourlZlogoimgZ	staticurl�varsr&r.r0r1rfrcrhr]rdrjrbZtresr'r\r(r�sZ�

����

�


�zrequestcontext.templatercKs*t�|�}|j�|j�||��|j��S)z=Helper function to send a response generated from a template.)rZbyteskwargsrFZ
setbodygen�tmplZgenerate�sendresponse)rM�namerSr'r'r(�sendtemplate�s
zrequestcontext.sendtemplateN)�__name__�
__module__�__qualname__�__doc__rNrIrHrGrTrVrror'r'r'r(rArs@rAc@sXeZdZdZddd�Zdd�Zejdd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�hgweba*HTTP server for individual repositories.

    Instances of this class serve HTTP responses for a particular
    repository.

    Instances are typically used as WSGI applications.

    Some servers are multi-threaded. On these servers, there may
    be multiple active threads inside __call__.
    NcCs4t|t�rD|r|��}ntj��}t�|�t�|�t	�
||�}n|}|j�dddd�|j�dddd�|j�dddd�|j�dddd�|j�dd|j
d�|j�dd|j
d�|j�ddd	d�|j�ddd	d�|j�d
ddd�|j�d
ddd�t	�|�|��g|_|jd|_t�d
�||_dS)Nsuisreport_untrustedsoffshgwebsnonttystruesforcecwdssignal-safe-locksfalsesprogresssdisablerT)�
isinstanceri�copy�uimodr�loadr
ZloadallZ
populateuirZ
repositoryZ	setconfig�baseuirgZcachedlocalrepo�_webifyrepo�_repos�	_lastreporZredirectrE)rMrDrnry�u�rr'r'r(rN�s,





zhgweb.__init__cCst|�}t�|�|_|SrU)�
getwebviewrZ
getwebsubsrJ)rMrDr'r'r(rzszhgweb._webifyrepoc	csz|jr|j��}|��\}}n|j��}|��\}}|rB|�|�}||_|j|_z|VW|j�|�n|j�|�0dS)aObtain a repo unique to the caller.

        Internally we maintain a stack of cachedlocalrepo instances
        to be handed out. If one is available, we pop it and return it,
        ensuring it is up to date in the process. If one is not available,
        we clone the most recently used repo instance and return it.

        It is currently possible for the stack to grow without bounds
        if the server allows infinite threads. However, servers should
        have a thread limit, thus establishing our limit.
        N)r{�popZfetchr|rvrz�mtimer;)rM�cachedr~Zcreatedr'r'r(�_obtainrepo#s



zhgweb._obtainrepocCs*tj�dd��d�std��t�|�dS)z�Start a server from CGI environment.

        Modern servers should be using WSGI and should avoid this
        method, if possible.
        sGATEWAY_INTERFACEr2sCGI/1.sJThis function is only intended to be called while running as a CGI script.N)r�environr"r8r-rZlaunchr\r'r'r(�run@s��z	hgweb.runcCs"t�|�}t�||�}|�||�S)zSRun the WSGI application.

        This may be called by multiple threads.
        )�
requestmodZparserequestfromenvZwsgiresponse�run_wsgi)rM�envZrespondr$rFr'r'r(�__call__Os
zhgweb.__call__c	cs�|���h}|j�dd�}tj|j|d��*|�|||�D]
}|Vq8Wd�n1sX0YWd�n1sv0YdS)z�Internal method to run the WSGI application.

        This is typically only called by Mercurial. External consumers
        should be using instances of this class as the WSGI application.
        s	profilingsenabled)ZenabledN)r�rrHr�profile�_runwsgi)rMr$rFrDr�r~r'r'r(r�Ys

zhgweb.run_wsgic
Cs�t||||�}|�dd�t_|j|jj_|jr:|j|jd<t	�
||||j�}|rX|��S|j
durj|j
}n|j�d�d�d�d}|�dd�}d	|jv�r|�r|d�r|�d�}|�d
�}	|	dkr�|d|	�|jd<||	d
d�}t�t|��r||jd	<|dk�rd�|�|jd<n`|�rJ|d�rJ|�d��dd�}
|
|jd<|�r~d|jv�rd|jd=|D]}|j�d|��qh|j�dd�}|dk�r�d|v�r�d|jd<|dk�r|jd}
t�tj�D]@\}}|d}|
�|��r�|
dt |��|jd<||jd<�q�n|j�d	d�}�z|�!|�|_"|j"�#ddtji�}|dk�rX|�||d�|dk�r�|j"�#di�|jd	<|jd	}|�$dd��r�|j%�s�d|j&}|j�d�|k�r�d|_'z|jd=Wnt(�y�Yn0|�)d�|��WS||jd <|tj*v�rd!|}t+t,|��n d"|_'||jd<t-t|�|�WSW�n�t.j/t.j0f�y�}zZt�1|�}t�|d#��r�t2|t.j3��s�d$|j4}d%|_'||jd<|j5d&|d'�WYd}~Sd}~0t.j6t.j7f�y}z0d(|_'||jd<|j5d&t�1|�d'�WYd}~Sd}~0t.j8�yN}z,d)|_'||jd<|j5d&|j9d'�WYd}~Sd}~0t+�y�}zZ|jD]\}}||j|<�qdt:|j;t�1|��|_'||jd<|j5d&t�1|�d'�WYd}~Sd}~00dS)*Nr r^sContent-Security-Policy�&r�;r3r	scmd�-r4rrsstaticsfiles%2Fsnodes
User-Agentr2srevs	mercurialsrawsarchivestypesmimetypesdefaultscachesW/"%d"s
If-None-Matchs304 Not ModifiedsContent-TypesETagsno such method: %ss200 Script output followsr6srevision not found: %ss
404 Not Foundserror)rs500 Internal Server Errors
403 Forbidden)<rArIrZrawenvrDrr�rKZheadersrZhandlewsgirequest�
check_permrmZdispatchpathZquerystring�	partitionr9r!r��rfindrZsafehasattrrr,�replace�addr"rZ	iteritemsrZarchivespecsr7�lenrrlZrenderrHrLr��status�KeyErrorZsetbodybytes�__all__rrr
r�LookupErrorZRepoLookupErrorZbytestrruZManifestLookupErrorrnroZ	RepoErrorZStorageErrorZAbort�messager�code)rMr$rFrD�rctxZhandled�queryrR�cmdr.Znode�aZua�fn�type_�spec�extZctype�tag�msg�err�e�k�vr'r'r(r�es�
�









�








�

"
(
$
zhgweb._runwsgicCstD]}||||�qdSrU)r)rMr�r$�opZpermhookr'r'r(r��szhgweb.check_perm)NN)rprqrrrsrNrz�
contextlib�contextmanagerr�r�r�r�r�r�r'r'r'r(rt�s
#

	rtcCsD|jjdddd�}|dkr"|��S|tjvr6|�|�S|�d�SdS)aThe 'web.view' config controls changeset filter to hgweb. Possible
    values are ``served``, ``visible`` and ``all``. Default is ``served``.
    The ``served`` filter only shows changesets that can be pulled from the
    hgweb instance.  The``visible`` filter includes secret changesets but
    still excludes "hidden" one.

    See the repoview module for details.

    The option has been around undocumented since Mercurial 2.5, but no
    user ever asked about it. So we better keep it undocumented for now.r sviewTrBsallsservedN)rrIZ
unfilteredrZfiltertableZfiltered)rDZ
viewconfigr'r'r(r�s

r)N)r2))Z
__future__rr�r*�commonrrrrrrr
�rrr
rrrrrrrrrrrwrrrr�rrrr)r#r@�objectrArtrr'r'r'r(�<module>	sH	

}

Youez - 2016 - github.com/yon3zu
LinuXploit