AlkantarClanX12

Your IP : 3.144.31.64


Current Path : /opt/alt/python37/lib64/python3.7/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/wsgiref/__pycache__/validate.cpython-37.opt-2.pyc

B

YI~d�:�@s�dgZddlZddlZddlZe�d�Ze�d�ZGdd�de�Zdd�Z	d	d
�Z
dd�ZGdd
�d
�ZGdd�d�Z
Gdd�d�ZGdd�d�ZGdd�d�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)&�	validator�Nz^[a-zA-Z][a-zA-Z0-9\-_]*$z[\000-\037]c@seZdZdS)�WSGIWarningN)�__name__�
__module__�__qualname__�rr�5/opt/alt/python37/lib64/python3.7/wsgiref/validate.pyrysrcGs|st|��dS)N)�AssertionError)Zcond�argsrrr�assert_~srcCs(t|�tkr|Std�|t|����dS)Nz!{0} must be of type str (got {1}))�type�strr	�format�repr)�value�titlerrr�check_string_type�srcs�fdd�}|S)Ncs�tt|�dkd�t|d�|\}�t|�g���fdd�}t|d�|d<t|d�|d<�||�}t|dk	oz|dkd	�t|�t|��S)
N�zTwo arguments requiredzNo keyword arguments allowedcs�tt|�dkpt|�dkd|f�t|d�|d}|d}t|�dkrV|d}nd}t|�t|�t||�t|���d�t�|��S)Nr�zInvalid number of arguments: %szNo keyword arguments allowedr�)r�len�check_status�
check_headers�check_content_type�check_exc_info�append�WriteWrapper)r
�kw�status�headers�exc_info)�start_response�start_response_startedrr�start_response_wrapper�s


z;validator.<locals>.lint_app.<locals>.start_response_wrapperz
wsgi.inputzwsgi.errorsFz>The application must return an iterator, if only an empty list)rr�
check_environ�InputWrapper�ErrorWrapper�check_iterator�IteratorWrapper)r
r�environr#�iterator)�application)r!r"r�lint_app�s
zvalidator.<locals>.lint_appr)r+r,r)r+rr�s)c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r%cCs
||_dS)N)�input)�self�
wsgi_inputrrr�__init__�szInputWrapper.__init__cGs0tt|�dk�|jj|�}tt|�tk�|S)Nr)rrr-�readr�bytes)r.r
�vrrrr1�szInputWrapper.readcGs0tt|�dk�|jj|�}tt|�tk�|S)Nr)rrr-�readlinerr2)r.r
r3rrrr4�szInputWrapper.readlinecGsNtt|�dk�|jj|�}tt|�tk�x|D]}tt|�tk�q2W|S)Nr)rrr-�	readlinesr�listr2)r.r
�lines�linerrrr5�s
zInputWrapper.readlinesccs x|��}|sdS|VqWdS)N)r4)r.r8rrr�__iter__�s
zInputWrapper.__iter__cCstdd�dS)Nrz input.close() must not be called)r)r.rrr�close�szInputWrapper.closeN)	rrrr0r1r4r5r9r:rrrrr%�sr%c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r&cCs
||_dS)N)�errors)r.�wsgi_errorsrrrr0�szErrorWrapper.__init__cCs tt|�tk�|j�|�dS)N)rrr
r;�write)r.�srrrr=�szErrorWrapper.writecCs|j��dS)N)r;�flush)r.rrrr?�szErrorWrapper.flushcCsx|D]}|�|�qWdS)N)r=)r.�seqr8rrr�
writelines�s
zErrorWrapper.writelinescCstdd�dS)Nrz!errors.close() must not be called)r)r.rrrr:�szErrorWrapper.closeN)rrrr0r=r?rAr:rrrrr&�s
r&c@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�writer)r.Zwsgi_writerrrrr0�szWriteWrapper.__init__cCstt|�tk�|�|�dS)N)rrr2rB)r.r>rrr�__call__�szWriteWrapper.__call__N)rrrr0rCrrrrr�src@seZdZdd�Zdd�ZdS)�PartialIteratorWrappercCs
||_dS)N)r*)r.�
wsgi_iteratorrrrr0szPartialIteratorWrapper.__init__cCst|jd�S)N)r(r*)r.rrrr9szPartialIteratorWrapper.__iter__N)rrrr0r9rrrrrD�srDc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r(cCs ||_t|�|_d|_||_dS)NF)�original_iterator�iterr*�closed�check_start_response)r.rErIrrrr0	s
zIteratorWrapper.__init__cCs|S)Nr)r.rrrr9szIteratorWrapper.__iter__cCsTt|jd�t|j�}t|�tk	r4tdd|f�|jdk	rPt|jd�d|_|S)NzIterator read after closedFz$Iterator yielded non-bytestring (%r)zjThe application returns and we started iterating over its body, but start_response has not yet been called)rrH�nextr*rr2rI)r.r3rrr�__next__s

