
    g                     z    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	e      Zy)
    N)HTTP1Connection)HTTPMessageDelegate)IOStream)Event)add_accept_handler)AsyncTestCasebind_unused_portgen_testc                   B     e Zd ZdZ fdZed        Zed        Z xZS )HTTP1ConnectionTestNc                 B    t         |           | j                          y N)supersetUp
asyncSetUp)self	__class__s    V/var/www/openai/venv/lib/python3.12/site-packages/tornado/test/http1connection_test.pyr   zHTTP1ConnectionTest.setUp   s        c              #      K   t               \  }}t                fd}t        ||       t        t	        j                                _         j                   j
                  j                          j
                  j                  d|f      j                         g  j                  j                  |       |j                          y w)Nc                     t        |       _        j                  j                  j                         j	                          y r   )r   server_stream
addCleanupcloseset)connaddreventr   s     r   accept_callbackz7HTTP1ConnectionTest.asyncSetUp.<locals>.accept_callback   s0    !)$DOOD..445IIKr   z	127.0.0.1)r	   r   r   r   socketclient_streamr   r   connectwaitio_loopremove_handler)r   listenerportr   r   s   `   @r   r   zHTTP1ConnectionTest.asyncSetUp   s     )+$	
 	8_5%fmmo6**001!!));*=>

MM##H-s   CCc              #     K   t        | j                  d      }| j                  j                  d       | j                  j	                          t               | g  G fddt              }|j                   |              j                          | j                  | j                  d       | j                  dj                        d       y w)NTs"   HTTP/1.0 200 Not Modified

helloc                   ,    e Zd ZfdZ fdZfdZy)CHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegatec                 (    |j                   _         y r   )code)r   
start_lineheaderstests      r   headers_receivedzTHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.headers_received1   s    &OO	r   c                 (    j                  |       y r   )append)r   databodys     r   data_receivedzQHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.data_received4   s    D!r   c                 &    j                          y r   )r   )r   r   s    r   finishzJHTTP1ConnectionTest.test_http10_no_content_length.<locals>.Delegate.finish7   s    		r   N)__name__
__module____qualname__r0   r5   r7   )r4   r   r/   s   r   Delegater*   0   s    ,"r   r;      r   s   hello)r   r!   r   writer   r   r   read_responser#   assertEqualr,   join)r   r   r;   r4   r   r/   s      @@@r   test_http10_no_content_lengthz1HTTP1ConnectionTest.test_http10_no_content_length$   s      t1148  !JK  "	 	* 	   ,,jjlC($2s   CC)	r8   r9   r:   r,   r   r
   r   rA   __classcell__)r   s   @r   r   r      s5    D    3 3r   r   )r    typingtornado.http1connectionr   tornado.httputilr   tornado.iostreamr   tornado.locksr   tornado.netutilr   tornado.testingr   r	   r
   r    r   r   <module>rK      s,      3 0 %  . E E13- 13r   