403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.148.200.145
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/request.cpython-37.pyc
B

a�NA7�	@s*dZddlZddlmZmZddlmZddlZddlZyddlm	Z	Wn e
k
rhddlm	Z	YnXddlm
Z
ddd	d
ddd
ddg	Zdd�Zdd�Zdd	�Zdd�Zd%dd
�Zd&dd�Zdd�Zdd�Zdd
�Zdddd�Zdd �ZGd!d�de	�Zd"d#�Zeej_ed$k�r&ddlZe� �dS)'a�
This module provides helper routines with work directly on a WSGI
environment to solve common requirements.

   * get_cookies(environ)
   * parse_querystring(environ)
   * parse_formvars(environ, include_get_vars=True)
   * construct_url(environ, with_query_string=True, with_path_info=True,
                   script_name=None, path_info=None, querystring=None)
   * path_info_split(path_info)
   * path_info_pop(environ)
   * resolve_relative_url(url, environ)

�N)�SimpleCookie�CookieError)�StringIO)�	DictMixin)�	MultiDict�get_cookies�get_cookie_dict�parse_querystring�parse_formvars�
construct_url�path_info_split�
path_info_pop�resolve_relative_url�EnvironHeaderscCsh|�dd�}|�d�r.|d\}}||kr.|St�}y|�|�Wntk
rVYnX||f|d<|S)z�
    Gets a cookie object (which is a dictionary-like object) from the
    request environment; caches this value in case get_cookies is
    called again for the same request.

    �HTTP_COOKIE�z
paste.cookies)�get�has_keyr�loadr)�environ�header�cookies�check_header�r�>/opt/alt/python37/lib/python3.7/site-packages/paste/request.pyr#s
cCs�|�d�}|siS|�d�r4|d\}}||kr4|St�}y|�|�Wntk
r\YnXi}x|D]}||j||<qhW||f|d<|S)a#Return a *plain* dictionary of cookies as found in the request.

    Unlike ``get_cookies`` this returns a dictionary, not a
    ``SimpleCookie`` object.  For incoming cookies a dictionary fully
    represents the information.  Like ``get_cookies`` this caches and
    checks the cache.
    rzpaste.cookies.dict)rrrrr�value)rrrr�result�namerrrr7s"


cCsT|�dd�}|sgSd|kr4|d\}}||kr4|Stj|ddd�}||f|d<|S)a<
    Parses a query string into a list like ``[(name, value)]``.
    Caches this value in case parse_querystring is called again
    for the same request.

    You can pass the result to ``dict()``, but be aware that keys that
    appear multiple times will be lost (only the last value will be
    preserved).

    �QUERY_STRINGrzpaste.parsed_querystringTF)�keep_blank_values�strict_parsing)r�cgi�	parse_qsl)r�source�parsed�check_sourcerrrr	QscCs^|�dd�}|st�Sd|kr6|d\}}||kr6|Stj|ddd�}t|�}||f|d<|S)a�Parses a query string like parse_querystring, but returns a MultiDict

    Caches this value in case parse_dict_querystring is called again
    for the same request.

    Example::

        >>> environ = {'QUERY_STRING': 'day=Monday&user=fred&user=jane'}
        >>> parsed = parse_dict_querystring(environ)

        >>> parsed['day']
        'Monday'
        >>> parsed['user']
        'fred'
        >>> parsed.getall('user')
        ['fred', 'jane']

    rrzpaste.parsed_dict_querystringTF)rr )rrr!r")rr#r$r%Zmultirrr�parse_dict_querystringhsr&TcCs�|d}d|kr:|d\}}||kr:|r6|�t|��|S|�dd���}d|krb|�dd�d}|dk}|�d	�s|d
|d	<|�dd�}d|d<|r�td�}|�d�}	|�d	�}
d
|d	<d|d<n|d}tj||dd�}||d<|r�|	|d<|
|d	<t�}t	|j
t��rbxV|��D]J}
||
}t	|t��s2|g}x(|D] }|j
�sJ|j
}|�|
|��q8W�qW||f|d<|�r�|�t|��|S)
a�Parses the request, returning a MultiDict of form variables.

    If ``include_get_vars`` is true then GET (query string) variables
    will also be folded into the MultiDict.

    All values should be strings, except for file uploads which are
    left as ``FieldStorage`` instances.

    If the request was not a normal form request (e.g., a POST with an
    XML body) then ``environ['wsgi.input']`` won't be read.
    z
wsgi.inputzpaste.parsed_formvars�CONTENT_TYPEr�;�r)rz!application/x-www-form-urlencodedzmultipart/form-data�CONTENT_LENGTH�0r)�fprr)�updater	r�lower�splitrr!�FieldStorager�
isinstancer�list�keys�filename�add)rZinclude_get_varsr#r$r%�typeZfake_out_cgiZold_query_string�inputZold_content_typeZold_content_lengthZfsZformvarsr�valuesrrrrr
�sV




c	Cs�|dd}|�d�r�|d}d}d|krl|�dd�\}}|ddkrT|dkrld}n|dd	krl|d
krld}||7}|r�|d|7}nR||d7}|ddkr�|d
dkr�|d|d
7}n|d
d
kr�|d|d
7}|dkr�|t�|�dd��7}n|t�|�7}|�r<|dk�r.|t�|�dd��7}n|t�|�7}|�r||dk�rj|�d��r||d|d7}n|�r||d|7}|S)z�Reconstructs the URL from the WSGI environment.

    You may override SCRIPT_NAME, PATH_INFO, and QUERYSTRING with
    the keyword arguments.

    zwsgi.url_schemez://Z	HTTP_HOSTN�:r)�httpsZ443�httpZ80z:%sZSERVER_NAMEZSERVER_PORT�SCRIPT_NAMEr�	PATH_INFOr�?)rr/�urllib�quote)	r�with_query_stringZwith_path_info�script_name�	path_infoZquerystring�url�host�portrrrr�sF


