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__/request.cpython-39.pyc
a

�+�b
Y�@s�ddlmZddlmZddlmZmZmZmZddl	m
Z
Gdd�de�Zej
dd	�Gd
d�de��Zdd
d�ZGdd�de�ZGdd�de�Zdd�ZdS)�)�absolute_import�)�attr)�encoding�error�pycompat�util)�urlutilc@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�	multidictz�A dict like object that can store multiple values for a key.

    Used to store parsed request parameters.

    This is inspired by WebOb's class of the same name.
    cCs
i|_dS�N��_items��self�r�=/usr/lib64/python3.9/site-packages/mercurial/hgweb/request.py�__init__!szmultidict.__init__cCs|j|dS)z%Returns the last set value for a key.���r�r�keyrrr�__getitem__$szmultidict.__getitem__cCs|g|j|<dS)z,Replace a values for a key with a new value.Nr�rr�valuerrr�__setitem__(szmultidict.__setitem__cCs|j|=dS)zDelete all values for a key.Nrrrrr�__delitem__,szmultidict.__delitem__cCs
||jvSrrrrrr�__contains__0szmultidict.__contains__cCs
t|j�Sr)�lenr
rrrr�__len__3szmultidict.__len__NcCs(z|�|�WSty"|YS0dSr)r�KeyError)rr�defaultrrr�get6sz
multidict.getcCs|j�|g��|�dS)z<Add a new value for a key. Does not replace existing values.N)r
�
setdefault�appendrrrr�add<sz
multidict.addcCs|j�|g�S)zObtains all values for a key.)r
r rrrr�getall@szmultidict.getallcCs*|j|}t|�dkr"td|��|dS)ztObtain a single value for a key.

        Raises KeyError if key not defined or it has multiple values set.
        �smultiple values for %rr)r
rr)rrZvalsrrr�getoneDs
zmultidict.getonecCsdd�t�|j�D�S)NcSsi|]\}}|t|��qSr)�list��.0�k�vrrr�
<dictcomp>Q�z+multidict.asdictoflists.<locals>.<dictcomp>)r�	iteritemsr
rrrr�
asdictoflistsPszmultidict.asdictoflists)N)�__name__�
__module__�__qualname__�__doc__rrrrrrr r#r$r&r/rrrrr
s
r
T)�frozenc@s�eZdZdZe��Ze��Ze��Ze��Z	e��Z
e��Ze��Ze��Z
e��Ze��Ze��Ze��Ze��Ze��Ze��Ze��Ze��ZdS)�
parsedrequestztRepresents a parsed WSGI request.

    Contains both parsed parameters as well as a handle on the input stream.
    N)r0r1r2r3rZib�method�url�baseurl�
advertisedurl�advertisedbaseurl�	urlscheme�
remoteuser�
remotehost�apppath�
dispatchparts�dispatchpath�reponame�querystring�qsparams�headers�bodyfh�rawenvrrrrr5Ts$r5Ncs|tjr&dd���fdd�t�|�D�}|s4|�d�}|rBt�|�}|dd}|rd|jrd|jd}n|}dd	�}|�d
�r�||d
7}n||d7}|||d�}|�r|j�r||j7}|jr�|j}n4|jd
kr�|js�d}n|jdkr�|js�d}n|d}|||�}n||d7}|||d�}|}|}	|t	j
�|�dd��7}|t	j
�|�dd��7}|�r�|j�pjd}
|
�r�|
�
d��s�d|
}
|t	j
�|
�7}n|t	j
�|�dd��7}|t	j
�|�dd��7}|�d��r�|d|d7}|d|d7}|�r"|j�pd}|�r.|�
d��s.d|}n|�dd�}|�r�d|�d�}|�d��sXt�d��|d�
|��s~t�d|d|f��|dt|�d�}
|
�r�|
�
d��s�t�d|d|f��|�d�|}|
�d��d�}d�|�}
nLd|v�r(|d�d��r|d�d��d�}d�|�}
ng}d}
ng}d}
|�dd�}t�}t	j
j|dd�D]\}}|�||��qRg}t�|�D]8\}}|�
d��rx|�|td�d��dd�|f��qxd d!lm}|�|�}d"|v�r�d#|v�r�|d"|d$<d%|v�rd&|v�r|d%|d'<|du�r>|d(}d$|v�r>t	�|t|d$�p8d)��}t|d*||||	|d|�d+�|�d,�|||
||||||d-�S).a�Parse URL components from environment variables.

    WSGI defines request attributes via environment variables. This function
    parses the environment variables into a data structure.

    If ``reponame`` is defined, the leading path components matching that
    string are effectively shifted from ``PATH_INFO`` to ``SCRIPT_NAME``.
    This simulates the world view of a WSGI application that processes
    requests from the base URL of a repo.

    If ``altbaseurl`` (typically comes from ``web.baseurl`` config option)
    is defined, it is used - instead of the WSGI environment variables - for
    constructing URL components up to and including the WSGI application path.
    For example, if the current WSGI application is at ``/repo`` and a request
    is made to ``/rev/@`` with this argument set to
    ``http://myserver:9000/prefix``, the URL and path components will resolve as
    if the request were to ``http://myserver:9000/prefix/rev/@``. In other
    words, ``wsgi.url_scheme``, ``SERVER_NAME``, ``SERVER_PORT``, and
    ``SCRIPT_NAME`` are all effectively replaced by components from this URL.

    ``bodyfh`` can be used to specify a file object to read the request body
    from. If not defined, ``wsgi.input`` from the environment dict is used.
    cSs,t|t�s|Stjrt�|�St�|�SdSr)�
