o
    Dhg!  ć                   @   s   d dl Z ddlT ddlT ddlmZmZmZ ddlmZ dd Zdd	 Z	d
d Z
dd ZeeeedeiZdd Zdd Zdd Zdd Zdd Zdd ZdS )é    Né   )Ś*)Ś_SWITCH_CONNECTŚ_SWITCH_UPGRADEŚConnectionState)ŚLocalProtocolErrorc                  C   s"  t  } | jttttiksJ |  tt” | jttttiksJ t	 
t” |  tt” W d    n1 s5w   Y  | jttttiksEJ |  tt” | jttttiksVJ |  tt” | jttttiksgJ |  tt” |  tt” | jttttiks~J |  tt” | jttttiksJ d S ©N)r   ŚstatesŚCLIENTŚIDLEŚSERVERŚprocess_eventŚRequestŚ	SEND_BODYŚSEND_RESPONSEŚpytestŚraisesr   ŚInformationalResponseŚResponseŚEndOfMessageŚDONEŚConnectionClosedŚ
MUST_CLOSEŚCLOSED©Ścs© r   śO/var/www/html/env_mimamsha/lib/python3.10/site-packages/h11/tests/test_state.pyŚtest_ConnectionState	   s"   ’r   c                  C   sn   t  } |  tt” |  ”  |  tt” | jtttt	iksJ |  tt
” |  tt” | jttttiks5J d S r   )r   r   r
   r   Śprocess_keep_alive_disabledr   r	   r   r   r   r   r   r   r   r   Śtest_ConnectionState_keep_alive)   s   r    c                  C   sN   t  } |  tt” |  tt” | jt tu sJ |  ”  | jt tu s%J d S r   )	r   r   r
   r   r   r	   r   r   r   r   r   r   r   Ś'test_ConnectionState_keep_alive_in_DONE6   s   r!   c                  C   s  t tfD ]} dD ]{}t }| | ” | tt” | tt” |jtt	t
tiks)J | |jv s0J |r=| t
t” |jr=J | tt” |rQ|jttt
t	iksPJ q|jttt
tiks\J | t
t” |jttt
tiksmJ | t
t” |jttt
t	iks~J |jrJ qqd S )N)TF)r   r   r   Śprocess_client_switch_proposalr   r
   r   ŚDatar	   r   r   r   Śpending_switch_proposalsr   r   r   ŚMIGHT_SWITCH_PROTOCOLr   )Śswitch_typeŚ
deny_earlyr   r   r   r   Ś"test_ConnectionState_switch_deniedB   s8   


ž
žą’r(   c                  C   s¼   t tfD ]W} t }| | ” | tt” | tt” |jtt	t
tiks%J | tt” |jttt
tiks6J | t
t” |jttt
tiksGJ | t
t|  | ” |jttt
tiks[J qd S r   )r   r   r   r"   r   r
   r   r#   r	   r   r   r   r   r%   r   Ś_response_type_for_switchŚSWITCHED_PROTOCOL)Śswitch_eventr   r   r   r   Ś-test_ConnectionState_protocol_switch_acceptedn   s   
ņr,   c                  C   s¤   d t tfD ]J} t }| t ” | t” | tt” | tt” |jtt	t
tiks+J | t
t|  | ” | d u rD|jttt
tiksCJ q|jttt
tiksOJ qd S r   )r   r   r   r"   r   r
   r   r   r	   r%   r   r   r)   r   r   r*   )Śserver_switchr   r   r   r   Ś+test_ConnectionState_double_protocol_switch   s   


’ór.   c               	   C   s   g t fg tftgt ft gtffD ]3\} }t }| D ]}| |” q| tt” t t	” | t
t|” W d    n1 s>w   Y  qd S r   )r   r   r   r"   r   r
   r   r   r   r   r   r   )Śclient_switchesr-   r   Śclient_switchr   r   r   Ś1test_ConnectionState_inconsistent_protocol_switch   s   ü’ör1   c                  C   s   t  } |  t” |  tt” |  ”  |  tt” | jtt	t
tiks#J |  tt” | jttt
tiks4J |  t
t” | jttt
t	iksEJ d S r   )r   r"   r   r   r
   r   r   r#   r	   r   r   r   r   r%   r   r   r   r   r   r   Ś:test_ConnectionState_keepalive_protocol_switch_interaction¢   s   
r2   c                  C   sb  t  } t t” |  ”  W d    n1 sw   Y  |  tt” |  tt” t t” |  ”  W d    n1 s<w   Y  |  t	t
” |  t	t” |  ”  | jttt	tiks\J |  tt” |  ”  |  tt” |  t	t
” |  t	t” t t” |  ”  W d    n1 sw   Y  t  } |  tt” |  tt” |  tt” |  t	t
” |  t	t” t t” |  ”  W d    n1 sĘw   Y  t  } |  t” |  tt” |  tt” |  t	tt” t t” |  ”  W d    n1 sśw   Y  t  } |  t” |  tt” |  tt” |  t	t
” |  t	t” |  ”  | jttt	tiks/J d S r   )r   r   r   r   Śstart_next_cycler   r
   r   r   r   r   r	   r   r   r   r"   r   r   r   r   r   r   Śtest_ConnectionState_reuse“   s\   
’
’
’
’

’
r4   c                  C   sB   t  } t t” |  tt” W d    d S 1 sw   Y  d S r   )r   r   r   r   r   r   r   r   r   r   r   Śtest_server_request_is_illegalõ   s   "’r5   )r   Ś_eventsŚ_stater   r   r   Ś_utilr   r   r    r!   r(   r   r   r)   r,   r.   r1   r2   r4   r5   r   r   r   r   Ś<module>   s&     &żA