ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/wsgiref/__pycache__/util.cpython-35.pyc



B�Ma�@s�dZddlZddddddgZGd	d�d�Zd
d�Zdd�Zdd
d�Zdd�Zdd�Zddddddddddddddddij	Z
dd�ZdS)z$Miscellaneous WSGI-related Utilities�N�FileWrapper�guess_scheme�application_uri�request_uri�shift_path_info�setup_testing_defaultsc@sIeZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)rz1Wrapper to convert file-like objects to iterablesi cCs1||_||_t|d�r-|j|_dS)N�close)�filelike�blksize�hasattrr)�selfr	r
�r
�1/opt/alt/python35/lib64/python3.5/wsgiref/util.py�__init__s		zFileWrapper.__init__cCs)|jj|j�}|r|St�dS)N)r	�readr
�
IndexError)r�key�datar
r
r�__getitem__szFileWrapper.__getitem__cCs|S)Nr
)rr
r
r�__iter__szFileWrapper.__iter__cCs)|jj|j�}|r|St�dS)N)r	rr
�
StopIteration)rrr
r
r�__next__szFileWrapper.__next__N)�__name__�
__module__�__qualname__�__doc__rrrrr
r
r
rrs
cCs!|jd�dkrdSdSdS)	zMReturn a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
    ZHTTPS�yes�on�1�https�httpN)rrr)�get)�environr
r
rr#scCs�|dd}ddlm}|jd�r>||d7}ne||d7}|ddkr�|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�/�encoding�latin1)�urllib.parser#r!)r"�urlr#r
r
rr+s%TcCs�t|�}ddlm}||jdd�dddd�}|jd	�sf||d
d�7}n
||7}|r�|jd�r�|d
|d7}|S)zBReturn the full request URI, optionally including the query stringr)r#�	PATH_INFO�Zsafez/;=,r,r-r*�NZQUERY_STRING�?)rr.r#r!)r"Z
include_queryr/r#�	path_infor
r
rr?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.
    r0r1Nr+cSs(g|]}|r|dkr|�qS)�.r
)�.0�pr
r
r�
<listcomp>^s	z#shift_path_info.<locals>.<listcomp>r2r*r5���r9r9)r!�split�	posixpath�normpath�endswith�join)r"r4�
path_parts�nameZscript_namer
r
rrLs$
'


cCsU|jdd�|jdd�|jd|d�|jdd�d|kr|d	|kr||jdd
�|jd	d�|jdd�|jdd�|jdd�|jdd�ddlm}m}|jd|��|jd|��|jdt|��|ddkr1|jdd�n |ddkrQ|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*r0r1r+zwsgi.versionr2rz
wsgi.run_oncezwsgi.multithreadzwsgi.multiprocess)�StringIO�BytesIOz
wsgi.inputzwsgi.errorszwsgi.url_schemer r&r)rr'N)r2r)�
setdefault�iorArBr)r"rArBr
r
rrus&
Z
connectionr2z
keep-alivezproxy-authenticatezproxy-authorizationZteZtrailersztransfer-encodingZupgradecCst|j��S)z?Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header)�_hoppish�lower)Zheader_namer
r
r�
is_hop_by_hop�srG)rr;�__all__rrrrrr�__contains__rErGr
r
r
r�<module>s
))

Zerion Mini Shell 1.0