Your IP : 18.219.81.129


Current Path : /opt/alt/python311/lib64/python3.11/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/wsgiref/__pycache__/validate.cpython-311.opt-2.pyc

�

c��f�:��F�	dgZddlZddlZddlZejd��Zejd��ZGd�de��Zd�Z	d�Z
d	�ZGd
�d��ZGd�d
��Z
Gd�d��ZGd�d��ZGd�d��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�	validator�Nz^[a-zA-Z][a-zA-Z0-9\-_]*$z[\000-\037]c��eZdZdS)�WSGIWarningN)�__name__�
__module__�__qualname__���7/opt/alt/python311/lib64/python3.11/wsgiref/validate.pyrrys�������r
rc��|s	t|��dS�N)�AssertionError)�cond�argss  r�assert_r~s���$��d�#�#�$�$r
c��t|��tur|Std�|t	|�������)Nz!{0} must be of type str (got {1}))�type�strr�format�repr)�value�titles  r�check_string_typer�sF���U�|�|�s�����
�+�2�2�5�$�u�+�+�F�F�H�H�Hr
c���	�fd�}|S)Nc�����tt|��dkd��t|d��|\}�t|��g���fd�}t|d��|d<t	|d��|d<�||��}t|duo|dkd��t|��t
|���S)	N�zTwo arguments required�No keyword arguments allowedc���tt|��dkpt|��dkd|����t|d��|d}|d}t|��dkr	|d}nd}t|��t|��t	||��t|����d��t�|���S)Nr�zInvalid number of arguments: rr�)r�len�check_status�
check_headers�check_content_type�check_exc_info�append�WriteWrapper)r�kw�status�headers�exc_info�start_response�start_response_starteds     ��r�start_response_wrapperz;validator.<locals>.lint_app.<locals>.start_response_wrapper�s�����C��I�I��N�4�c�$�i�i�1�n��59�T�;�
>�
>�
>���F�:�;�;�;��!�W�F��1�g�G��4�y�y�A�~�~���7������� � � ��'�"�"�"��v�w�/�/�/��8�$�$�$�"�)�)�$�/�/�/����� 5�6�6�6r
�
wsgi.input�wsgi.errorsFz>The application must return an iterator, if only an empty list)rr!�
check_environ�InputWrapper�ErrorWrapper�check_iterator�IteratorWrapper)rr(�environr.�iteratorr,r-�applications     @@�r�lint_appzvalidator.<locals>.lint_app�s��������D�	�	�Q�� 8�9�9�9��B��6�7�7�7�"&�����g����"$��	7�	7�	7�	7�	7�	7�&!-�W�\�-B� C� C����!-�g�m�.D�!E�!E��
���;�w�(>�?�?�����$�:��U�):�L�	N�	N�	N�	�x� � � ��x�)?�@�@�@r
r	)r8r9s` rrr�s.����'A�'A�'A�'A�'A�R�Or
c�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)r2c��||_dSr
)�input)�self�
wsgi_inputs  r�__init__zInputWrapper.__init__�s
����
�
�
r
c��tt|��dk��|jj|�}tt	|��t
u��|S�Nr )rr!r<�readr�bytes�r=r�vs   rrBzInputWrapper.read�sH����D�	�	�Q������D�J�O�T�"����Q���5� �!�!�!��r
c��tt|��dk��|jj|�}tt	|��t
u��|SrA)rr!r<�readlinerrCrDs   rrGzInputWrapper.readline�sI����D�	�	�Q������D�J���&����Q���5� �!�!�!��r
c��tt|��dk��|jj|�}tt	|��t
u��|D]%}tt	|��tu���&|SrA)rr!r<�	readlinesr�listrC)r=r�lines�lines    rrIzInputWrapper.readlines�st����D�	�	�Q�����$��
�$�d�+����U���t�#�$�$�$��	)�	)�D��D��J�J�%�'�(�(�(�(��r
c#�BK�	|���}|sdS|V��r
)rG)r=rLs  r�__iter__zInputWrapper.__iter__�s3����	��=�=�?�?�D��
����J�J�J�		r
c�&�tdd��dS)Nrz input.close() must not be called�r�r=s r�closezInputWrapper.close�s����5�6�6�6�6�6r
N)	rrrr?rBrGrIrNrRr	r
rr2r2�sn������ � � �������������7�7�7�7�7r
r2c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)r3c��||_dSr
)�errors)r=�wsgi_errorss  rr?zErrorWrapper.__init__��
��!����r
c��tt|��tu��|j�|��dSr
)rrrrU�write�r=�ss  rrYzErrorWrapper.write�s6����Q���3���������!�����r
c�8�|j���dSr
)rU�flushrQs rr]zErrorWrapper.flush�s����������r
c�:�|D]}|�|���dSr
)rY)r=�seqrLs   r�
writelineszErrorWrapper.writelines�s0���	�	�D��J�J�t�����	�	r
c�&�tdd��dS)Nrz!errors.close() must not be calledrPrQs rrRzErrorWrapper.close�s����6�7�7�7�7�7r
N)rrrr?rYr]r`rRr	r
rr3r3�s_������"�"�"����������8�8�8�8�8r
r3c��eZdZd�Zd�ZdS)r'c��||_dSr
)�writer)r=�wsgi_writers  rr?zWriteWrapper.__init__�rWr
c�v�tt|��tu��|�|��dSr
)rrrCrdrZs  r�__call__zWriteWrapper.__call__�s.����Q���5� �!�!�!����A�����r
N)rrrr?rgr	r
rr'r'�s2������"�"�"�����r
r'c��eZdZd�Zd�ZdS)�PartialIteratorWrapperc��||_dSr
�r7)r=�
wsgi_iterators  rr?zPartialIteratorWrapper.__init__s
��%��
�
�
r
c�,�t|jd��Sr
)r5r7rQs rrNzPartialIteratorWrapper.__iter__s���t�}�d�3�3�3r
N)rrrr?rNr	r
rriri�s2������&�&�&�4�4�4�4�4r
ric�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)r5c�X�||_t|��|_d|_||_dS)NF)�original_iterator�iterr7�closed�check_start_response)r=rlrss   rr?zIteratorWrapper.__init__	s.��!.����]�+�+��
����$8��!�!�!r
c��|Sr
r	rQs rrNzIteratorWrapper.__iter__s���r
c���t|jd��t|j��}t	|��t
urtdd|�d���|j�t|jd��d|_|S)NzIterator read after closedFz!Iterator yielded non-bytestring (�)zjThe application returns and we started iterating over its body, but start_response has not yet been called)rrr�nextr7rrCrs)r=rEs  r�__next__zIteratorWrapper.__next__s����D�K��(�	*�	*�	*���������7�7�%����E�E�Q�Q�Q�H�I�I�I��$�0��D�-�|�
~�
~�
~�(,�D�%��r
c�t�d|_t|jd��r|j���dSdS)NTrR)rr�hasattrrprRrQs rrRzIteratorWrapper.closesC������4�)�7�3�3�	+��"�(�(�*�*�*�*�*�	+�	+r
c�|�|jstj�d��t	|jd��dS)Nz/Iterator garbage collected without being closed)rr�sys�stderrrYrrQs r�__del__zIteratorWrapper.__del__#sP���{�	C��J���A�
C�
C�
C����=�	?�	?�	?�	?�	?r
N)rrrr?rNrxrRr~r	r
rr5r5s_������9�9�9����
�
�
�+�+�+�
?�?�?�?�?r
r5c��tt|��tudt|���d|�d���dD]}t||vd|�����dD]#}t||vd|�d|d	d��d
����$d|vrtjdt
��|���D]T}d
|vr�tt||��tud|�dt||���d||�d����Utt|d��tud|d�d���t|ddvd|dz��t|d��t|d��|ddvr#tjd|dzt
��t|�d��p|d�d��d|dz��t|�d��p|d�d��d|dz��|�d ��r0tt|d ��d!kd"|d z��|�d��std|vd#��t|�d��dkd$��dS)%Nz&Environment is not of the right type: z (environment: rv)	�REQUEST_METHOD�SERVER_NAME�SERVER_PORT�wsgi.versionr/r0zwsgi.multithreadzwsgi.multiprocessz
wsgi.run_oncez"Environment missing required key: )�HTTP_CONTENT_TYPE�HTTP_CONTENT_LENGTHz%Environment should not have the key: z (use �z	 instead)�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�.zEnvironmental variable z is not a string: z	 (value: r�z wsgi.version should be a tuple (zwsgi.url_scheme)�http�httpszwsgi.url_scheme unknown: %rr/r0r�)�GET�HEAD�POST�OPTIONS�PATCH�PUT�DELETE�TRACEzUnknown REQUEST_METHOD: %r�SCRIPT_NAME�/z$SCRIPT_NAME doesn't start with /: %r�	PATH_INFOz"PATH_INFO doesn't start with /: %r�CONTENT_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)r6�keys  rr1r1*s����D��M�M�T�!�!���=�=�=�=�'�'�'�	#�$�$�$�!�=�=��	��w���69�c�;�	=�	=�	=�	=�<�1�1����7�"�"�"%�#�#�s�1�2�2�w�w�w�
0�	1�	1�	1�	1��W�$�$��
�
4�
�		�	�	��|�|�~�~�7�7���#�:�:����W�S�\�"�"�c�)�)��s�s�D����&�&�&�&������
6�	7�	7�	7�	7��D���(�)�)�U�2�2�18��1H�1H�1H�J�L�L�L��G�%�&�*;�;�%��0A�(B�B�D�D�D����%�&�&�&����'�(�(�(��� �)M�M�M��
�(�7�3C�+D�D��	�	�	�����M�*�*�*�
6��}�%�0�0��5�5�.���1G�G�I�I�I�����K�(�(�(�
4��{�#�.�.�s�3�3�,�w�{�/C�C�E�E�E��{�{�#�$�$�F���G�,�-�.�.�!�3�(�7�3C�+D�D�	F�	F�	F��;�;�}�%�%�?���w�&�
>�	?�	?�	?��G�K�K�
�&�&�#�-�	"�#�#�#�#�#r
c�X�dD]&}tt||��d|�d|�����'dS)N)rBrGrIrNzwsgi.input (�) doesn't have the attribute �rrz)r>�attrs  rr�r�ksQ��=�"�"����
�D�)�)�)��z�z�4�4�
!�	"�	"�	"�	"�"�"r
c�X�dD]&}tt||��d|�d|�����'dS)N)r]rYr`z
wsgi.errors (r�r�)rVr�s  rr�r�qsQ��0�#�#�����T�*�*�*��{�{�D�D�
"�	#�	#�	#�	#�#�#r
c�n�t|d��}|�dd��d}tt|��dkd|z��t	|��}t|dkd|z��t|��dks|dd	krtjd
|zt��dSdS)N�Statusr rrz)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�splitrr!r�r�r�r)r)�status_code�
status_ints   rr"r"ws���
�v�x�
0�
0�F��,�,�t�Q�'�'��*�K��C�����!�3�k�A�C�C�C��[�!�!�J��J�#��;�j�H�I�I�I�
�6�{�{�Q���&��)�s�*�*��
�
B��
�!�	#�	#�	#�	#�	#�+�*r
c
��tt|��tud|�dt|������|D�]�}tt|��tud|�dt|������tt	|��dk��|\}}t|d��}t|d��}t|���dkd	|z��td
|vod|vd|z��tt�|��d
|z��t|�	d��o|�	d��d|z��t�|��rBtdd|�dt�|���d���d������dS)Nz	Headers (z) must be of type list: zIndividual headers (z) must be of type tuple: r�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 '_': %rrzBad header value: z (bad char: rv)rrrJr�r!r�lower�	header_re�search�endswith�bad_header_value_re�group)r*�item�namers    rr#r#�s����D��M�M�T�!�!��7�7�D��M�M�M�	#�$�$�$��C�C����T�
�
�e�#�#��t�t�T�$�Z�Z�Z�
!�	"�	"�	"�	��D�	�	�Q��������e� ��}�5�5��!�%��8�8����
�
����(�
�"�
#�	$�	$�	$�	��D� �4�S��_�;�d�B�	D�	D�	D��	� � ��&�&�(=��(D�E�E�E��D�M�M�#�&�&�&�A�t�}�}�S�/A�/A�+A�1�D�8�	:�	:�	:��%�%�e�,�,�	C��A�A��u�u�)�0�0��7�7�=�=�a�@�@�@�@�B�
C�
C�
C��%C�Cr
c�B�t|d��}t|�dd��d��}d}|D]G\}}t|d��}|���dkr||vrdSt	dd|z���H||vrt	dd|z��dSdS)	Nr�r r)��i0r�zcontent-typezJContent-Type header found in a %s response, which must not return content.z,No Content-Type header found in headers (%s))rr�r�r�r)r)r*�code�NO_MESSAGE_BODYr�rs      rr$r$�s���
�v�x�
0�
0�F��v�|�|�D�!�$�$�Q�'�(�(�D�!�O��B�B���e� ��}�5�5���:�:�<�<�>�)�)��?�*�*�����A�9�<@�A�
B�
B�
B���?�"�"���A�G�K�L�L�L�L�L�#�"r
c	�|�t|dupt|��tud|�dt|������dS)Nz
exc_info (z) is not a tuple: )rrr�)r+s rr%r%�sO���H���7��X���%� 7��.6�h�h��X����G�I�I�I�I�Ir
c�\�tt|ttf��d��dS)NzwYou should not return a string as your application iterator, instead return a single-item list containing a bytestring.)r�
isinstancerrCrks rr4r4�s>���
�8�c�5�\�2�2�2�	E�F�F�F�F�Fr
)�__all__�rer|r��compiler�r��Warningrrrrr2r3r'rir5r1r�r�r"r#r$r%r4r	r
r�<module>r�s��
i�T�-��
�	�	�	�
�
�
�
������B�J�3�4�4�	� �b�j��0�0�������'����
$�$�$�H�H�H�5�5�5�n!7�!7�!7�!7�!7�!7�!7�!7�F8�8�8�8�8�8�8�8�&��������4�4�4�4�4�4�4�4�!?�!?�!?�!?�!?�!?�!?�!?�F?#�?#�?#�B"�"�"�#�#�#�#�#�#�C�C�C�2M�M�M� I�I�I�
F�F�F�F�Fr

?>