isinstance�strrZ	iswindowsrZ
strtolocal�fsencode)�srrr�tobytes�s


z$parserequestfromenv.<locals>.tobytescsi|]\}}�|��|��qSrrr(�rKrrr,�r-z'parserequestfromenv.<locals>.<dictcomp>s	REPO_NAMEswsgi.url_schemes://cSs8|�d�r |dkr4|d|7}n|dkr4|d|7}|S)Nshttps://�443�:�80)�
startswith)rJ�portrrr�addport�s
z$parserequestfromenv.<locals>.addports	HTTP_HOSTsSERVER_NAMEsSERVER_PORTshttprOshttpsrMsSCRIPT_NAMEr-s	PATH_INFO�/sQUERY_STRING�?sreponame requires PATH_INFOs0PATH_INFO does not begin with repo name: %s (%s)NsDreponame prefix of PATH_INFO does not end at path delimiter: %s (%s)T)�keep_blank_valuessHTTP_�_�-r%��wsgiheaderssCONTENT_LENGTHsHTTP_CONTENT_LENGTH�Content-LengthsCONTENT_TYPEsHTTP_CONTENT_TYPEsContent-Types
wsgi.input�0sREQUEST_METHODsREMOTE_USERsREMOTE_HOST)r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErF) rZispy3r.r r	r7�scheme�hostrQrZurlreq�quote�pathrP�stripr�ProgrammingErrorr�rstrip�split�joinr
Zparseqslr#r"�replace�rY�Headers�cappedreader�intr5)�envrAZ
altbaseurlrEZfullurlZadvertisedfullurlrRrQr8r:r_r>Z
repoprefixr@r?rBrCr*r+rDrYrrLr�parserequestfromenv�s�#








��
��
&


��rkc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�offsettrackingwritera�A file object like object that is append only and tracks write count.

    Instances are bound to a callable. This callable is called with data
    whenever a ``write()`` is attempted.

    Instances track the amount of written data so they can answer ``tell()``
    requests.

    The intent of this class is to wrap the ``write()`` function returned by
    a WSGI ``start_response()`` function. Since ``write()`` is a callable and
    not a file object, it doesn't implement other file object methods.
    cCs||_d|_dS)Nr)�_write�_offset)rZwritefnrrrrwszoffsettrackingwriter.__init__cCs8|�|�}|dur&|jt|�7_n|j|7_dSr)rmrnr)rrJ�resrrr�write{s
zoffsettrackingwriter.writecCsdSrrrrrr�flush�szoffsettrackingwriter.flushcCs|jSr)rnrrrr�tell�szoffsettrackingwriter.tellN)r0r1r2r3rrprqrrrrrrrlis

rlc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�wsgiresponseaPRepresents a response to a WSGI request.

    A response consists of a status line, headers, and a body.

    Consumers must populate the ``status`` and ``headers`` fields and
    make a call to a ``setbody*()`` method before the response can be
    issued.

    When it is time to start sending the response over the wire,
    ``sendresponse()`` is called. It handles emitting the header portion
    of the response message. It then yields chunks of body data to be
    written to the peer. Typically, the WSGI application itself calls
    and returns the value from ``sendresponse()``.
    cCsL||_||_d|_ddlm}|�g�|_d|_d|_d|_	d|_
d|_dS)z�Create an empty response tied to a specific request.

        ``req`` is a ``parsedrequest``. ``startresponse`` is the
        ``start_response`` function passed to the WSGI application.
        Nr%rXF)�_req�_startresponse�statusrfrYrgrD�
