+
    Dih                     J   ^ RI HtHtHtHtHtHtHtHtH	t	H
t
 ^RIHtHtHtHtHtHtHt ^RIHtHtHt ^RIHtHt ^RIHt ^RIHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t& ^RI'H(t(H)t)H*t* ^RI+H,t,H-t- . ROt. ! R R
]*]*R7      t/ ! R R]*]*R7      t0Rt1R R lt2R R lt3 ! R R	4      t4R# )    )
AnyCallablecastDictListOptionaloverload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                       ] tR t^3tRtR# )r*    N__name__
__module____qualname____firstlineno____static_attributes__r-       m/Users/tonyclaw/.openclaw/workspace/services/omi-webhook/venv/lib/python3.14/site-packages/h11/_connection.pyr*   r*   3       r4   )	metaclassc                       ] tR t^7tRtR# )r+   r-   Nr.   r-   r4   r5   r+   r+   7   r6   r4   c                R    V ^8  d   QhR\         \        \        3,          R\        /#    eventreturn)r   r   r   bool)formats   "r5   __annotate__r@   T   s$      uWh./ D r4   c                 l    \        V P                  R 4      pRV9   d   R# \        V RR4      R8  d   R# R# )
   connection   closeFhttp_version   1.1T)r   headersgetattr)r<   
connections   & r5   _keep_aliverI   T   s4    !%--?J:unf-6r4   c                    V ^8  d   QhR\         R\        \        \        3,          R\        \
        \        \        R,          \        \        ,          3,          3,          /# )r;   request_methodr<   r=   r-   )bytesr   r   r   r
   strint)r?   s   "r5   r@   r@   ]   sJ     0  0 0 "'(9":0 
3eBis+,,-0 r4   c                    \        V4      \        \        39   g   Q h\        V4      \        J dQ   VP                  R9   g+   V R8X  g$   V R8X  d   ^VP                  u;8:  d   R8  d   M MR	# VP                  ^8  g   Q h\	        VP
                  R4      pV'       d   VR.8X  g   Q hR
# \	        VP
                  R4      pV'       d   R\        V^ ,          4      33# \        V4      \        J d   R	# R# )      HEAD   CONNECT,  content-length   transfer-encoding   chunked   content-length)rP   i0  )rT   )r   )chunkedr-   )http/1.0r-   )typer   r   status_coder   rF   rN   )rK   r<   transfer_encodingscontent_lengthss   &&  r5   _body_framingr^   ]   s     ;7H---- E{h+(*,8I8I1OC1O++   C''' *%--9MN!j\111 'u}}6GHO 3q'9#:"<== E{g''r4   c                   
  a  ] tR t^t o Rt]3V 3R lR llt]V 3R lR l4       t]V 3R lR l4       t	]V 3R lR	 l4       t
]V 3R
 lR l4       tV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltR0V 3R lR llt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR  lt]V 3R! lR" l4       t]V 3R# lR$ l4       t]V 3R% lR& l4       tV 3R' lR( ltV 3R) lR* ltV 3R+ lR, ltV 3R- lR. ltR/tV tR# )1r)   a  An 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`.