zIteratorWrapper.__next__cCs d|_t|jd�r|j��dS)NTr:)rH�hasattrrFr:)r.rrrr:szIteratorWrapper.closecCs"|jstj�d�t|jd�dS)Nz/Iterator garbage collected without being closed)rH�sys�stderrr=r)r.rrr�__del__#s
zIteratorWrapper.__del__N)rrrr0r9rKr:rOrrrrr(s
r(cCs�tt|�tkdt|�|f�x dD]}t||kd|f�q$Wx*dD]"}t||kd||dd�f�qFWd|kr�t�dt�xF|��D]:}d	|kr�q�tt||�tkd
|t||�||f�q�Wtt|d�tkd|df�t|d
dkd|d
�t	|d�t
|d�|ddk�r<t�d|dt�t|�d��pX|d�d�d|d�t|�d��p�|d�d�d|d�|�d��r�tt
|d�dkd|d�|�d��s�td|kd�t|�d�dkd�dS)Nz:Environment is not of the right type: %r (environment: %r))	�REQUEST_METHODZSERVER_NAMEZSERVER_PORTzwsgi.versionz
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocessz
wsgi.run_oncez$Environment missing required key: %r)ZHTTP_CONTENT_TYPEZHTTP_CONTENT_LENGTHz8Environment should not have the key: %s (use %s instead)�ZQUERY_STRINGz�QUERY_STRING is not in the WSGI environment; the cgi module will use sys.argv when this variable is missing, so application errors are more likely�.z9Environmental variable %s is not a string: %r (value: %r)zwsgi.versionz#wsgi.version should be a tuple (%r)zwsgi.url_scheme)ZhttpZhttpszwsgi.url_scheme unknown: %rz
wsgi.inputzwsgi.errorsrP)ZGETZHEADZPOSTZOPTIONSZPATCHZPUTZDELETEZTRACEzUnknown REQUEST_METHOD: %rZSCRIPT_NAME�/z$SCRIPT_NAME doesn't start with /: %rZ	PATH_INFOz"PATH_INFO doesn't start with /: %rZCONTENT_LENGTHrzInvalid CONTENT_LENGTH: %rzgOne of SCRIPT_NAME or PATH_INFO are required (PATH_INFO should at least be '/' if SCRIPT_NAME is empty)zOSCRIPT_NAME cannot be '/'; it should instead be '', and PATH_INFO should be '/')rr�dict�warnings�warnr�keysr
�tuple�check_input�check_errors�get�
startswith�int)r)�keyrrrr$*sZ


r$cCs*x$dD]}tt||�d||f�qWdS)N)r1r4r5r9z-wsgi.input (%r) doesn't have the attribute %s)rrL)r/�attrrrrrYks

rYcCs*x$dD]}tt||�d||f�qWdS)N)r?r=rAz.wsgi.errors (%r) doesn't have the attribute %s)rrL)r<r_rrrrZqs

rZcCsvt|d�}|�dd�d}tt|�dkd|�t|�}t|dkd|�t|�dksb|dd	krrt�d
|t�dS)N�Statusrrrz)Status codes must be three characters: %r�dzStatus code is invalid: %r�� zjThe status string (%r) should be a three-digit integer followed by a single space and a status explanation)r�splitrrr]rUrVr)rZstatus_codeZ
status_intrrrrws

rcCstt|�tkd|t|�f�x�|D]�}tt|�tkd|t|�f�tt|�dk�|\}}t|d�}t|d�}t|��dkd|�td|ko�d	|kd
|�tt�|�d|�t|�	d�o�|�	d
�d|�t
�|�r$tdd|t
�|��d�f�q$WdS)Nz%Headers (%r) must be of type list: %rz1Individual headers (%r) must be of type tuple: %rrzHeader namezHeader valuerzyThe Status header cannot be used; it conflicts with CGI script, and HTTP status is not given through headers (value: %r).�
�:z,Header names may not contain ':' or '\n': %rzBad header name: %r�-�_z#Names may not end in '-' or '_': %rrz#Bad header value: %r (bad char: %r))rrr6rXrr�lower�	header_re�search�endswith�bad_header_value_re�group)r�item�namerrrrr�s,





rcCs~t|d�}t|�dd�d�}d}x@|D]8\}}t|d�}|��dkr(||krRdStdd|�q(W||krztdd|�dS)	Nr`rr)��i0zHeader namezcontent-typezJContent-Type header found in a %s response, which must not return content.z,No Content-Type header found in headers (%s))rr]rdrir)rr�codeZNO_MESSAGE_BODYrprrrrr�s

rcCs*t|dkpt|�tkd|t|�f�dS)Nz exc_info (%r) is not a tuple: %r)rrrX)r rrrr�srcCstt|ttf�d�dS)NzwYou should not return a string as your application iterator, instead return a single-item list containing a bytestring.)r�
isinstancer
r2)r*rrrr'�sr')�__all__�rerMrU�compilerjrm�Warningrrrrr%r&rrDr(r$rYrZrrrrr'rrrr�<module>os,

7#		#A