Hacked By AnonymousFox

Current Path : /lib64/python3.8/wsgiref/__pycache__/
Upload File :
Current File : //lib64/python3.8/wsgiref/__pycache__/validate.cpython-38.opt-2.pyc

U

e5d�:�@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�(/usr/lib64/python3.8/wsgiref/validate.pyrysrcGs|st|��dS�N)�AssertionError)Zcond�argsrrr�assert_~srcCs(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 required�No 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: %srr�)r�len�check_status�
check_headers�check_content_type�check_exc_info�append�WriteWrapper)r�kw�status�headers�exc_info�Zstart_responseZstart_response_startedrr�start_response_wrapper�s�


z;validator.<locals>.lint_app.<locals>.start_response_wrapper�
wsgi.input�wsgi.errorsFz>The application must return an iterator, if only an empty list)rr�
check_environ�InputWrapper�ErrorWrapper�check_iterator�IteratorWrapper)rr�environr$�iterator��applicationr#r�lint_app�s
�zvalidator.<locals>.lint_appr)r/r0rr.rr�s)c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r(cCs
||_dSr	)�input)�self�
wsgi_inputrrr�__init__�szInputWrapper.__init__cGs0tt|�dk�|jj|�}tt|�tk�|S�Nr)rrr1�readr
�bytes�r2r�vrrrr6�szInputWrapper.readcGs0tt|�dk�|jj|�}tt|�tk�|Sr5)rrr1�readliner
r7r8rrrr:�szInputWrapper.readlinecGsJtt|�dk�|jj|�}tt|�tk�|D]}tt|�tk�q0|Sr5)rrr1�	readlinesr
�listr7)r2r�lines�linerrrr;�szInputWrapper.readlinesccs|��}|sdS|VqdSr	)r:)r2r>rrr�__iter__�szInputWrapper.__iter__cCstdd�dS)Nrz input.close() must not be called�r�r2rrr�close�szInputWrapper.closeN)	rrrr4r6r:r;r?rBrrrrr(�sr(c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r)cCs
||_dSr	)�errors)r2�wsgi_errorsrrrr4�szErrorWrapper.__init__cCs tt|�tk�|j�|�dSr	)rr
rrC�write�r2�srrrrE�szErrorWrapper.writecCs|j��dSr	)rC�flushrArrrrH�szErrorWrapper.flushcCs|D]}|�|�qdSr	)rE)r2�seqr>rrr�
writelines�szErrorWrapper.writelinescCstdd�dS)Nrz!errors.close() must not be calledr@rArrrrB�szErrorWrapper.closeN)rrrr4rErHrJrBrrrrr)�s
r)c@seZdZdd�Zdd�ZdS)rcCs
||_dSr	)�writer)r2Zwsgi_writerrrrr4�szWriteWrapper.__init__cCstt|�tk�|�|�dSr	)rr
r7rKrFrrr�__call__�szWriteWrapper.__call__N)rrrr4rLrrrrr�src@seZdZdd�Zdd�ZdS)�PartialIteratorWrappercCs
||_dSr	�r-)r2�
wsgi_iteratorrrrr4szPartialIteratorWrapper.__init__cCst|jd�Sr	)r+r-rArrrr?szPartialIteratorWrapper.__iter__N)rrrr4r?rrrrrM�srMc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r+cCs ||_t|�|_d|_||_dS)NF)�original_iterator�iterr-�closed�check_start_response)r2rOrSrrrr4	s
zIteratorWrapper.__init__cCs|Sr	rrArrrr?szIteratorWrapper.__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)rrR�nextr-r
r7rS)r2r9rrr�__next__s�

�zIteratorWrapper.__next__cCs d|_t|jd�r|j��dS)NTrB)rR�hasattrrPrBrArrrrBszIteratorWrapper.closecCs"|jstj�d�t|jd�dS)Nz/Iterator garbage collected without being closed)rR�sys�stderrrErrArrr�__del__#s��zIteratorWrapper.__del__N)rrrr4r?rUrBrYrrrrr+s
r+cCs�tt|�tkdt|�|f�dD]}t||kd|f�q"dD]"}t||kd||dd�f�q@d|krxt�dt�|��D]:}d	|kr�q�tt||�tkd
|t||�||f�q�tt|d�tkd|df�t|d
dkd|d
�t	|d�t
|d�|ddk�r0t�d|dt�t|�d��pL|d�d�d|d�t|�d��pv|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_PORT�wsgi.versionr%r&zwsgi.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)r[z#wsgi.version should be a tuple (%r)zwsgi.url_scheme)ZhttpZhttpszwsgi.url_scheme unknown: %rr%r&rZ)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 '/')rr
�dict�warnings�warnr�keysr�tuple�check_input�check_errors�get�
startswith�int)r,�keyrrrr'*sx
���������
�
�
�
�
���r'cCs&dD]}tt||�d||f�qdS)N)r6r:r;r?z-wsgi.input (%r) doesn't have the attribute %s�rrV)r3�attrrrrrdks
��rdcCs&dD]}tt||�d||f�qdS)N)rHrErJz.wsgi.errors (%r) doesn't have the attribute %srj)rDrkrrrreqs
��recCsvt|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�splitrrrhr`rar)r Zstatus_codeZ
status_intrrrrws
���rcCstt|�tkd|t|�f�|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"dS)Nz%Headers (%r) must be of type list: %rz1Individual headers (%r) must be of type tuple: %rr�Header namezHeader valuer zyThe 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))rr
r<rcrr�lower�	header_re�search�endswith�bad_header_value_re�group)r!�item�namerrrrr�s>
��
��

����
�rcCs|t|d�}t|�dd�d�}d}|D]:\}}t|d�}|��dkr&||krRdStdd|�q&||krxtdd|�dS)	Nrlrr)��i0rqzcontent-typezJContent-Type header found in a %s response, which must not return content.z,No Content-Type header found in headers (%s))rrhrprvr)r r!�codeZNO_MESSAGE_BODYr}rrrrr�s

�rcCs*t|dkpt|�tkd|t|�f�dS)Nz exc_info (%r) is not a tuple: %r)rr
rc)r"rrrr�s�rcCstt|ttf�d�dS)NzwYou should not return a string as your application iterator, instead return a single-item list containing a bytestring.)r�
isinstancerr7rNrrrr*�s�r*)�__all__�rerWr`�compilerwrz�Warningrrrrr(r)rrMr+r'rdrerrrrr*rrrr�<module>os,

7#		#A

Hacked By AnonymousFox1.0, Coded By AnonymousFox