403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/werkzeug/middleware/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/werkzeug/middleware/__pycache__/lint.cpython-311.pyc
�

��b�6�	�l�dZddlZddlmZddlmZddlmZddl	m
Z
ddlmZdd	l
mZejrdd
lmZddlmZddlmZGd
�de��ZGd�de��Zefdededejddfd�ZGd�d��ZGd�d��ZGd�d��ZGd�d��ZGd�d��ZdS) a�
WSGI Protocol Linter
====================

This module provides a middleware that performs sanity checks on the
behavior of the WSGI server and application. It checks that the
:pep:`3333` WSGI spec is properly implemented. It also warns on some
common HTTP errors such as non-empty responses for 304 status codes.

.. autoclass:: LintMiddleware

:copyright: 2007 Pallets
:license: BSD-3-Clause
�N)�
TracebackType)�urlparse)�warn�)�Headers)�is_entity_header)�FileWrapper)�
StartResponse)�WSGIApplication)�WSGIEnvironmentc��eZdZdZdS)�WSGIWarningz Warning class for WSGI warnings.N��__name__�
__module__�__qualname__�__doc__���:/usr/lib/python3/dist-packages/werkzeug/middleware/lint.pyrr�������*�*�*�*rrc��eZdZdZdS)�HTTPWarningz Warning class for HTTP warnings.Nrrrrrr"rrr�context�obj�need�returnc	��t|��|ur9t|�d|j�dt|��j�d�td���dSdS)Nz
 requires z, got �.���
