403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.254
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/supervisor/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/supervisor/tests/__pycache__/test_http_client.cpython-312.pyc
�

k��c�5���ddlZddlZddlZddlmZddlmZGd�dej�ZGd�dej�ZGd�d	e	�Z
Gd
�de	�Zy)�N)�as_bytes)�StringIOc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�
ListenerTestsc��ddlm}|S)Nr)�Listener)�supervisor.http_clientr)�selfrs  �C/usr/lib/python3/dist-packages/supervisor/tests/test_http_client.py�_getTargetClasszListenerTests._getTargetClass	s
��3���c�,�|j��S�N)r�r
s r�_makeOnezListenerTests._makeOne
s��%�t�#�#�%�'�'r
c�h�|j�}|j|jdd�d�yr)r�assertEqual�status�r
�insts  r�test_statuszListenerTests.test_statuss(���}�}���������T�4�0�$�7r
c�*�|j�}	tj}t�}|t_|j	|jdd�d�|j	|j
�d�|t_y#t_wxYw)N�url�errorz
url error
)r�sys�stderrrrr�getvalue)r
r�
old_stderrrs    r�
test_errorzListenerTests.test_errorsj���}�}���	$����J��Z�F��C�J����T�Z�Z��w�7��>����V�_�_�.�
�>�#�C�J���C�J�s�A'B�
Bc�j�|j�}|j|jddd�d�yr)rr�response_headerrs  r�test_response_headerz"ListenerTests.test_response_headers,���}�}�������-�-�d�D�$�?��Fr
c�f�|j�}|j|jd�d�yr)rr�doners  r�	test_donezListenerTests.test_done#s%���}�}���������4��$�/r
c�
�|j�}	tj}t�}|t_|j	dd�|j|j
�d�|t_y#t_wxYw)Nr�data)rr�stdoutr�feedrr)r
r�
old_stdoutr(s    r�	test_feedzListenerTests.test_feed's]���}�}���	$����J��Z�F��C�J��I�I�e�V�$����V�_�_�.��7�#�C�J���C�J�s�AA5�5
Bc�f�|j�}|j|jd�d�yr)rr�closers  r�
test_closezListenerTests.test_close2s&���}�}���������D�)�4�0r
N)�__name__�
__module__�__qualname__rrrrr"r%r+r.�r
rrrs+���(�8�	$�G�0�	$�1r
rc���eZdZd�Zd'd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'y)(�HTTPHandlerTestsc��ddlm}|S)Nr)�HTTPHandler)r	r6)r
r6s  rrz HTTPHandlerTests._getTargetClass7s��6��r
Nc�^�|�|j�}i}|j�||||��S)N)�map)�
_makeListenerr)r
�listener�username�password�
socket_maps     rrzHTTPHandlerTests._makeOne;s?�����)�)�+�H��
�%�t�#�#�%�����	�	r
c��t�}|Sr)�
DummyListener)r
r:s  rr9zHTTPHandlerTests._makeListenerFs�� �?���r
c�t�|j�}d|_|jt|jd�y)N�abc)rr�assertRaises�AssertionError�getrs  r�test_get_url_not_Nonez&HTTPHandlerTests.test_get_url_not_NoneJs*���}�}���������.�$�(�(�E�:r
c�h�|j�}|jt|jdd�y)Nznothttp://localhostz/abc)rrB�NotImplementedErrorrDrs  r�test_get_bad_schemez$HTTPHandlerTests.test_get_bad_schemeOs+���}�}��������H�H�!��		r
c�<���|j�}g�g��fd�|_�fd�|_|jdd�|j	|j
d�|j	�tjtjfg�|j	�dg�y)Nc�&���j|�Sr��append��arg�socketss �r�<lambda>z;HTTPHandlerTests.test_get_implied_port_80.<locals>.<lambda>\����'�.�.��*=�r
c�&���j|�SrrK��tup�connectss �rrPz;HTTPHandlerTests.test_get_implied_port_80.<locals>.<lambda>]����8�?�?�3�#7�r
zhttp://localhost�/abc/def�P)�	localhostrX�	r�
create_socket�connectrDr�port�socket�AF_INET�SOCK_STREAM�r
rrUrOs  @@r�test_get_implied_port_80z)HTTPHandlerTests.test_get_implied_port_80Xs�����}�}�������=���7������#�Z�0�������B�'�����F�N�N�F�4F�4F�#G�"H�I�����$5�#6�7r
c�<���|j�}g�g��fd�|_�fd�|_|jdd�|j	|j
d�|j	�tjtjfg�|j	�dg�y)Nc�&���j|�SrrKrMs �rrPz9HTTPHandlerTests.test_get_explicit_port.<locals>.<lambda>grQr
c�&���j|�SrrKrSs �rrPz9HTTPHandlerTests.test_get_explicit_port.<locals>.<lambda>hrVr
zhttp://localhost:8080rW�)rYrfrZras  @@r�test_get_explicit_portz'HTTPHandlerTests.test_get_explicit_portcs�����}�}�������=���7������(�*�5�������D�)�����F�N�N�F�4F�4F�#G�"H�I�����$7�#8�9r
c����|j�}g�g��fd�|_�fd�|_|jdd�|j	�t
jt
jfg�|j	�dg�y)Nc�&���j|�SrrKrMs �rrPzGHTTPHandlerTests.test_get_explicit_unix_domain_socket.<locals>.<lambda>rrQr
c�&���j|�SrrKrSs �rrPzGHTTPHandlerTests.test_get_explicit_unix_domain_socket.<locals>.<lambda>srVr
z
unix:///a/b/c�z/a/b/c)rr[r\rDrr^�AF_UNIXr`ras  @@r�$test_get_explicit_unix_domain_socketz5HTTPHandlerTests.test_get_explicit_unix_domain_socketnsi����}�}�������=���7�������"�%�����F�N�N�F�4F�4F�#G�"H�I�����H�:�.r
c���|j�}g��fd�|_t�|_|j	�|j|jjd�|j|jd�|j�dg�|j|jj�|j|jd�y)Nc�&���jd�S�NTrK)�delss�rrPz-HTTPHandlerTests.test_close.<locals>.<lambda>{s���4�;�;�t�#4�r
rT�CLOSED)r�del_channel�DummySocketr^r-rr:�closed�	connected�
assertTruer)r
rrqs  @rr.zHTTPHandlerTests.test_closexs�����}�}�����4���!�m����
�
��������-�-�t�4��������+������v�&�������*�*�+�������8�,r
c���ddlm}|j�}g��fd�|_|j	dd�|j�d|g�y)Nr��CRLFc�&���j|�SrrK)�val�pushess �rrPz.HTTPHandlerTests.test_header.<locals>.<lambda>�s����
�
�c� 2�r
�namer|z	name: val)r	rzr�push�headerr)r
rzrr}s   @r�test_headerzHTTPHandlerTests.test_header�s@���/��}�}�����2��	����F�E�"�����+�t�!4�5r
c�r�|j�}d|_|j|j�d�yrp)r�
error_handledr�handle_errorrs  r�!test_handle_error_already_handledz2HTTPHandlerTests.test_handle_error_already_handled�s.���}�}���!�������*�*�,�d�3r
c���|j�}g��fd�|_d|_|j|j	�d�|j|j
jd�|j|j
jd�|j�dg�|j|j�y)Nc�&���jd�SrprK�rus�rrPz4HTTPHandlerTests.test_handle_error.<locals>.<lambda>�����V�]�]�4�0�r
�fooz"Cannot connect, error: None (None)T)
rr-rrr�r:�	error_url�	error_msgrwr��r
rrus  @r�test_handle_errorz"HTTPHandlerTests.test_handle_error�s�����}�}�����0��
��������*�*�,�d�3�������0�0�%�8�����M�M�#�#�0�	�	
����$��(�����*�*�+r
c����|j�}g��fd�|_d|_d|_|j	�|j|j�|j�gd��y)Nc�8���jt|��Sr�rLr�r|�pusheds �rrPzBHTTPHandlerTests.test_handle_connect_no_password.<locals>.<lambda>������
�
�h�s�m� <�r
�/rY)�GET / HTTP/1.1�
�Host: localhostr��Accept-Encoding: chunkedr��Accept: */*r��"User-agent: Supervisor HTTP Clientr�r�r�)rr�path�host�handle_connectrwrvr�r
rr�s  @r�test_handle_connect_no_passwordz0HTTPHandlerTests.test_handle_connect_no_password�sZ����}�}�����<��	���	���	�����������'�����
�	r
c����|j�}g��fd�|_d|_d|_d|_d|_|j
�|j|j�|j�gd��y)Nc�8���jt|��Srr�r�s �rrPzDHTTPHandlerTests.test_handle_connect_with_password.<locals>.<lambda>�r�r
r�rYr<r;)r�r�r�r�r�r�r�r�r�r�s-Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=r�r�r�)
rrr�r�r<r;r�rwrvrr�s  @r�!test_handle_connect_with_passwordz2HTTPHandlerTests.test_handle_connect_with_password�sh����}�}�����<��	���	���	�"��
�"��
�����������'�����
�	r
c��|j�}|jd�|j|jjdg�y)Nr')rr)rr:�fed_datars  rr+zHTTPHandlerTests.test_feed�s5���}�}����	�	�&��������/�/�&��:r
c��|j�}|j|_d|_|j	d�|j|jjdg�|j|jd�y)NrAr��abcfoor
)r�body�part�buffer�collect_incoming_datarr:r�rs  r�'test_collect_incoming_data_part_is_bodyz8HTTPHandlerTests.test_collect_incoming_data_part_is_body�s]���}�}����I�I��	�����"�"�5�)�������/�/�(��<�������c�*r
c���|j�}d|_d|_|jd�|j	|j
jg�|j	|jd�y)NrAr�r�)rr�r�r�rr:r�rs  r�+test_collect_incoming_data_part_is_not_bodyz<HTTPHandlerTests.test_collect_incoming_data_part_is_not_body�sW���}�}�����	�����"�"�5�)�������/�/��4�������h�/r
c����|j�}g��fd�|_d|_|j�|j	�dg�|j	|jd�y)Nc�&���jd�SrprK)�parteds�rrPz8HTTPHandlerTests.test_found_terminator.<locals>.<lambda>�s���F�M�M�$�/�r
Tr
)rr�r��found_terminatorr)r
rr�s  @r�test_found_terminatorz&HTTPHandlerTests.test_found_terminator�sS����}�}�����/��	������������$��(�������c�*r
c��|j�}d|_|j�|j|jd�y�Nr
)rr��ignorerrs  r�test_ignorezHTTPHandlerTests.test_ignore�s1���}�}���������
�������c�*r
c�r�|j�}d|_|jt|j�y)NsNOTHTTP/1.0 200 OK)rr�rB�
ValueError�status_liners  r�$test_status_line_not_startswith_httpz5HTTPHandlerTests.test_status_line_not_startswith_http�s*���}�}���+������*�d�&6�&6�7r
c��|j�}d|_|j�\}}}|j|d�|j|d�|j|d�|j|j|j
�y)NsHTTP/1.0 200 OK�HTTP/1.0���OK)rr�r�rr��headers)r
r�versionr�reasons     r�test_status_line_200z%HTTPHandlerTests.test_status_line_200�sq���}�}���(���"&�"2�"2�"4���������+�.������%������'�������D�L�L�1r
c���|j�}d|_g��fd�|_|j�\}}}|j	|d�|j	|d�|j	|d�|j	|j
|j�|j	|jjd�|j	�dg�y)NsHTTP/1.0 201 OKc�&���jd�SrprKr�s�rrPz;HTTPHandlerTests.test_status_line_not_200.<locals>.<lambda>	r�r
r���r�zCannot read, status code 201T)	rr�r-r�rr�r�r:r�)r
rr�rr�rus     @r�test_status_line_not_200z)HTTPHandlerTests.test_status_line_not_200s�����}�}���(�����0��
�"&�"2�"2�"4���������+�.������%������'�������D�K�K�0�����M�M�#�#�*�	�	
����$��(r
c���|j�}d|_d|_d|_g��fd�|_|j�|j
|j|j�|j
�dg�y)Nr
snot chunked�c�&���j|�SrrK)�L�termss �rrPzEHTTPHandlerTests.test_headers_empty_line_nonchunked.<locals>.<lambda>�������Q��r
)	rr��encoding�length�set_terminatorr�rr�r��r
rr�s  @r�"test_headers_empty_line_nonchunkedz3HTTPHandlerTests.test_headers_empty_line_nonchunkedsc����}�}������&��
������7�������������D�I�I�.�������$r
c��|j�}d|_d|_|j�|j	|j
|j�y)Nr
�chunked)rr�r�r�rr��chunked_sizers  r�test_headers_empty_line_chunkedz0HTTPHandlerTests.test_headers_empty_line_chunked s>���}�}������"��
�����������D�$5�$5�6r
c�r�|j�}d|_|j|j�d�y)N�:)rr�rr�rs  r�+test_headers_nonempty_line_no_name_no_valuez<HTTPHandlerTests.test_headers_nonempty_line_no_name_no_value's*���}�}��������������.r
c����|j�}d|_g��fd�|_|j�|j	|j
d�|j	�dg�y)NsTransfer-Encoding: chunkedc�*���j||f�SrrK��n�v�	responsess  �rrPzOHTTPHandlerTests.test_headers_nonempty_line_transfer_encoding.<locals>.<lambda>0����I�,<�,<�a��V�,D�r
r�)stransfer-encodingr�)rr�r!r�rr��r
rr�s  @r�,test_headers_nonempty_line_transfer_encodingz=HTTPHandlerTests.test_headers_nonempty_line_transfer_encoding,sS����}�}���3����	�D�������������
�3�����%G�$H�Ir
c����|j�}d|_g��fd�|_|j�|j	|j
d�|j	�dg�y)NsContent-Length: 3c�*���j||f�SrrKr�s  �rrPzLHTTPHandlerTests.test_headers_nonempty_line_content_length.<locals>.<lambda>9r�r
r�)scontent-length�3)rr�r!r�rr�r�s  @r�)test_headers_nonempty_line_content_lengthz:HTTPHandlerTests.test_headers_nonempty_line_content_length5sS����}�}���*����	�D�������������a�(�����%>�$?�@r
c���|j�}d|_g��fd�|_|j�|j	�dg�y)NsX-Test: abcc�*���j||f�SrrKr�s  �rrPzGHTTPHandlerTests.test_headers_nonempty_line_arbitrary.<locals>.<lambda>Br�r
)sx-testsabc)rr�r!r�rr�s  @r�$test_headers_nonempty_line_arbitraryz5HTTPHandlerTests.test_headers_nonempty_line_arbitrary>s?����}�}���$����	�D�����������%8�$9�:r
c���|j�}|jdd�|j|jjd�|j|jj
d�y)N�a�b)rr!rr:�response_header_name�response_header_valuers  rr"z%HTTPHandlerTests.test_response_headerFsQ���}�}������T�4�(�������;�;�T�B�������<�<�d�Cr
c����|j�}g��fd�|_|j�|j�dg�|j	|j
j�y)Nc�&���jd�SrprKr�s�rrPz,HTTPHandlerTests.test_body.<locals>.<lambda>Or�r
T)rr-r�rrwr:r$r�s  @r�	test_bodyzHTTPHandlerTests.test_bodyLsK����}�}�����0��
��	�	������$��(�����
�
�*�*�+r
c��|j�}|j�|j|jj�yr)rr$rwr:rs  rr%zHTTPHandlerTests.test_doneTs,���}�}����	�	������
�
�*�*�+r
c��|j�}d|_d|_|j|j	�d�|j|jd�y)Nr
�)rr�r�rr�rs  r�test_chunked_size_empty_linez-HTTPHandlerTests.test_chunked_size_empty_lineYsH���}�}�������������*�*�,�d�3�������a�(r
c��|j�}d|_d|_|j|j	�d�|j|jd�|j|j
|j�y)N�0r�)rr�r�rr�r��trailerrs  r�test_chunked_size_zero_sizez,HTTPHandlerTests.test_chunked_size_zero_size`s`���}�}�������������*�*�,�d�3�������a�(�������D�L�L�1r
c�D��|j�}d|_d|_g��fd�|_|j	|j�d�|j	|j|j�|j	|jd�|j	�dg�y)Ns10r�c�&���j|�SrrK)�szr�s �rrPzAHTTPHandlerTests.test_chunked_size_nonzero_size.<locals>.<lambda>ms������b�)9�r
��)rr�r�r�rr�r��chunked_bodyr�s  @r�test_chunked_size_nonzero_sizez/HTTPHandlerTests.test_chunked_size_nonzero_sizehs�����}�}�����������9�������*�*�,�d�3�������D�$5�$5�6�������b�)�������%r
c�*���ddlm}|j�}d|_g�g��fd�|_�fd�|_|j
�|j�|g�|j�dg�|j|j|j�y)Nrrysbufferc�&���j|�SrrK)r�r�s �rrPz4HTTPHandlerTests.test_chunked_body.<locals>.<lambda>yr�r
c�&���j|�SrrK)r��liness �rrPz4HTTPHandlerTests.test_chunked_body.<locals>.<lambda>zs���e�l�l�1�o�r
)
r	rzrr�r�r)r�rr�r�)r
rzrrr�s   @@r�test_chunked_bodyz"HTTPHandlerTests.test_chunked_bodyss{���/��}�}����������7���-��	�����������'�������,�������D�$5�$5�6r
c�r�|j�}d|_|j|j�d�yr�)rr�rr�rs  r�test_trailer_line_not_crlfz+HTTPHandlerTests.test_trailer_line_not_crlf�s*���}�}��������������.r
c����ddlm}|j�}||_g�g��fd�|_�fd�|_|j
|j�d�|j
�dg�|j
�dg�y)Nrryc�&���jd�SrprK)�doness�rrPz9HTTPHandlerTests.test_trailer_line_crlf.<locals>.<lambda>�s���E�L�L��.�r
c�&���jd�SrprK)�closess�rrPz9HTTPHandlerTests.test_trailer_line_crlf.<locals>.<lambda>�r�r
T)r	rzrr�r$r-rr�)r
rzrrr
s   @@r�test_trailer_line_crlfz'HTTPHandlerTests.test_trailer_line_crlf�sj���/��}�}����������.��	�0��
���������.�������'�����$��(r
)NrkN)(r/r0r1rrr9rErHrbrgrmr.r�r�r�r�r�r+r�r�r�r�r�r�r�r�r�r�r�r�r�r"r�r%r�r�rrrr
r2r
rr4r46s����	��;�
�	8�	:�/�
-�6�4�
,��0�8;�
+�0�+�+�8�
2�)� 	%�7�/�
J�A�;�D�,�,�
)�2�	&�7�/�

)r
r4c�F�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Zy)
r?NFc��g|_yr)r�rs r�__init__zDummyListener.__init__�s	����
r
c��||_yrr��r
rs  rr-zDummyListener.close�s	����r
c� �||_||_yr)r�r�)r
r�msgs   rrzDummyListener.error�s�������r
c�:�|jj|�yr)r�rL)r
rr's   rr)zDummyListener.feed�s���
�
���T�"r
c� �||_||_yr)�
status_url�
status_int)r
r�ints   rrzDummyListener.status�s�������r
c� �||_||_yr)r�r�)r
rr~�values    rr!zDummyListener.response_header�s��$(��!�%*��"r
c��d|_yrp)r$rs  rr$zDummyListener.done�s	����	r
)
r/r0r1rur�r�r$rr-rr)rr!r2r
rr?r?�s9��
�F��I��I��D����#��+�r
r?c��eZdZdZd�Zy)rtFc��d|_yrpr�rs rr-zDummySocket.close�s	����r
N)r/r0r1rur-r2r
rrtrt�s��
�F�r
rt)r^r�unittest�supervisor.compatrr�TestCaserr4�objectr?rtr2r
r�<module>r#sT��
�
��&�&�,1�H�%�%�,1�\Y)�x�(�(�Y)�v
�F��:�&�r

Youez - 2016 - github.com/yon3zu
LinuXploit