ok

Mini Shell

Direktori : /lib64/python3.6/wsgiref/__pycache__/
Upload File :
Current File : //lib64/python3.6/wsgiref/__pycache__/util.cpython-36.opt-1.pyc

3


 \�	@sxdZddlZddddddgZGd	d�d�Zd
d�Zdd�Zdd
d�Zdd�Zdd�Zddddddddd�j	Z
dd�ZdS)z$Miscellaneous WSGI-related Utilities�N�FileWrapper�guess_scheme�application_uri�request_uri�shift_path_info�setup_testing_defaultsc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
rz1Wrapper to convert file-like objects to iterables� cCs"||_||_t|d�r|j|_dS)N�close)�filelike�blksize�hasattrr	)�selfr
r�r�$/usr/lib64/python3.6/wsgiref/util.py�__init__s
zFileWrapper.__init__cCs|jj|j�}|r|St�dS)N)r
�readr�
IndexError)r
�key�datarrr�__getitem__szFileWrapper.__getitem__cCs|S)Nr)r
rrr�__iter__szFileWrapper.__iter__cCs|jj|j�}|r|St�dS)N)r
rr�
StopIteration)r
rrrr�__next__szFileWrapper.__next__N)r)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrs

cCs|jd�dkrdSdSdS)	zMReturn a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
    ZHTTPS�yes�on�1�https�httpN)rrr)�get)�environrrrr#scCs�|dd}ddlm}|jd�r0||d7}nR||d7}|ddkrf|dd	kr�|d
|d7}n|ddkr�|d
|d7}|||jd�p�d
dd�7}|S)z@Return the application's base URI (no PATH_INFO or QUERY_STRING)zwsgi.url_schemez://r)�quote�	HTTP_HOST�SERVER_NAMEr �SERVER_PORT�443�:�80�SCRIPT_NAME�/�latin1)�encoding)�urllib.parser$r")r#�urlr$rrrr+s
TcCspt|�}ddlm}||jdd�ddd�}|jd�sF||d	d
�7}n||7}|rl|jd�rl|d|d7}|S)
zBReturn the full request URI, optionally including the query stringr)r$�	PATH_INFO�z/;=,r-)Zsafer.r+�NZQUERY_STRING�?)rr/r$r")r#Z
include_queryr0r$�	path_inforrrr?s
cCs�|jdd�}|sdS|jd�}dd�|dd
�D�|dd�<|d}|d=|jdd�}tj|d|�}|jd�r~|dd�}|r�|jd�r�|d7}||d<dj|�|d<|d	kr�d}|S)
aZShift a name from PATH_INFO to SCRIPT_NAME, returning it

    If there are no remaining path segments in PATH_INFO, return None.
    Note: 'environ' is modified in-place; use a copy if you need to keep
    the original PATH_INFO or SCRIPT_NAME.

    Note: when PATH_INFO is just a '/', this returns '' and appends a trailing
    '/' to SCRIPT_NAME, even though empty path segments are normally ignored,
    and SCRIPT_NAME doesn't normally end in a '/'.  This is intentional
    behavior, to ensure that an application can tell the difference between
    '/x' and '/x/' when traversing to objects.
    r1r2Nr,cSsg|]}|r|dkr|�qS)�.r)�.0�prrr�
<listcomp>^sz#shift_path_info.<locals>.<listcomp>r3r+r6���r:r:)r"�split�	posixpath�normpath�endswith�join)r#r5�
path_parts�nameZscript_namerrrrLs$


cCs�|jdd�|jdd�|jd|d�|jdd�d|kr\d	|kr\|jdd
�|jd	d�|jdd�|jdd�|jdd�|jdd�ddlm}m}|jd|��|jd|��|jdt|��|ddkr�|jdd�n|ddkr�|jdd�dS)a:Update 'environ' with trivial defaults for testing purposes

    This adds various parameters required for WSGI, including HTTP_HOST,
    SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO,
    and all of the wsgi.* variables.  It only supplies default values,
    and does not replace any existing settings for these variables.

    This routine is intended to make it easier for unit tests of WSGI
    servers and applications to set up dummy environments.  It should *not*
    be used by actual WSGI servers or applications, since the data is fake!
    r&z	127.0.0.1ZSERVER_PROTOCOLzHTTP/1.0r%ZREQUEST_METHODZGETr+r1r2r,zwsgi.versionr3rz
wsgi.run_oncezwsgi.multithreadzwsgi.multiprocess)�StringIO�BytesIOz
wsgi.inputzwsgi.errorszwsgi.url_schemer!r'r*r r(N)r3r)�
setdefault�iorBrCr)r#rBrCrrrrus&
r3)Z
connectionz
keep-alivezproxy-authenticatezproxy-authorizationZteZtrailersztransfer-encodingZupgradecCst|j��S)z?Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header)�_hoppish�lower)Zheader_namerrr�
is_hop_by_hop�srH)T)rr<�__all__rrrrrr�__contains__rFrHrrrr�<module>s

))


Zerion Mini Shell 1.0