o
    h                     @   st   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZmZmZ G dd	 d	eZdS )
    N)HTTP1Connection)HTTPMessageDelegate)IOStream)Event)add_accept_handler)AsyncTestCasebind_unused_portgen_testc                       s8   e Zd ZdZ fddZedd Zedd Z  ZS )HTTP1ConnectionTestNc                    s   t    |   d S N)supersetUp
asyncSetUpself	__class__ U/var/www/vscode/kcb/lib/python3.10/site-packages/tornado/test/http1connection_test.pyr      s   
zHTTP1ConnectionTest.setUpc                 #   sx    t  \}}t   fdd}t|| tt _jj jd|f 	 gV  j
| |  d S )Nc                    s$   t | _jj    d S r   )r   server_stream
addCleanupcloseset)connaddreventr   r   r   accept_callback   s   
z7HTTP1ConnectionTest.asyncSetUp.<locals>.accept_callbackz	127.0.0.1)r   r   r   r   socketclient_streamr   r   connectwaitio_loopremove_handler)r   listenerportr   r   r   r   r      s   

zHTTP1ConnectionTest.asyncSetUpc                 #   s    t | jd}| jd | j  t | g  G  fdddt}|| V   V  | 	| j
d | 	d d d S )NTs"   HTTP/1.0 200 Not Modified

helloc                       s0   e Zd ZfddZ fddZfddZdS )zCHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegatec                    s   |j  _ d S r   )code)r   
start_lineheaders)testr   r   headers_received1      zTHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.headers_receivedc                    s     | d S r   )append)r   data)bodyr   r   data_received4   s   zQHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.data_receivedc                    s       d S r   )r   r   )r   r   r   finish7   r+   zJHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.finishN)__name__
__module____qualname__r*   r/   r0   r   r.   r   r)   r   r   Delegate0   s    r5          s   hello)r   r   r   writer   r   r   read_responser!   assertEqualr&   join)r   r   r5   r   r4   r   test_http10_no_content_length$   s   


z1HTTP1ConnectionTest.test_http10_no_content_length)	r1   r2   r3   r&   r   r	   r   r<   __classcell__r   r   r   r   r
      s    
r
   )r   typingtornado.http1connectionr   tornado.httputilr   tornado.iostreamr   tornado.locksr   tornado.netutilr   tornado.testingr   r   r	   r
   r   r   r   r   <module>   s    