cCst|dd�}t�||�S)a

    Resolve the given relative URL as being relative to the
    location represented by the environment.  This can be used
    for redirecting to a relative path.  Note: if url is already
    absolute, this function will (intentionally) have no effect
    on it.

    F)rA)r�urlparse�urljoin)rDrZcur_urlrrrr�s	cCsX|sdS|�d�std|��|�d�}d|krL|�dd�\}}|d|fS|dfSdS)a
    Splits off the first segment of the path.  Returns (first_part,
    rest_of_path).  first_part can be None (if PATH_INFO is empty), ''
    (if PATH_INFO is '/'), or a name without any /'s.  rest_of_path
    can be '' or a string starting with /.

    )Nr�/z!PATH_INFO should start with /: %rr)rN)�
startswith�AssertionError�lstripr/)rC�first�restrrrrs

cCs�|�dd�}|sdSx*|�d�r>|dd7<|dd�}qWd|krd|d|7<d|d<|S|�dd�\}}d||d<|d|7<|SdS)a�
    'Pops' off the next segment of PATH_INFO, pushing it onto
    SCRIPT_NAME, and returning that segment.

    For instance::

        >>> def call_it(script_name, path_info):
        ...     env = {'SCRIPT_NAME': script_name, 'PATH_INFO': path_info}
        ...     result = path_info_pop(env)
        ...     print 'SCRIPT_NAME=%r; PATH_INFO=%r; returns=%r' % (
        ...         env['SCRIPT_NAME'], env['PATH_INFO'], result)
        >>> call_it('/foo', '/bar')
        SCRIPT_NAME='/foo/bar'; PATH_INFO=''; returns='bar'
        >>> call_it('/foo/bar', '')
        SCRIPT_NAME='/foo/bar'; PATH_INFO=''; returns=None
        >>> call_it('/foo/bar', '/')
        SCRIPT_NAME='/foo/bar/'; PATH_INFO=''; returns=''
        >>> call_it('', '/1/2/3')
        SCRIPT_NAME='/1'; PATH_INFO='/2/3'; returns='1'
        >>> call_it('', '//1/2')
        SCRIPT_NAME='//1'; PATH_INFO='/2'; returns='1'

    r=rNrIr<r))rrJr/)r�pathZsegmentrrrr
sZ
AuthorizationzContent-LengthzContent-Type)ZHTTP_CGI_AUTHORIZATIONr*r'ccsZxT|��D]H\}}|tkr*t||fVq
|�d�r
|dd����dd�|fVq
WdS)z�
    Parse the headers in the environment (like ``HTTP_HOST``) and
    yield a sequence of those (header_name, value) tuples.
    �HTTP_�N�_�-)�	iteritems�_parse_headers_specialrJ�title�replace)rZcgi_varrrrr�
parse_headersHs

rXc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)ragAn object that represents the headers as present in a
    WSGI environment.

    This object is a wrapper (with no internal state) for a WSGI
    request object, representing the CGI-style HTTP_* keys as a
    dictionary.  Because a CGI environment can only hold one value for
    each key, this dictionary is single-valued (unlike outgoing
    headers).
    cCs
||_dS)N)r)�selfrrrr�__init___szEnvironHeaders.__init__cCs2d|�dd���}|dkr"d}n|dkr.d}|S)NrPrSrRZHTTP_CONTENT_LENGTHr*ZHTTP_CONTENT_TYPEr')rW�upper)rYr�keyrrr�_trans_namebszEnvironHeaders._trans_namecCsB|dkrdS|dkrdS|�d�r:|dd��dd���SdSdS)	Nr'zContent-Typer*zContent-LengthrPrQrRrS)rJrWrV)rYr\rrr�
_trans_keyjs
zEnvironHeaders._trans_keycCs|j|�|�S)N)rr])rY�itemrrr�__getitem__tszEnvironHeaders.__getitem__cCs||j|�|�<dS)N)rr])rYr_rrrr�__setitem__wszEnvironHeaders.__setitem__cCs|j|�|�=dS)N)rr])rYr_rrr�__delitem__{szEnvironHeaders.__delitem__ccs,x&|jD]}|�|�}|dk	r|VqWdS)N)rr^)rYr\rrrr�__iter__~s
zEnvironHeaders.__iter__cCstt|��S)N)r2�iter)rYrrrr3�szEnvironHeaders.keyscCs|�|�|jkS)N)r]r)rYr_rrr�__contains__�szEnvironHeaders.__contains__N)
�__name__�
__module__�__qualname__�__doc__rZr]r^r`rarbrcr3rerrrrrTs	
cCs*|jrd|j|jfSd|j|j|jfS)z� monkey patch for FieldStorage.__repr__

    Unbelievely, the default __repr__ on FieldStorage reads
    the entire file content instead of being sane about it.
    This is a simple replacement that doesn't do that
    zFieldStorage(%r, %r)zFieldStorage(%r, %r, %r))�filerr4r)rYrrr�_cgi_FieldStorage__repr__patch�s
rk�__main__)T)TTNNN)!rir!ZCookierrrrGr?�UserDictr�ImportErrorZpaste.util.UserDict24Zpaste.util.multidictr�__all__rrr	r&r
rrrr
rUrXrrkr0�__repr__rfZdoctestZtestmodrrrr�<module>sB
 
@
1*6



Youez - 2016 - github.com/yon3zu
LinuXploit