c                :   < V ^8  d   QhRS[ S[,          RS[RR/# )r;   our_rolemax_incomplete_event_sizer=   N)r   r&   rN   )r?   __classdict__s   "r5   r@   Connection.__annotate__   s-     %8 %8x.%8 $'%8 
	%8r4   c                   W n         V\        \        39  d   \        R V: 24      hWn        V  V\        J d   \        V n        M\        V n        \        4       V n        V P                  V P                  R\        4      V n
        V P                  V P
                  R\        4      V n        \        4       V n        RV n        RV n        RV n        RV n        R# )zexpected CLIENT or SERVER, not NF)_max_incomplete_event_sizer   r"   
ValueErrorra   
their_roler   _cstate_get_io_objectr'   _writerr   _readerr   _receive_buffer_receive_buffer_closedtheir_http_version_request_method"client_is_waiting_for_100_continue)selfra   rb   s   &&&r5   __init__Connection.__init__   s    
 +D'FF++>xlKLL v$DO$DO&( **4==$H**4??D'J  - ',# 4804 38/r4   c                V   < V ^8  d   QhRS[ S[S[,          S[S[,          3,          /# r;   r=   )r   r   r&   )r?   rc   s   "r5   r@   rd      s&     ) )T(^T(^;< )r4   c                @    \        V P                  P                  4      # )zqA dictionary like::

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

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

)dictri   statesrr   s   &r5   ry   Connection.states   s     DLL''((r4   c                0   < V ^8  d   QhRS[ S[,          /# rv   r   r&   )r?   rc   s   "r5   r@   rd      s     2 24> 2r4   c                P    V P                   P                  V P                  ,          # )zZThe current state of whichever role we are playing. See
:ref:`state-machine` for details.
)ri   ry   ra   rz   s   &r5   	our_stateConnection.our_state   s    
 ||""4==11r4   c                0   < V ^8  d   QhRS[ S[,          /# rv   r}   )r?   rc   s   "r5   r@   rd      s     4 4T(^ 4r4   c                P    V P                   P                  V P                  ,          # )z^The current state of whichever role we are NOT playing. See
:ref:`state-machine` for details.
)ri   ry   rh   rz   s   &r5   their_stateConnection.their_state   s    
 ||""4??33r4   c                    < V ^8  d   QhRS[ /# rv   )r>   )r?   rc   s   "r5   r@   rd      s     U U4 Ur4   c                N    V P                   \        J ;'       d    V P                  # N)rh   r   rq   rz   s   &r5   !they_are_waiting_for_100_continue,Connection.they_are_waiting_for_100_continue   s    &(TTT-T-TTr4   c                   < V ^8  d   QhRR/# r;   r=   Nr-   )r?   rc   s   "r5   r@   rd      s     3 3$ 3r4   c                    \        V P                  P                  4      pV P                  P                  4        RV n        V P
                  '       d   Q hV P                  V4       R# )aI  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)rx   ri   ry   start_next_cyclerp   rq   _respond_to_state_changes)rr   
old_statess   & r5   r   Connection.start_next_cycle   sR     $,,--.
%%'# :::::&&z2r4   c                4   < V ^8  d   QhRS[ S[,          RR/# )r;   roler=   Nr}   )r?   rc   s   "r5   r@   rd      s     3 34> 3d 3r4   c                    \        V P                  P                  4      pV P                  P                  V4       V P	                  V4       R # r   )rx   ri   ry   process_errorr   )rr   r   r   s   && r5   _process_errorConnection._process_error   s6    $,,--.
""4(&&z2r4   c                F   < V ^8  d   QhRS[ RS[S[S[,          ,          /# r:   )r   r   r   r&   )r?   rc   s   "r5   r@   rd     s$     	 	% 	HT(^4L 	r4   c                   \        V4      \        J d   VP                  ^e8X  d   \        # \        V4      \        J dC   \
        V P                  P                  9   d$   ^VP                  u;8:  d   R8  d    \
        #  R# R# )e   rS   N)rZ   r   r[   r   r   r   ri   pending_switch_proposalsrr   r<   s   &&r5   _server_switch_eventConnection._server_switch_event  sc    ;//E4E4E4L"";("4<<#H#HH5,,2s2&& 3 r4   c                :   < V ^8  d   QhRS[ S[,          RS[RR/# )r;   r   r<   r=   N)r   r&   r   )r?   rc   s   "r5   r@   rd     s&     .: .:4> .:% .:D .:r4   c                   \        V P                  P                  4      pV\        J d   \	        V4      \
        J dl   VP                  R 8X  d    V P                  P                  \        4       \        VP                  R4      '       d    V P                  P                  \        4       RpV\        J d   V P                  V4      pV P                  P                  V\	        V4      V4       \	        V4      \
        J d   VP                  V n        WP                   J dW   \	        V4      \
        \"        \$        39   d8   \'        \(        \
        \"        \$        3,          V4      pVP*                  V n        \	        V4      \
        \"        39   dK   \/        \'        \(        \
        \"        3,          V4      4      '       g   V P                  P1                  4        \	        V4      \
        J d   \3        V4      '       d   RV n        \	        V4      \$        \"        39   d   RV n        V\        J d"   \	        V4      \6        \8        39   d   RV n        V P;                  W24       R# )rR   s   upgradeNTF)rx   ri   ry   r   rZ   r   methodprocess_client_switch_proposalr   r   rF   r   r"   r   process_eventrp   rh   r   r   r   r   rD   ro   rI   process_keep_alive_disabledr   rq   r   r   r   )rr   r   r<   r   server_switch_events   &&&  r5   _process_eventConnection._process_event  s    $,,--.
6>d5kW4||z);;OLz::;;OL"6>"&";";E"B""4e6IJ ;'!#(<<D ??"tE{!7
 (

 w2GGH%PE&+&8&8D# ;7H--kw()517
 7
 LL446 ;'!&=e&D&D6:D3;0(;;6;D36>d5kdL-AA6;D3&&z9r4   c                   < V ^8  d   QhRS[ S[,          RS[S[,          RS[S[S[3,          RS[S[RS[3,          ,          /# )r;   r   r<   io_dictr=   .)	r   r&   r   r   r   r   r(   r   r   )r?   rc   s   "r5   r@   rd   @  sS     . .8n. . {K/0	.
 
(38$	%.r4   c                .   V P                   P                  V,          pV\        J d^   \        \	        \
        V P                  4      \	        \        \        \        3,          V4      4      w  rVV\        ,          V,          ! V!  # VP                  W34      # r   )ri   ry   r!   r^   r   rL   rp   r   r   r   get)rr   r   r<   r   stateframing_typeargss   &&&&   r5   rj   Connection._get_io_object@  s}     ##D)I "/UD0014gx>O8PRW3X"L 9%l3T:: ;;}--r4   Nc                p   < V ^8  d   QhRS[ S[S[,          S[S[,          3,          RS[S[,          RR/# )r;   r   r<   r=   N)r   r   r&   r   r   )r?   rc   s   "r5   r@   rd   V  sD     	P 	Phh78	P 	P 
		Pr4   c                &   V P                   WP                  ,          8w  d'   V P                  V P                  V\        4      V n        V P
                  WP                  ,          8w  d)   V P                  V P                  V\        4      V n        R # R # r   )	r   ra   rj   r'   rk   r   rh   r   rl   )rr   r   r<   s   &&&r5   r   $Connection._respond_to_state_changesV  se     >>Z66..t}}eWMDLz//::..twODL ;r4   c                6   < V ^8  d   QhRS[ S[S[3,          /# rv   )r
   rL   r>   )r?   rc   s   "r5   r@   rd   b  s      J JuUD[1 Jr4   c                D    \        V P                  4      V P                  3# )a:  Data 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.
)rL   rm   rn   rz   s   &r5   trailing_dataConnection.trailing_dataa  s      d**+T-H-HIIr4   c                $   < V ^8  d   QhRS[ RR/# )r;   datar=   N)rL   )r?   rc   s   "r5   r@   rd   l  s     ,/ ,/ ,/4 ,/r4   c                    V'       d9   V P                   '       d   \        R4      hV ;P                  V,          un        R# RV n         R# )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)rn   RuntimeErrorrm   )rr   r   s   &&r5   receive_dataConnection.receive_datal  s9    N ***"#MNN  D( *.D'r4   c                Z   < V ^8  d   QhRS[ S[S[S[,          S[S[,          3,          /# rv   r   r   r   r*   r+   )r?   rc   s   "r5   r@   rd     s)      	ud9otF|3	4r4   c                   V P                   pV\        J d   V P                  '       d   \        # V\        J g   V\
        J d   \        # V P                  f   Q hV P                  V P                  4      pVff   V P                  '       gT   V P                  '       dB   \        V P                  R4      '       d   V P                  P                  4       pM
\        4       pVf   \        pV# )Nread_eof)r   r   rm   r+   r    r#   rl   rn   hasattrr   r   r*   )rr   r   r<   s   &  r5   _extract_next_receive_event&Connection._extract_next_receive_event  s       
 D=T111M))U6G-GM||'''T112='''D,G,G,G
 4<<44 LL113E,.E=Er4   c                Z   < V ^8  d   QhRS[ S[S[S[,          S[S[,          3,          /# rv   r   )r?   rc   s   "r5   r@   rd     s(     ? ?E%i$v,"FG ?r4   c                B   V P                   \        J d   \        R4      h V P                  4       pV\        \
        39  d+   V P                  V P                  \        \        V4      4       V\        J dO   \        V P                  4      V P                  8  d   \        RRR7      hV P                  '       d   \        R4      hV#   \         dN   pT P                  T P                  4       \!        T\"        4      '       d   TP%                  4         Rp?R# h Rp?ii ; i)an  Parse 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 ERRORzReceive buffer too longi  )error_status_hintz#peer unexpectedly closed connectionN)r   r   r%   r   r*   r+   r   rh   r   r   lenrm   rf   rn   BaseExceptionr   
isinstancer$   !_reraise_as_remote_protocol_error)rr   r<   excs   &  r5   
next_eventConnection.next_event  s    P u$%&STT	446EY//##DOOT%5GH	!t++,t/N/NN .1S  ... ..STTL 	0#1225577	s%   BC 9C DADDDc                $   < V ^8  d   QhRS[ RR/# )r;   r<   r=   N)r   )r?   rc   s   "r5   r@   rd     s      * t r4   c                    R # r   r-   r   s   &&r5   sendConnection.send      r4   c                H   < V ^8  d   QhRS[ S[S[S[S[S[3,          RS[/# r:   )r   r   r   r   r   r   rL   )r?   rc   s   "r5   r@   rd     s.      7$98T<WX	r4   c                    R # r   r-   r   s   &&r5   r   r     s     	r4   c                6   < V ^8  d   QhRS[ RS[S[,          /# r:   r   r   rL   )r?   rc   s   "r5   r@   rd     s      % HUO r4   c                    R # r   r-   r   s   &&r5   r   r     r   r4   c                6   < V ^8  d   QhRS[ RS[S[,          /# r:   r   )r?   rc   s   "r5   r@   rd     s     ' '% 'HUO 'r4   c                R    V P                  V4      pVf   R# RP                  V4      # )aC  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.

Nr4   )send_with_data_passthroughjoin)rr   r<   	data_lists   && r5   r   r     s,    * 33E:	88I&&r4   c                F   < V ^8  d   QhRS[ RS[S[S[,          ,          /# r:   )r   r   r   rL   )r?   rc   s   "r5   r@   rd      s$       (4;:O r4   c                ~   V P                   \        J d   \        R4      h \        V4      \        J d   V P                  V4      pV P                  pV P                  V P                  V4       \        V4      \        J d   R# Vf   Q h. pV! WP                  4       V#    T P                  T P                  4       h ; i)a@  Identical 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)r   r   r$   rZ   r   &_clean_up_response_headers_for_sendingrk   r   ra   r   appendr   )rr   r<   writerr   s   &&  r5   r   %Connection.send_with_data_passthrough   s     >>U"$%NOO	E{h&CCEJ \\Fu5E{.. ))))+	u../  	.s   AB B B<c                   < V ^8  d   QhRR/# r   r-   )r?   rc   s   "r5   r@   rd   A  s     + +T +r4   c                <    V P                  V P                  4       R# )zNotify 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)r   ra   rz   s   &r5   send_failedConnection.send_failedA  s     	DMM*r4   c                &   < V ^8  d   QhRS[ RS[ /# )r;   responser=   )r   )r?   rc   s   "r5   r@   rd   Z  s     9
 9
x 9
H 9
r4   c                   \        V4      \        J g   Q hVP                  pR p\        \        V P
                  4      pVR8X  d   Rp\        WA4      w  rVVR9   d\   \        VR. 4      pV P                  e   V P                  R8  d"   \        VR. 4      pV P
                  R8w  d   RpM\        VRR.4      pV P                  P                  '       d	   V'       dN   \        \        VR4      4      pVP                  R	4       VP                  R
4       \        VR\        V4      4      p\        VVP                   VP"                  VP$                  R7      # )FrQ   s   GETrW   rE   rU   TrV   rB   s
   keep-aliverC   )rF   r[   rD   reason)rX   rY   )rZ   r   rF   r   rL   rp   r^   r   ro   ri   
keep_alivesetr   discardaddsortedr[   rD   r   )rr   r   rF   
need_closemethod_for_choosing_headersr   _rH   s   &&      r5   r   1Connection._clean_up_response_headers_for_sendingZ  s9   H~)))""
 '+5$2F2F&G#&'1*0''(CN22 'w0A2FG&&.$2I2IF2R
 +74H"M
 ''72!%J*74H:,W||&&&*-g}EFJ}-NN8$&wvj?QRG ,,!..??	
 	
r4   )ri   rf   rl   rm   rn   rp   rk   rq   ra   ro   rh   r   )r/   r0   r1   r2   __doc__!DEFAULT_MAX_INCOMPLETE_EVENT_SIZErs   propertyry   r   r   r   r   r   r   r   rj   r   r   r   r   r   r	   r   r   r   r   r3   __classdictcell__)rc   s   @r5   r)   r)      sG    $ *K%8 %8N ) ) 2 2 4 4 U U3 3(3 3
	 	.: .:`. .,	P 	P J J,/ ,/\ 8? ?B    
  ' '6 B+ +29
 9
r4   N)r)   r*   r+   i @  )5typingr   r   r   r   r   r   r	   r
   r   r   _eventsr   r   r   r   r   r   r   _headersr   r   r   _readersr   r   _receivebufferr   _stater   r   r   r   r   r   r    r!   r"   r#   _utilr$   r%   r&   _writersr'   r(   __all__r*   r+   r   rI   r^   r)   r-   r4   r5   <module>r      s        R Q * )   
 + 0	H 		X 	 %. !0 t|
 |
r4   