403Webshell
Server IP : 138.197.107.151  /  Your IP : 216.73.217.120
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : wpbetasites_mrakzqskir ( 1022)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/h11/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/h11/__pycache__/_connection.cpython-312.pyc
�

t0c�g���ddlmZmZmZmZmZmZmZmZm	Z	ddl
mZmZm
Z
mZmZmZmZddlmZmZmZddlmZmZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)dd	l*m+Z+m,Z,gd
�Z-Gd�de)e)�
�Z.Gd�de)e)�
�Z/dZ0de	eefde1fd�Z2de3de	eefdee4e	edee5fffd�Z6Gd�d�Z7y)�)	�Any�Callable�cast�Dict�List�Optional�Tuple�Type�Union�)�ConnectionClosed�Data�EndOfMessage�Event�InformationalResponse�Request�Response)�get_comma_header�has_expect_100_continue�set_comma_header)�READERS�ReadersType)�
ReceiveBuffer)
�_SWITCH_CONNECT�_SWITCH_UPGRADE�CLIENT�ConnectionState�DONE�ERROR�MIGHT_SWITCH_PROTOCOL�	SEND_BODY�SERVER�SWITCHED_PROTOCOL)�LocalProtocolError�RemoteProtocolError�Sentinel)�WRITERS�WritersType)�
Connection�	NEED_DATA�PAUSEDc��eZdZy)r*N��__name__�
__module__�__qualname__���1/usr/lib/python3/dist-packages/h11/_connection.pyr*r*(���r2r*)�	metaclassc��eZdZy)r+Nr-r1r2r3r+r+,r4r2r+i@�event�returnc�\�t|jd�}d|vryt|dd�dkryy)N�
connection�closeF�http_version�1.1T)r�headers�getattr)r7�
connections  r3�_keep_aliverAHs4��!�%�-�-��?�J��:����u�n�f�-��6��r2�request_methodr1c��t|�ttfvsJ�t|�turB|jdvs"|dk(s|dk(rd|jcxkrdkryny|jdk\sJ�t	|j
d�}|r	|dgk(sJ�y	t	|j
d
�}|rdt
|d�ffSt|�turyy
)N)��i0�HEAD�CONNECT���,)�content-length)r�transfer-encoding�chunked)�chunkedr1�content-lengthrIr)�http/1.0r1)�typerr�status_coderr>�int)rBr7�transfer_encodings�content_lengthss    r3�
_body_framingrTQs�����;�7�H�-�-�-�-��E�{�h������+���(��*�,���8I�8I�1O�C�1O�+�2P�+�� � �C�'�'�'�*�%�-�-�9M�N���!�j�\�1�1�1��'�u�}�}�6G�H�O�� �3��q�'9�#:�"<�=�=��E�{�g��'�r2c�0�eZdZdZefdeededdfd�Ze	de
eeeeffd��Ze	deefd��Ze	deefd	��Z
e	defd
��Zd d�Zdeeddfd
�Zdedeeefd�Zdeededdfd�Zdeedeedeeefdeedeffd�Z	d!de
eeeefdeeddfd�Ze	deeeffd��Zdeddfd�Z deeee!ee"ffd�Z#deeee!ee"ffd�Z$dedeefd�Z%dedee&efd�Z'd d�Z(de)de)fd�Z*y)"r)aBAn object encapsulating the state of an HTTP connection.

    Args:
        our_role: If you're implementing a client, pass :data:`h11.CLIENT`. If
            you're implementing a server, pass :data:`h11.SERVER`.

        max_incomplete_event_size (int):
            The maximum number of bytes we're willing to buffer of an
            incomplete event. In practice this mostly sets a limit on the
            maximum size of the request/response line + headers. If this is
            exceeded, then :meth:`next_event` will raise
            :exc:`RemoteProtocolError`.

    �our_role�max_incomplete_event_sizer8Nc��||_|ttfvrtdj	|���||_||turt|_nt|_t�|_|j|j
dt�|_|j|jdt�|_
t�|_d|_d|_d|_d|_y)Nz#expected CLIENT or SERVER, not {!r}F)�_max_incomplete_event_sizerr"�
ValueError�formatrV�
their_roler�_cstate�_get_io_objectr'�_writerr�_readerr�_receive_buffer�_receive_buffer_closed�their_http_version�_request_method�"client_is_waiting_for_100_continue)�selfrVrWs   r3�__init__zConnection.__init__�s���
+D��'��F�F�+�+��B�I�I�(�S�T�T� ��
���v��$�D�O�$�D�O�&�(����*�*�4�=�=�$��H����*�*�4�?�?�D�'�J��� -����',��#�48���04���38��/r2c�@�t|jj�S)z�A dictionary like::

           {CLIENT: <client state>, SERVER: <server state>}

        See :ref:`state-machine` for details.

        )�dictr]�states�rfs r3rjzConnection.states�s���D�L�L�'�'�(�(r2c�H�|jj|jS)zjThe current state of whichever role we are playing. See
        :ref:`state-machine` for details.
        )r]rjrVrks r3�	our_statezConnection.our_state�s��
�|�|�"�"�4�=�=�1�1r2c�H�|jj|jS)znThe current state of whichever role we are NOT playing. See
        :ref:`state-machine` for details.
        )r]rjr\rks r3�their_statezConnection.their_state�s��
�|�|�"�"�4�?�?�3�3r2c�B�|jtuxr|jS�N)r\rrerks r3�!they_are_waiting_for_100_continuez,Connection.they_are_waiting_for_100_continue�s�����&�(�T�T�-T�-T�Tr2c���t|jj�}|jj�d|_|j
rJ�|j
|�y)a�Attempt to reset our connection state for a new request/response
        cycle.

        If both client and server are in :data:`DONE` state, then resets them
        both to :data:`IDLE` state in preparation for a new request/response
        cycle on this same connection. Otherwise, raises a
        :exc:`LocalProtocolError`.

        See :ref:`keepalive-and-pipelining`.

        N)rir]rj�start_next_cyclerdre�_respond_to_state_changes)rf�
old_statess  r3rtzConnection.start_next_cycle�sO���$�,�,�-�-�.�
����%�%�'�#����:�:�:�:��&�&�z�2r2�rolec��t|jj�}|jj|�|j	|�yrq)rir]rj�
process_errorru)rfrwrvs   r3�_process_errorzConnection._process_error�s6���$�,�,�-�-�.�
����"�"�4�(��&�&�z�2r2r7c���t|�tur|jdk(rtSt|�tur9t
|jjvrd|jcxkr
dkrt
Syy)N�erGrH)rOrrPrrrr]�pending_switch_proposals)rfr7s  r3�_server_switch_eventzConnection._server_switch_event�sc����;�/�/�E�4E�4E��4L�"�"���;�(�"��4�<�<�#H�#H�H��5�,�,�2�s�2�&�&�3�r2c�Z�t|jj�}|turtt	|�t
urc|jdk(r|jjt�t|jd�r|jjt�d}|tur|j|�}|jj|t	|�|�t	|�t
ur|j|_||j urOt	|�t
t"t$fvr3t't(t
t"t$f|�}|j*|_t	|�t
t"fvr@t/t't(t
t"f|��s|jj1�t	|�t
urt3|�rd|_t	|�t$t"fvrd|_|turt	|�t6t8fvrd|_|j;||�y)NrFsupgradeTF)rir]rjrrOr�method�process_client_switch_proposalrrr>rr"r~�
process_eventrdr\rrrrr<rcrA�process_keep_alive_disabledrrerrru)rfrwr7rv�server_switch_events     r3�_process_eventzConnection._process_events����$�,�,�-�-�.�
��6�>�d�5�k�W�4��|�|�z�)����;�;�O�L���
�
�z�:����;�;�O�L�"���6�>�"&�";�";�E�"B�����"�"�4��e��6I�J���;�'�!�#(�<�<�D� ��4�?�?�"�t�E�{���!�7
�(
�
��w��2G�G�H�%�P�E�&+�&8�&8�D�#���;�7�H�-�-�k���w��(�)�5�1�7
�
�L�L�4�4�6���;�'�!�&=�e�&D�6:�D�3���;�0�(�;�;�6;�D�3��6�>�d�5�k�d�L�-A�A�6;�D�3��&�&�z�5�9r2�io_dict.c��|jj|}|turQtt	t
|j�t	tttf|��\}}|t||�S|j||f�Srq)r]rjr!rTr�bytesrdrrr�get)rfrwr7r��state�framing_type�argss       r3r^zConnection._get_io_object4s������#�#�D�)���I��"/��U�D�0�0�1�4��g�x�>O�8P�RW�3X�"��L�$�4�7�9�%�l�3�T�:�:��;�;��e�}�-�-r2rvc��|j||jk7r&|j|j|t�|_|j
||jk7r'|j|j|t�|_yyrq)	rmrVr^r'r_ror\rr`)rfrvr7s   r3ruz$Connection._respond_to_state_changesJsi���>�>�Z��
�
�6�6��.�.�t�}�}�e�W�M�D�L����z�$�/�/�:�:��.�.�t����w�O�D�L�;r2c�D�t|j�|jfS)abData that has been received, but not yet processed, represented as
        a tuple with two elements, where the first is a byte-string containing
        the unprocessed data itself, and the second is a bool that is True if
        the receive connection was closed.

        See :ref:`switching-protocols` for discussion of why you'd want this.
        )r�rarbrks r3�
trailing_datazConnection.trailing_dataUs ���d�*�*�+�T�-H�-H�I�Ir2�datac�p�|r-|jrtd��|xj|z
c_yd|_y)a�Add data to our internal receive buffer.

        This does not actually do any processing on the data, just stores
        it. To trigger processing, you have to call :meth:`next_event`.

        Args:
            data (:term:`bytes-like object`):
                The new data that was just received.

                Special case: If *data* is an empty byte-string like ``b""``,
                then this indicates that the remote side has closed the
                connection (end of file). Normally this is convenient, because
                standard Python APIs like :meth:`file.read` or
                :meth:`socket.recv` use ``b""`` to indicate end-of-file, while
                other failures to read are indicated using other mechanisms
                like raising :exc:`TimeoutError`. When using such an API you
                can just blindly pass through whatever you get from ``read``
                to :meth:`receive_data`, and everything will work.

                But, if you have an API where reading an empty string is a
                valid non-EOF condition, then you need to be aware of this and
                make sure to check for such strings and avoid passing them to
                :meth:`receive_data`.

        Returns:
            Nothing, but after calling this you should call :meth:`next_event`
            to parse the newly received data.

        Raises:
            RuntimeError:
                Raised if you pass an empty *data*, indicating EOF, and then
                pass a non-empty *data*, indicating more data that somehow
                arrived after the EOF.

                (Calling ``receive_data(b"")`` multiple times is fine,
                and equivalent to calling it once.)

        z(received close, then received more data?TN)rb�RuntimeErrorra)rfr�s  r3�receive_datazConnection.receive_data`s6��N��*�*�"�#M�N�N�� � �D�(� �*.�D�'r2c��|j}|tur|jrtS|tus|t
