
    h"                         S SK r SSKJrJrJrJrJrJrJr  SSK	J
r
JrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SS jrSS jrSS jrSS	 jr\\\
\S\0rSS
 jrSS jrSS jr SS jr!SS jr"SS jr#g)    N   )ConnectionClosedDataEndOfMessageEventInformationalResponseRequestResponse)_SWITCH_CONNECT_SWITCH_UPGRADECLIENTCLOSEDConnectionStateDONEIDLEMIGHT_SWITCH_PROTOCOL
MUST_CLOSE	SEND_BODYSEND_RESPONSESERVERSWITCHED_PROTOCOL)LocalProtocolErrorc                     [        5       n U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        [        [        0:X  d   e[        R                  " [        5         U R                  [        [        5        S S S 5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        5        U R                  [        [        [        [        0:X  d   eU R                  [        [         5        U R                  [        ["        [        [$        0:X  d   eg ! , (       d  f       GNP= fN)r   statesr   r   r   process_eventr	   r   r   pytestraisesr   r   r
   r   r   r   r   r   css    F/var/www/html/env/lib/python3.13/site-packages/h11/tests/test_state.pytest_ConnectionStater"      sZ   		B 99vt4444VW%99FMBBBB 
)	*
) 
+99FMBBBBV2399FMBBBBVX&99FI>>>>V\*V\*99vt4444 V-.99VV<<<<# 
+	*s   G//
G>c                     [        5       n U R                  [        [        5        U R	                  5         U R                  [        [
        5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [
        5        U R                  [        [        [        [        0:X  d   eg r   )r   r   r   r	   process_keep_alive_disabledr   r   r   r   r   r
   r   s    r!   test_ConnectionState_keep_aliver%   >   s    		BVW%""$V\*99V]CCCCVX&V\*99VZ@@@@    c                     [        5       n U R                  [        [        5        U R                  [        [        5        U R
                  [           [        L d   eU R                  5         U R
                  [           [        L d   eg r   )	r   r   r   r	   r   r   r   r$   r   r   s    r!   'test_ConnectionState_keep_alive_in_DONEr(   K   sf     
	BVW%V\*99V$$$""$99V
***r&   c                     [         [        4 GH  n S GH  n[        5       nUR                  U 5        UR	                  [
        [        5        UR	                  [
        [        5        UR                  [
        [        [        [        0:X  d   eXR                  ;   d   eU(       a-  UR	                  [        [        5        UR                  (       a   eUR	                  [
        [        5        U(       a)  UR                  [
        [        [        [        0:X  d   eGM  UR                  [
        [         [        [        0:X  d   eUR	                  [        ["        5        UR                  [
        [         [        [        0:X  d   eUR	                  [        [        5        UR                  [
        [        [        [        0:X  d   eUR                  (       d  GM   e   GM     g )N)TF)r   r   r   process_client_switch_proposalr   r   r	   r   r   r   r   r   pending_switch_proposalsr
   r   r   r   r   )switch_type
deny_earlyr    s      r!   "test_ConnectionState_switch_deniedr.   W   sm   '9'J "B--k:VW-VT*99FM JJJJ"="====  26666V\2yyVT69$EEEEyy1M%   
   )>?yy1M%   
   2yyVT69$EEEE66666A ( :r&   c                     [         [        4 GH=  n [        5       nUR                  U 5        UR	                  [
        [        5        UR	                  [
        [        5        UR                  [
        [        [        [        0:X  d   eUR	                  [
        [        5        UR                  [
        [        [        [        0:X  d   eUR	                  [        [        5        UR                  [
        [        [        [        0:X  d   eUR	                  [        [        U    U 5        UR                  [
        [         [        [         0:X  a  GM>   e   g r   )r   r   r   r*   r   r   r	   r   r   r   r   r   r   r   r   _response_type_for_switchr   )switch_eventr    s     r!   -test_ConnectionState_protocol_switch_acceptedr2      s    (/:
)),7
)
&yyVYFFFF
.yyV%:FMRRRR
!67yyV%:FMRRRR
!:<!H,WyyV%6@QRRRR ;r&   c                  *   S [         [        4 GH  n [        5       nUR                  [         5        UR                  [        5        UR	                  [
        [        5        UR	                  [
        [        5        UR                  [
        [        [        [        0:X  d   eUR	                  [        [        U    U 5        U c(  UR                  [
        [        [        [        0:X  d   eM  UR                  [
        [        [        [        0:X  a  GM   e   g r   )r   r   r   r*   r   r   r	   r   r   r   r   r   r0   r   r   r   )server_switchr    s     r!   +test_ConnectionState_double_protocol_switchr5      s     A
))/:
))/:
)
.yyV%:FMRRRR
-m<m	
  99vy AAAA99):FDU VVVV Br&   c                     / [         4/ [        4[        /[         4[         /[        44 H  u  p[        5       nU  H  nUR                  U5        M     UR	                  [
        [        5        [        R                  " [        5         UR	                  [        [        U5        S S S 5        M     g ! , (       d  f       M  = fr   )r   r   r   r*   r   r   r	   r   r   r   r   r
   )client_switchesr4   r    client_switchs       r!   1test_ConnectionState_inconsistent_protocol_switchr9      s    	_	_
	O,
	O,	+& ,M--m< -
)]]-.VX}= /.+ /.s   B//
B>	c                     [        5       n U R                  [        5        U R                  [        [
        5        U R                  5         U R                  [        [        5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  [        [        [        [        0:X  d   eg r   )r   r*   r   r   r   r	   r$   r   r   r   r   r   r   r   r
   r   r   s    r!   :test_ConnectionState_keepalive_protocol_switch_interactionr;      s    		B%%o6VW%""$VT"99FMBBBB V\*99!6NNNN VX&99VY????r&   c                  l   [        5       n [        R                  " [        5         U R	                  5         S S S 5        U R                  [        [        5        U R                  [        [        5        [        R                  " [        5         U R	                  5         S S S 5        U R                  [        [        5        U R                  [        [        5        U R	                  5         U R                  [        [        [        [        0:X  d   eU R                  [        [        5        U R                  5         U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        [        R                  " [        5         U R	                  5         S S S 5        [        5       n U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        [        R                  " [        5         U R	                  5         S S S 5        [        5       n U R                  [         5        U R                  [        [        5        U R                  [        [        5        U R                  [        ["        [         5        [        R                  " [        5         U R	                  5         S S S 5        [        5       n U R                  [         5        U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        U R                  [        [        5        U R	                  5         U R                  [        [        [        [        0:X  d   eg ! , (       d  f       GN= f! , (       d  f       GNX= f! , (       d  f       GNU= f! , (       d  f       GN= f! , (       d  f       GN= fr   )r   r   r   r   start_next_cycler   r   r	   r   r   r
   r   r   r$   r   r*   r   r   r   s    r!   test_ConnectionState_reuser>      s   		B	)	*
 
+ VW%V\*	)	*
 
+ VX&V\*99vt4444 VW%""$V\*VX&V\*	)	*
 
+
 
	BVW%V\*V-.VX&V\*	)	*
 
+
 
	B%%o6VW%V\*V2OD	)	*
 
+
 
	B%%o6VW%V\*VX&V\*99vt4444w 
+	* 
+	*" 
+	* 
+	* 
+	*s;   OO.!P  PP$
O+.
O= 
P
P!$
P3c                      [        5       n [        R                  " [        5         U R	                  [
        [        5        S S S 5        g ! , (       d  f       g = fr   )r   r   r   r   r   r   r	   r   s    r!   test_server_request_is_illegalr@   
  s5     
	B	)	*
) 
+	*	*s   A		
A)returnN)$r   _eventsr   r   r   r   r   r	   r
   _stater   r   r   r   r   r   r   r   r   r   r   r   r   _utilr   r"   r%   r(   r.   r0   r2   r5   r9   r;   r>   r@    r&   r!   <module>rF      s          '=@
A	+"7L *X( S$W&>@$>5B*r&   