stacklevel)�typerrr)rrrs   r�
check_typer$&si���C�y�y������R�R�D�M�R�R�4��9�9�;M�R�R�R���	
�	
�	
�	
�	
�	
��rc��eZdZdejeddfd�Zdejdefd�Zdejdefd�Z	dej
efd�Zd
d	�ZdS)�InputStream�streamrNc��||_dS�N��_stream��selfr's  r�__init__zInputStream.__init__0�
������r�argsc���t|��dkrtdtd���n*t|��dkrtdtd���|jj|�S)Nrz�WSGI does not guarantee an EOF marker on the input stream, thus making calls to 'wsgi.input.read()' unsafe. Conforming servers may never return from this call.rr!�z2Too many parameters passed to 'wsgi.input.read()'.)�lenrrr+�read�r-r0s  rr4zInputStream.read3s���t�9�9��>�>��*���
�
�
�
�
���Y�Y�!�^�^��D���
�
�
�
�
!�t�|� �$�'�'rc���t|��dkrtdtd���n:t|��dkrtdtd���ntd���|jj|�S)Nrz_Calls to 'wsgi.input.readline()' without arguments are unsafe. Use 'wsgi.input.read()' instead.rr!r2z~'wsgi.input.readline()' was called with a size hint. WSGI does not support this, although it's available on all major servers.z5Too many arguments passed to 'wsgi.input.readline()'.)r3rr�	TypeErrorr+�readliner5s  rr8zInputStream.readlineDs����t�9�9��>�>��0���	
�
�
�
�
���Y�Y�!�^�^��O���	
�
�
�
�
��S�T�T�T�$�t�|�$�d�+�+rc��	t|j��S#t$r)tdtd���td��cYSwxYw)Nz'wsgi.input' is not iterable.rr!r)�iterr+r7rr�r-s r�__iter__zInputStream.__iter__WsW��	����%�%�%���	�	�	��0�+�!�L�L�L�L���8�8�O�O�O�	���s��0A	�A	c�f�tdtd���|j���dS)Nz(The application closed the input stream!rr!�rrr+�closer;s rr?zInputStream.close^�3���
7��QR�S�S�S�S���������r�rN)
rrr�t�IO�bytesr.�Anyr4r8�Iteratorr<r?rrrr&r&/s��������q�t�E�{��t�����(�!�%�(�E�(�(�(�(�",�a�e�,��,�,�,�,�&�!�*�U�+����������rr&c�z�eZdZdejeddfd�Zdeddfd�Zdd�Zdej	eddfd	�Z
dd
�ZdS)�ErrorStreamr'rNc��||_dSr)r*r,s  rr.zErrorStream.__init__dr/r�sc�f�td|t��|j�|��dS)Nzwsgi.error.write())r$�strr+�write�r-rJs  rrMzErrorStream.writegs1���'��C�0�0�0�����1�����rc�8�|j���dSr))r+�flushr;s rrPzErrorStream.flushks����������r�seqc�:�|D]}|�|���dSr))rM)r-rQ�lines   r�
writelineszErrorStream.writelinesns0���	�	�D��J�J�t�����	�	rc�f�tdtd���|j���dS)Nz(The application closed the error stream!rr!r>r;s rr?zErrorStream.closerr@rrA)rrrrBrCrLr.rMrP�IterablerTr?rrrrHrHcs��������q�t�C�y��T������s��t����������a�j��o��$����������rrHc�d�eZdZdejegefdejeddfd�Z	deddfd�Z
dS)�GuardedWriterM�chunksrNc�"�||_||_dSr))�_write�_chunks)r-rMrYs   rr.zGuardedWrite.__init__xs���������rrJc��td|t��|�|��|j�t|����dS)Nzwrite())r$rDr[r\�appendr3rNs  r�__call__zGuardedWrite.__call__|sE���9�a��'�'�'����A��������C��F�F�#�#�#�#�#r)rrrrB�CallablerD�object�List�intr.r_rrrrXrXwss�������a�j�%��&��9��1�6�#�;��SW�����$�%�$�D�$�$�$�$�$�$rrXc��eZdZdejedejeefdej	eddfd�Z
dd�Zdefd�Zdd	�Z
dd
�ZdS)
�GuardedIterator�iterator�headers_setrYrNc�p�||_t|��j|_d|_||_||_dS)NF)�	_iteratorr:�__next__�_next�closedrgrY)r-rfrgrYs    rr.zGuardedIterator.__init__�s5��"����(�^�^�,��
����&�������rc��|Sr)rr;s rr<zGuardedIterator.__iter__�s���rc� �|jrtdtd���|���}|jstdtd���td|t��|j�t|����|S)Nz Iterated over closed 'app_iter'.rr!z8The application returned before it started the response.zapplication iterator items)
rlrrrkrgr$rDrYr^r3)r-�rvs  rrjzGuardedIterator.__next__�s����;�	P��3�[�Q�O�O�O�O�
�Z�Z�\�\����	��J���
�
�
�
�	�/��U�;�;�;�����3�r�7�7�#�#�#��	rc��d|_t|jd��r|j���|j�r|j\}}t|j��}|�dt���}|dkrc|D]E\}}|�	��}|dvr(t|��rtd|�d�t���F|rtd	t��dSdSd
|cxkrdksn|dkr<|d
krt|�d�t��|rt|�d�t��dSdS|�||krtdt��dSdSdSdS)NTr?zcontent-length)r#i0)�expireszcontent-locationzEntity header z found in 304 response.z#304 responses must not have a body.�d����rz- responses must have an empty content length.z  responses must not have a body.zGContent-Length and the number of bytes sent to the client do not match.)rl�hasattrrir?rg�sumrY�getrc�lowerrrrr)r-�status_code�headers�
bytes_sent�content_length�key�_values       rr?zGuardedIterator.close�s�������4�>�7�+�+�	#��N� � �"�"�"���	�#'�#3� �K���T�[�)�)�J�$�[�[�)9��[�D�D�N��c�!�!�#*���K�C���)�)�+�+�C��"A�A�A�FV��G�G�A��K�S�K�K�K�[������M��>��L�L�L�L�L�M�M���)�)�)�)�c�)�)�)�)�[�C�-?�-?�!�Q�&�&��&�U�U�U�#�����X��K�I�I�I�;�W�W�W�W�W�X�X��+��*�0L�0L��,�������3	�	�0,�+�0L�0Lrc�f�|js)	tdt��dS#t$rYdSwxYwdS)Nz4Iterator was garbage collected before it was closed.)rlrr�	Exceptionr;s r�__del__zGuardedIterator.__del__�s`���{�	�
��J�K��������
�
�
����
����	�	s� �
.�.)rrerA)rrrrBrVrD�Tuplercrrbr.r<rjr?r�rrrrere�s�������
��*�U�#�
��W�S�'�\�*�
���s��	
�

�
�
�
�
������%�����"#�#�#�#�J�����rrec
�@�eZdZdZdd�Zdd	�Zd
edejej	eefdej
ej	ejeee
fdej	eeffd
�Zdeddfd�Zdejeddfd�Zdejdejdejefd�ZdS)�LintMiddlewarea�Warns about common errors in the WSGI and HTTP behavior of the
    server and wrapped application. Some of the issues it checks are:

    -   invalid status codes
    -   non-bytes sent to the WSGI server
    -   strings returned from the WSGI application
    -   non-empty conditional responses
    -   unquoted etags
    -   relative URLs in the Location header
    -   unsafe calls to wsgi.input
    -   unclosed iterators

    Error information is emitted using the :mod:`warnings` module.

    :param app: The WSGI application to wrap.

    .. code-block:: python

        from werkzeug.middleware.lint import LintMiddleware
        app = LintMiddleware(app)
    �apprrNc��||_dSr))r�)r-r�s  rr.zLintMiddleware.__init__�s
������r�environrc���t|��turtdtd���dD]!}||vrtd|�d�td����"|dd	krtd
td���|�dd��}|�d
d��}|r&|ddkrtd|��td���|r(|ddkrtd|��td���dSdSdS)Nz/WSGI environment is not a standard Python dict.�r!)	�REQUEST_METHOD�SERVER_NAME�SERVER_PORT�wsgi.version�
wsgi.input�wsgi.errorszwsgi.multithreadzwsgi.multiprocessz
wsgi.run_oncezRequired environment key z
 not foundr r�)r2rz"Environ is not a WSGI 1.0 environ.�SCRIPT_NAME��	PATH_INFOr�/z+'SCRIPT_NAME' does not start with a slash: z)'PATH_INFO' does not start with a slash: )r#�dictrrrw)r-r�r}�script_name�	path_infos     r�
check_environzLintMiddleware.check_environ�sc����=�=��$�$��A���
�
�
�
�


�	�	�C��'�!�!��A��A�A�A�� ������
�>�"�f�,�,��5�{�q�Q�Q�Q�Q��k�k�-��4�4���K�K��R�0�0�	��	�;�q�>�S�0�0��M�k�M�M���
�
�
�
��	��1���,�,��I�I�I�I���
�
�
�
�
�
�	�	�,�,r�statusrz�exc_infoc�,�td|t��|�dd��d}t|��dks|���stdtd���t|��dks|ddkrtd	|�d
�td���t|��}|dkrtdtd���t|��turtd
td���|D]�}t|��tust|��dkrtdtd���|\}}t|��tust|��turtdtd���|���dkrtdtd�����|�,t|t��stdtd���t|��}|�|��||fS)Nr�r2rr z!Status code must be three digits.r!r�� zInvalid value for status zJ. Valid status strings are three digits, a space and a status explanation.rrzStatus code < 100 detected.zHeader list is not a list.rz#Header items must be 2-item tuples.z'Header keys and values must be strings.zFThe status header is not supported due to conflicts with the CGI spec.zInvalid value for exc_info.)r$rL�splitr3�	isdecimalrrrcr#�list�tuplerx�
isinstancer�
check_headers)	r-r�rzr��status_code_strry�item�name�values	         r�check_start_responsez#LintMiddleware.check_start_responses.��	�8�V�S�)�)�)� �,�,�t�Q�/�/��2������1�$�$�O�,E�,E�,G�,G�$��4�k�a�P�P�P�P��v�;�;��?�?�f�Q�i�3�.�.��=�F�=�=�=���	
�
�
�
��/�*�*�������.���J�J�J�J���=�=��$�$��-�{�q�I�I�I�I��	�	�D��D�z�z��&�&�#�d�)�)�q�.�.��:�K�TU�V�V�V�V��K�D�%��D�z�z��$�$��U���3�(>�(>��=�{�WX������z�z�|�|�x�'�'��4�� �	�������
�8�U�(C�(C���.���J�J�J�J��'�"�"�����7�#�#�#��G�#�#rc���|�d��}|��|�d��r6|�d��rtdtd���|dd�}|dd�|d	d�cxkrd
ksntdtd���|�d��}|�-t	|��jstd
td���dSdSdS)N�etag)zW/�w/r�z)Weak etag indicator should be upper case.r�r!rr2����"zUnquoted etag emitted.�locationz+Absolute URLs required for location header.)rw�
startswithrrr�netloc)r-rzr�r�s    rr�zLintMiddleware.check_headersNs���{�{�6�"�"�������|�,�,�
 ��?�?�4�(�(���C�#�#$������A�B�B�x����!��H��R�S�S�	�0�0�0�0�S�0�0�0�0��-�{�q�I�I�I�I��;�;�z�*�*�����H�%�%�,�
��A�� ������� ��
�
r�app_iterc�b�t|t��rtdtd���dSdS)Nz�The application returned a bytestring. The response will send one character at a time to the client, which will kill performance. Return a list or iterable instead.r r!)r�rDrr)r-r�s  r�check_iteratorzLintMiddleware.check_iteratorisL���h��&�&�	��6���
�
�
�
�
�
�	�	rr0�kwargsc�������t|��dkrtdtd���|rtdtd���|d}|d���|��t	|d��|d<t|d��|d<t|d	<g�g�d
tjdtjdtj	tgdff����fd
�}��|tjd|����}��
|��t|tjtjt t"f������S)NrzA WSGI app takes two arguments.r!z+A WSGI app does not take keyword arguments.rr2r�r�zwsgi.file_wrapperr0r�rc�l��t|��dvr(tdt|���d�td���|rtdt��|d}|d}t|��d	kr|dnd}��|||���dd�<t	�|||�����S)
N>rr zInvalid number of arguments: z, expected 2 or 3.rr!z1'start_response' does not take keyword arguments.rr2r )r3rrr�rX)	r0r�r�rzr�rYrgr-�start_responses	     ����r�checking_start_responsez8LintMiddleware.__call__.<locals>.checking_start_response�s�����4�y�y��&�&��Q�C��I�I�Q�Q�Q�� ������
W��H�+�V�V�V��q�'�F�15�a��G� ��I�I��N�N��a����
�"�6�6�v�w��Q�Q�K����N����v�w�� I� I�6�R�R�Rrr
)r3rrr�r&rHr	rBrEr`rDr��castr�rer�rcr)	r-r0r�r�r�r�rYrgr�s	`     @@@rr_zLintMiddleware.__call__ss��������t�9�9��>�>��2�K�A�N�N�N�N��	��=�{�WX�
�
�
�
�&*�!�W��*.�q�'�����7�#�#�#� +�G�L�,A� B� B����!,�W�]�-C�!D�!D��
��(3��#�$�%'�� ��	S��5�	S�$%�E�	S�
�Z����
�
&�	S�	S�	S�	S�	S�	S�	S�	S�	S�,�8�8�G�Q�V�O�=T�%U�%U�V�V�����H�%�%�%���a�f�Q�W�S�'�\�2�K�@�@�&�
�
�	
r)r�rrN)r�rrN)rrrrr.r�rLrBrbr��Optional�Type�
BaseExceptionrrcrr�r�rVrDr�rEr_rrrr�r��s=��������,����*�*�*�*�X4$��4$������S��)�*�4$��*�
�G�A�F�=�)�=�-�G�H�
�	4$�
���g��	�4$�4$�4$�4$�l�W�������6�q�z�%�'8��T�����1
�a�e�1
�q�u�1
���E�9J�1
�1
�1
�1
�1
�1
rr�) r�typingrB�typesr�urllib.parser�warningsr�datastructuresr�httpr�wsgir	�
TYPE_CHECKING�_typeshed.wsgir
rr�WarningrrrLrar�r$r&rHrXrer�rrr�<module>r�s?��
�
�����������!�!�!�!�!�!�������$�$�$�$�$�$�#�#�#�#�#�#��������?�/�,�,�,�,�,�,�.�.�.�.�.�.�.�.�.�.�.�.�+�+�+�+�+�'�+�+�+�+�+�+�+�+�'�+�+�+�:=�
�
��
�&�
���
��
�
�
�
�1�1�1�1�1�1�1�1�h��������($�$�$�$�$�$�$�$�M�M�M�M�M�M�M�M�`R
�R
�R
�R
�R
�R
�R
�R
�R
�R
r

Youez - 2016 - github.com/yon3zu
LinuXploit