urtS|j�J�|j
|j�}|�S|jsG|jr;t|jd�r|jj�}n
t�}|�t}|S)N�read_eof)rorrar+r r#r`rb�hasattrr�r
r*)rfr�r7s   r3�_extract_next_receive_eventz&Connection._extract_next_receive_event�s���� � ��
�D�=�T�1�1��M��)�)�U�6G�-G��M��|�|�'�'�'����T�1�1�2���=��'�'�D�,G�,G�
�4�<�<��4� �L�L�1�1�3�E�,�.�E��=��E��r2c��|jturtd��	|j�}|tt
fvr*|j
|jtt|��|turFt|j�|jkDr
tdd���|jrtd��|S#t$rG}|j|j�t!|t"�r|j%�n�Yd}~yd}~wwxYw)aFParse the next event out of our receive buffer, update our internal
        state, and return it.

        This is a mutating operation -- think of it like calling :func:`next`
        on an iterator.

        Returns:
            : One of three things:

            1) An event object -- see :ref:`events`.

            2) The special constant :data:`NEED_DATA`, which indicates that
               you need to read more data from your socket and pass it to
               :meth:`receive_data` before this method will be able to return
               any more events.

            3) The special constant :data:`PAUSED`, which indicates that we
               are not in a state where we can process incoming data (usually
               because the peer has finished their part of the current
               request/response cycle, and you have not yet called
               :meth:`start_next_cycle`). See :ref:`flow-control` for details.

        Raises:
            RemoteProtocolError:
                The peer has misbehaved. You should close the connection
                (possibly after sending some kind of 4xx response).

        Once this method returns :class:`ConnectionClosed` once, then all
        subsequent calls will also return :class:`ConnectionClosed`.

        If this method raises any exception besides :exc:`RemoteProtocolError`
        then that's a bug -- if it happens please file a bug report!

        If this method raises any exception then it also sets
        :attr:`Connection.their_state` to :data:`ERROR` -- see
        :ref:`error-handling` for discussion.

        z+Can't receive data when peer state is ERRORzReceive buffer too longi�)�error_status_hintz#peer unexpectedly closed connectionN)rorr%r�r*r+r�r\rr�lenrarYrb�
BaseExceptionrz�
isinstancer$�!_reraise_as_remote_protocol_error)rfr7�excs   r3�
next_eventzConnection.next_event�s���P���u�$�%�&S�T�T�	��4�4�6�E��Y��/�/��#�#�D�O�O�T�%��5G�H��	�!��t�+�+�,�t�/N�/N�N�.�1�S����.�.�.�.S�T�T��L���	�������0��#�1�2��5�5�7��8��	�s�BB7�7	D�=D�Dc�L�|j|�}|�ydj|�S)a�Convert a high-level event into bytes that can be sent to the peer,
        while updating our internal state machine.

        Args:
            event: The :ref:`event <events>` to send.

        Returns:
            If ``type(event) is ConnectionClosed``, then returns
            ``None``. Otherwise, returns a :term:`bytes-like object`.

        Raises:
            LocalProtocolError:
                Sending this event at this time would violate our
                understanding of the HTTP/1.1 protocol.

        If this method raises any exception then it also sets
        :attr:`Connection.our_state` to :data:`ERROR` -- see
        :ref:`error-handling` for discussion.

        Nr2)�send_with_data_passthrough�join)rfr7�	data_lists   r3�sendzConnection.send�s,��*�3�3�E�:�	�����8�8�I�&�&r2c�n�|jturtd��	t|�tur|j|�}|j}|j|j|�t|�tury|�J�g}|||j�|S#|j|j��xYw)ahIdentical to :meth:`send`, except that in situations where
        :meth:`send` returns a single :term:`bytes-like object`, this instead
        returns a list of them -- and when sending a :class:`Data` event, this
        list is guaranteed to contain the exact object you passed in as
        :attr:`Data.data`. See :ref:`sendfile` for discussion.

        z'Can't send data when our state is ERRORN)rmrr$rOr�&_clean_up_response_headers_for_sendingr_r�rVr
�appendrz)rfr7�writerr�s    r3r�z%Connection.send_with_data_passthroughs����>�>�U�"�$�%N�O�O�	��E�{�h�&��C�C�E�J���\�\�F�����
�
�u�5��E�{�.�.���)�)�)�)+�	��u�i�.�.�/� � ��	�����
�
�.��s�AB�;B�B4c�:�|j|j�y)z�Notify the state machine that we failed to send the data it gave
        us.

        This causes :attr:`Connection.our_state` to immediately become
        :data:`ERROR` -- see :ref:`error-handling` for discussion.

        N)rzrVrks r3�send_failedzConnection.send_failed's��	
���D�M�M�*r2�responsec�z�t|�tusJ�|j}d}tt|j
�}|dk(rd}t
||�\}}|dvrUt|dg�}|j�|jdkrt|dg�}|j
dk7rd}nt|dd	g�}|jjr|rMtt|d
��}|jd�|jd�t|d
t|��}t||j |j"|j$�
�S)NFrEsGET)rLrNrMr=rJTrKr:s
keep-aliver;)r>rPr<�reason)rOrr>rr�rdrTrrcr]�
keep_alive�setr�discard�add�sortedrPr<r�)rfr�r>�
need_close�method_for_choosing_headersr��_r@s        r3r�z1Connection._clean_up_response_headers_for_sending@s9���H�~��)�)�)��"�"���
�'+�5�$�2F�2F�&G�#�&�'�1�*0�'�'�(C�X�N���a��2�2�'�w�0A�2�F�G��&�&�.�$�2I�2I�F�2R�
+�7�4H�"�M��
�'�'�7�2�!%�J�*�7�4H�:�,�W���|�|�&�&�*��-�g�}�E�F�J����}�-��N�N�8�$�&�w�
�v�j�?Q�R�G��� �,�,�!�.�.��?�?�	
�	
r2)r8Nrq)+r.r/r0�__doc__�!DEFAULT_MAX_INCOMPLETE_EVENT_SIZEr
r&rQrg�propertyrrjrmro�boolrrrtrzrrr~r�rrr(rrr^rur	r�r�r�r*r+r�r�r�rr�r�rr�r1r2r3r)r)�sg��
�$*K�%8��x�.�%8�$'�%8�
�	%8�N�)��T�(�^�T�(�^�;�<�)��)��2�4��>�2��2��4�T�(�^�4��4��U�4�U��U�3�(3�4��>�3�d�3�
	�%�	�H�T�(�^�4L�	�.:�4��>�.:�%�.:�D�.:�`.��8�n�.����.��{�K�/�0�	.�

�(�3��8�$�	%�.�2"&�	P���h���h��7�8�	P����	P�
�		P��J�u�U�D�[�1�J��J�,/��,/�4�,/�\�	�u�d�9�o�t�F�|�3�	4��8?�E�%��i��$�v�,�"F�G�?�B'�%�'�H�U�O�'�6���(�4��;�:O��B+�29
�x�9
�H�9
r2r)N)8�typingrrrrrrr	r
r�_eventsr
rrrrrr�_headersrrr�_readersrr�_receivebufferr�_staterrrrrrr r!r"r#�_utilr$r%r&�_writersr'r(�__all__r*r+r�r�rAr��strrQrTr)r1r2r3�<module>r�s���Q�P�P����R�Q�*�)������
+�0��	��H�	�	�X��	�%.�!��u�W�h�.�/��D��0 ��0 �"'���(9�":�0 �
�3��e�B�i��s��+�,�,�-�0 �tn
�n
r2

Youez - 2016 - github.com/yon3zu
LinuXploit