a
    þ
þdg!  ã                   @   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 sj0    Y  | jttttiksŠJ ‚|  t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¡ | 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_CLOSEZCLOSED©Úcs© r   ú]/var/www/html/stable-diffusion-webui/venv/lib/python3.9/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sjJ ‚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 s0J ‚|  ¡  | jt tu sJJ ‚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sTJ ‚| |jv sbJ ‚|r|| t
t¡ |jr|J ‚| tt¡ |r¤|jttt
t	iks¢J ‚q|jttt
tiksºJ ‚| t
t¡ |jttt
tiksÜJ ‚| 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   Zpending_switch_proposalsr   r   r   ÚMIGHT_SWITCH_PROTOCOLr   )Zswitch_typeZ
deny_earlyr   r   r   r   Ú"test_ConnectionState_switch_deniedB   s4    

þ
þ
r$   c                  C   s¼   t tfD ]®} tƒ }| | ¡ | tt¡ | tt¡ |jtt	t
tiksJJ ‚| tt¡ |jttt
tikslJ ‚| t
t¡ |jttt
tiksŽJ ‚| 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)Zswitch_eventr   r   r   r   Ú-test_ConnectionState_protocol_switch_acceptedn   s    
r'   c                  C   s¤   d t tfD ]”} tƒ }| t ¡ | t¡ | tt¡ | tt¡ |jtt	t
tiksVJ ‚| t
t|  | ¡ | d u rˆ|jttt
tiksžJ ‚q
|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   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 ]f\} }tƒ }| D ]}| |¡ q2| tt¡ t t	¡ | t
t|¡ W d   ƒ q 1 s|0    Y  q d S r   )r   r   r   r!   r   r
   r   r   r   r   r   r   )Zclient_switchesr(   r   Zclient_switchr   r   r   Ú1test_ConnectionState_inconsistent_protocol_switch“   s    ür*   c                  C   sŽ   t ƒ } |  t¡ |  tt¡ |  ¡  |  tt¡ | jtt	t
tiksFJ ‚|  tt¡ | jttt
tikshJ ‚|  t
t¡ | jttt
t	iksŠJ ‚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    
r+   c                  C   sh  t ƒ } t t¡ |  ¡  W d   ƒ n1 s.0    Y  |  tt¡ |  tt¡ t t¡ |  ¡  W d   ƒ n1 sx0    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0    Y  t ƒ } |  tt¡ |  tt¡ |  tt¡ |  t	t
¡ |  t	t¡ t t¡ |  ¡  W d   ƒ n1 s0    Y  t ƒ } |  t¡ |  tt¡ |  tt¡ |  t	tt¡ t t¡ |  ¡  W d   ƒ n1 sú0    Y  t ƒ } |  t¡ |  tt¡ |  tt¡ |  t	t
¡ |  t	t¡ |  ¡  | jttt	tiksdJ ‚d S r   )r   r   r   r   Zstart_next_cycler   r
   r   r   r   r   r	   r   r   r   r!   r   r   r   r   r   r   Útest_ConnectionState_reuse´   sR    &&((
(
r,   c                  C   s@   t ƒ } t t¡ |  tt¡ W d   ƒ n1 s20    Y  d S r   )r   r   r   r   r   r   r   r   r   r   r   Útest_server_request_is_illegalõ   s    r-   )r   Z_eventsÚ_stater   r   r   Z_utilr   r   r   r    r$   r   r   r%   r'   r)   r*   r+   r,   r-   r   r   r   r   Ú<module>   s$    &ýA