_bodybytes�_bodygen�_bodywillwrite�_started�_bodywritefn)rZreqZ
startresponserYrrrr�szwsgiresponse.__init__cCs(|jdus|jdus|jr$t�d��dS)Ns!cannot define body multiple times)rwrxryrrarrrr�_verifybody�s���zwsgiresponse._verifybodycCs$|��||_dt|�|jd<dS)ztDefine the response body as static bytes.

        The empty string signals that there is no response body.
        s%drZN)r|rwrrD)r�brrr�setbodybytes�szwsgiresponse.setbodybytescCs|��||_dS)z1Define the response body as a generator of bytes.N)r|rx)r�genrrr�
setbodygen�szwsgiresponse.setbodygencCs|��d|_dS)aSignal an intent to use write() to emit the response body.

        **This is the least preferred way to send a body.**

        It is preferred for WSGI applications to emit a generator of chunks
        constituting the response body. However, some consumers can't emit
        data this way. So, WSGI provides a way to obtain a ``write(data)``
        function that can be used to synchronously perform an unbuffered
        write.

        Calling this function signals an intent to produce the body in this
        manner.
        TN)r|ryrrrr�setbodywillwrite�szwsgiresponse.setbodywillwriteccs�|jrt�d��d|_|js&t�d��|jdurJ|jdurJ|jsJt�d��|j�d�r�|j�	d�dkrn|jd=d	d
�|j�
�D�}|r�t�dd�t|����|jdus�|jr�t�d
��d}d}|j
j�	dd���dkr�n(|j
jdvr�nt|j
jtj�s�d}nd}|�rd|jd<|�rJt|j
jtj��s.J�|j
j�d�}|�s.�qJ�q.dd�|j��D�}|�t�|j�|�}|j�r�|jVnL|j�r�|jD] }t|t��r�t|�}|V�q�n|j�r�||_n
t�d�dS)z�Send the generated response to the client.

        Before this is called, ``status`` must be set and one of
        ``setbodybytes()`` or ``setbodygen()`` must be called.

        Calling this method multiple times is not allowed.
        s$sendresponse() called multiple timesTsstatus line not definedNsresponse body not defineds304 rZr[cSsh|]}|��dvr|�qS))sdatesetagsexpiress
cache-controlscontent-locationscontent-security-policysvary)�lower)r)r*rrr�	<setcomp>�s
��z,wsgiresponse.sendresponse.<locals>.<setcomp>s"illegal header on 304 response: %ss, s,must use setbodybytes('') with 304 responsesFsExpectr-s100-continue)sPOSTsPUTsCloses
Connectioni�cSs$g|]\}}t�|�t�|�f�qSr)rZstrurlr(rrr�
<listcomp>Es�z-wsgiresponse.sendresponse.<locals>.<listcomp>sdo not know how to send body)rzrrarvrwrxryrPrDr �keysrd�sortedrtr�r6rGrErrh�read�itemsrurZsysstr�	bytearray�bytesr{)rZ
badheadersZdrain�close�chunkZ
strheadersrprrr�sendresponse�sx�
���
	����
�

zwsgiresponse.sendresponsecCs4|jst�d��|js t�d��|js*J�t|j�S)a�Obtain a file object like object representing the response body.

        For this to work, you must call ``setbodywillwrite()`` and then
        ``sendresponse()`` first. ``sendresponse()`` is a generator and the
        function won't run to completion unless the generator is advanced. The
        generator yields not items. The easiest way to consume it is with
        ``list(res.sendresponse())``, which should resolve to an empty list -
        ``[]``.
        s"must call setbodywillwrite() firstsWmust call sendresponse() first; did you remember to consume it since it is a generator?)ryrrarzr{rlrrrr�getbodyfile[s

�
zwsgiresponse.getbodyfileN)r0r1r2r3rr|r~r�r�r�r�rrrrrs�s	rscs|���fdd�}|S)z{For compatibility with old CGI scripts. A plain hgweb() or hgwebdir()
    can and should now be used as a WSGI application.cs
�||�Srr)rjZrespond�Zapplicationrr�run_wsgixsz!wsgiapplication.<locals>.run_wsgir)Z	app_makerr�rr�r�wsgiapplicationssr�)NNN)Z
__future__rZ
thirdpartyrrfrrrrZutilsr	�objectr
rJr5rkrlrsr�rrrr�<module>	s;
0
e!j

Youez - 2016 - github.com/yon3zu
LinuXploit