403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.217
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.cpython-312.pyc
�

�C�cCd��^�ddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZGd
�d�ZGd�deej,�ZGd�deej,�ZGd�dej,�ZGd�dej,�ZGd�dej,�ZGd�dej,�ZGd�dej,�ZGd�dej,�ZGd�d ej,�Zd!Z Gd"�d#ej,�Z!Gd$�d%ej,�Z"Gd&�d'ej,�Z#Gd(�d)ej,�Z$Gd*�d+�Z%Gd,�d-�Z&d.�Z'e(d/k(rejRd0�1�yy)2�N)�as_bytes)�	as_string)�sha1)�DummySupervisor)�PopulatedDummySupervisor)�DummyRPCInterfaceFactory)�DummyPConfig)�DummyOptions)�DummyRequest)�DummyLogger)�NOT_DONE_YETc��eZdZd�Zd�Zy)�HandlerTestsc�.�|j�|�S�N��_getTargetClass)�self�supervisords  �</usr/lib/python3/dist-packages/supervisor/tests/test_http.py�_makeOnezHandlerTests._makeOnes��%�t�#�#�%�k�2�2�c��Gd�d�}t�}|j|�}|j|j||j��d�y)Nc��eZdZd�Zy)�,HandlerTests.test_match.<locals>.FakeRequestc��||_yr)�uri)rrs  r�__init__z5HandlerTests.test_match.<locals>.FakeRequest.__init__s	����rN)�__name__�
__module__�__qualname__r�rr�FakeRequestrs��
rr#T)rr�assertEqual�match�path)rr#�
supervisor�handlers    r�
test_matchzHandlerTests.test_matchsF��	�	�%�&�
��-�-�
�+��������{�7�<�<�'@�A�4�HrN)rr r!rr)r"rrrrs
��3�Irrc�$�eZdZd�Zd�Zd�Zd�Zy)�LogtailHandlerTestsc��ddlm}|S)Nr)�logtail_handler)�supervisor.httpr-)rr-s  rrz#LogtailHandlerTests._getTargetClass$���3��rc���t�}t|dddd��}t|d|�}|j|�}t	dddd�}|j|�|j
|jd�y)N�process1z
/bin/process1�z/tmp/process1.log)�priority�stdout_logfile�/logtail/process1��r
r	rrr�handle_requestr$�_error�r�options�pconfigrr(�requests      r�'test_handle_request_stdout_logfile_nonez;LogtailHandlerTests.test_handle_request_stdout_logfile_none(sn���.���w�
�O�a�.A�C��.�w�
�G�L���-�-��,���2�D�$��E�����w�'��������-rc���t�}t|ddd�}t|d|�}|j|�}t	dddd�}|j|�|j
|jd�y)N�fooz
it/is/missing�/logtail/foor6r7r:s      r�*test_handle_request_stdout_logfile_missingz>LogtailHandlerTests.test_handle_request_stdout_logfile_missing2sg���.���w��u�o�F��.�w��w�G���-�-��,���~�t�T�4�@�����w�'��������-rc	��tj�5}|j}t�}t	|dd|��}t|d|�}|j
|�}tdddd�}|j|�|j|jd�ddlm}|j|jd|jtj |�t j"��|j|jdd�|j|jd	d
�|jt%|j&�d�|j|j(d�ddd�y#1swYyxYw)
Nr@)r4rAr��	http_date�
Last-Modified�Content-Type�text/plain;charset=utf-8zX-Accel-Buffering�nor2T)�tempfile�NamedTemporaryFile�namer
r	rrrr8r$r9�supervisor.medusarE�headers�build_http_date�os�stat�ST_MTIME�len�	producers�_done)	r�f�tr;r<rr(r=rEs	         r�test_handle_requestz'LogtailHandlerTests.test_handle_request;s2��
�
(�
(�
*�	2�a����A�"�n�G�"�7�E�5��K�G�2�7�E�7�K�K��m�m�K�0�G�"�>�4��t�D�G��"�"�7�+����W�^�^�T�2�3����W�_�_�_�=��)�)�"�'�'�!�*�T�]�]�*C�D�
F����W�_�_�^�<�>X�Y����W�_�_�-@�A�4�H����S��!2�!2�3�Q�7����W�]�]�D�1�	2�	2�	2�s�EE4�4E=N�rr r!rr>rBrXr"rrr+r+#s���.�.�2rr+c�$�eZdZd�Zd�Zd�Zd�Zy)�MainLogTailHandlerTestsc��ddlm}|S)Nr)�mainlogtail_handler)r.r])rr]s  rrz'MainLogTailHandlerTests._getTargetClassNs��7�"�"rc��t�}|j|�}tdddd�}|j|�|j	|j
d�y)N�/mainlogtailr6)rrrr8r$r9)rr'r(r=s    rr>z?MainLogTailHandlerTests.test_handle_request_stdout_logfile_noneRsJ��$�&�
��-�-�
�+���~�t�T�4�@�����w�'��������-rc���t�}d|j_tdddd�}|j	|�}|j|�|j
|jd�y)Nz
/not/therer_r6)rr;�logfilerrr8r$r9)rr'r=r(s    rrBzBMainLogTailHandlerTests.test_handle_request_stdout_logfile_missingYsX��$�&�
�%1�
���"��~�t�T�4�@���-�-�
�+�����w�'��������-rc	��t�}tj�5}|j}||j_|j
|�}tdddd�}|j|�|j|jd�ddlm}|j|jd|jtj |�t j"��|j|jdd�|jt%|j&�d�|j|j(d�ddd�y#1swYyxYw)	Nr_rrDrFrGrHr2T)rrJrKrLr;rarrr8r$r9rMrErNrOrPrQrRrSrTrU)rr'rVrWr(r=rEs       rrXz+MainLogTailHandlerTests.test_handle_requestas	��$�&�
�
�
(�
(�
*�	2�a����A�)*�J���&��m�m�J�/�G�"�>�4��t�D�G��"�"�7�+����W�^�^�T�2�3����W�_�_�_�=��)�)�"�'�'�!�*�T�]�]�*C�D�
F����W�_�_�^�<�>X�Y����S��!2�!2�3�Q�7����W�]�]�D�1�	2�	2�	2�s�D"E
�
ENrYr"rrr[r[Ms��#�.�.�2rr[c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�TailFProducerTestsc��ddlm}|S)Nr)�tail_f_producer)r.rf)rrfs  rrz"TailFProducerTests._getTargetClasssr/rc�2�|j�|||�Srr)rr=�filename�heads    rrzTailFProducerTests._makeOnews��%�t�#�#�%�g�x��>�>rc��tdddd�}ddlm}tj�}|jd�|j
�|j||jd�}|j�}|j|d�|jtd��|j
�|j�}|j|d�|j�}|j||j�|jd�|j
�|j�}|j|d�y)NrAr)�http�Paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa�Psdwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwz==> File truncated <==
)rr'rkrJrK�write�flushrrL�morer$rr
�truncate)rr=rkrV�producer�results      r�test_handle_morez#TailFProducerTests.test_handle_morezs����~�t�T�4�@��#��'�'�)��	���	��	���	��=�=��!�&�&�"�5������������+�	�����$�%�	���	�����������,�����������!2�!2�3�	�
�
�1�
�	���	����������!;�<rc��tdddd�}tj�5}|jt	d��|j�|j
||jd�}|jj�|j�}ddd�|jj��y#1swY�*xYw)NrA�Paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarm)rrJrKrnrrorrL�file�closerpr$)rr=rVrrrss     r�test_handle_more_fd_closedz-TailFProducerTests.test_handle_more_fd_closed�s����~�t�T�4�@��
�
(�
(�
*�	%�a�
�G�G�H�X�&�'�
�G�G�I��}�}�W�a�f�f�b�9�H��M�M���!��]�]�_�F�	%�	
��������1�
	%�	%�s�A2B>�>Cc��tdddd�}tj�}|jt	d��|j�|j
||jd�}|j�}|j|d�|j�t|jd�}	|jt	d��|j�|j�}tj|j�|j|d�y#tj|j�wxYw)NrArvrmrl�wb�Pbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)rrJrKrnrrorrLrpr$rx�openrP�unlink)rr=rVrrrs�f2s      r�&test_handle_more_follow_file_recreatedz9TailFProducerTests.test_handle_more_follow_file_recreated�s����~�t�T�4�@���'�'�)��	�����"�#�	���	��=�=��!�&�&�"�5������������+�	���	�
�!�&�&�$�
��	��H�H�X�i�(�)��H�H�J��]�]�_�F��I�I�b�g�g�������+��
�I�I�b�g�g��s�3:D�!Ec��tdddd�}tjd��5}|j}|j	d�ddd�	|j|jd�}t
j|j�|j�}|j|d�td�5}|j	td��ddd�	|j�}|j|d�t
j|j�y#1swY��xYw#t
jj�wxYw#1swY�|xYw#t
j|j�wxYw)NrAF��deleterlrmr{r|)rrJrKrLrnrrPr~rpr$r}r)rr=rVrhrrrss      r�!test_handle_more_follow_file_gonez4TailFProducerTests.test_handle_more_follow_file_gone�s���~�t�T�4�@��
�
(�
(��
6�	�!��v�v�H�
�G�G�I��	�	��}�}�W�a�f�f�b�9�H��I�I�a�f�f������������+�
�(�D�
!�	)�Q�
�G�G�H�Y�'�(�	)�	��]�]�_�F����V�Y�/�
�Y�Y�q�v�v�
�	�	��
�I�I�a�f�f���	)�	)���Y�Y�q�v�v�
�s/�D�D(�6E�"E�D%�(!E	�E�!E9N)	rr r!rrrtryr�r�r"rrrdrdrs ���?�=�(2�,�$rrdc�>�eZdZd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
y)�DeferringChunkedProducerTestsc��ddlm}|S)Nr)�deferring_chunked_producer)r.r�)rr�s  rrz-DeferringChunkedProducerTests._getTargetClass�s��>�)�)rNc�0�|j�||�Srr)rrr�footerss   rrz&DeferringChunkedProducerTests._makeOne�s��%�t�#�#�%�h��8�8rc��tt�}|j|�}|j|j	�t�yr��
DummyProducerr
rr$rp�r�wrappedrrs   r�test_more_not_done_yetz4DeferringChunkedProducerTests.test_more_not_done_yet��0����-���=�=��)���������,�7rc�|�td�}|j|�}|j|j�d�y)N�hellos
5
hello
�r�rr$rpr�s   r�test_more_stringz.DeferringChunkedProducerTests.test_more_string�s1����)���=�=��)���������*;�<rc��t�}|j|ddg��}|j|j�d�y)N�a�b�r��0
a
b

r�r�s   r�test_more_nodataz.DeferringChunkedProducerTests.test_more_nodata�s6���/���=�=��4��,�=�?���������*@�Arc��td�}|j|ddg��}|j|j�d�y)Nrr�r�r�r�r�r�s   r�test_more_nodata_footersz6DeferringChunkedProducerTests.test_more_nodata_footers�s9����$���=�=��4��,�=�?���������*@�Arc�|�td�}|j|�}|j|j�d�y)Nrs0

r�r�s   r�test_more_nodata_nofootersz8DeferringChunkedProducerTests.test_more_nodata_nofooters�s0����$���=�=��)���������,�7rc�f�|jd�}|j|j�d�y�Nr�rr$rp�rrrs  r�test_more_noproducerz2DeferringChunkedProducerTests.test_more_noproducer�s&���=�=��&���������#�.rr)rr r!rrr�r�r�r�r�r�r"rrr�r��s,��*�9�8�
=�
B�
B�
8�
/rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�DeferringCompositeProducerTestsc��ddlm}|S)Nr)�deferring_composite_producer)r.r�)rr�s  rrz/DeferringCompositeProducerTests._getTargetClass�s��@�+�+rc�.�|j�|�Srr)rrTs  rrz(DeferringCompositeProducerTests._makeOne�s��%�t�#�#�%�i�0�0rc��tt�}|j|g�}|j|j	�t�yrr�r�s   rr�z6DeferringCompositeProducerTests.test_more_not_done_yet�s2����-���=�=�'��+���������,�7rc��td�}td�}|j||g�}|j|j�d�|j|j�d�|j|j�d�y)N�hello�goodbyerr�)r�wrapped1�wrapped2rrs    rr�z0DeferringCompositeProducerTests.test_more_string�sk�� ��)�� ��+���=�=�(�H�!5�6���������'�2��������)�4��������#�.rc�|�t�}|j|g�}|j|j�d�yr�r�r�s   rr�z0DeferringCompositeProducerTests.test_more_nodata�s/���/���=�=�'��+���������#�.rN�rr r!rrr�r�r�r"rrr�r��s��,�1�8�
/�/rr�c�,�eZdZd�Zdd�Zd�Zd�Zd�Zy)�DeferringGlobbingProducerTestsc��ddlm}|S)Nr)�deferring_globbing_producer)r.r�)rr�s  rrz.DeferringGlobbingProducerTests._getTargetClass�s��?�*�*rc�0�|j�||�Srr)rrr�buffer_sizes   rrz'DeferringGlobbingProducerTests._makeOnes��%�t�#�#�%�h��<�<rc��tt�}|j|�}|j|j	�t�yrr�r�s   rr�z5DeferringGlobbingProducerTests.test_more_not_done_yetr�rc��tddd�}|j|d��}|j|j�d�tddd�}|j|d��}|j|j�d�y)	Nr��there�guyr2)r�r��2s
hellothereguyr�r�s   rr�z/DeferringGlobbingProducerTests.test_more_string	so�����%�8���=�=��a�=�8���������(�3����%�8���=�=��b�=�9���������*:�;rc�z�t�}|j|�}|j|j�d�yr�r�r�s   rr�z/DeferringGlobbingProducerTests.test_more_nodatas-���/���=�=��)���������#�.rN)ir�r"rrr�r��s��+�=�8�
<�/rr�c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�DeferringHookedProducerTestsc��ddlm}|S)Nr)�deferring_hooked_producer)r.r�)rr�s  rrz,DeferringHookedProducerTests._getTargetClasss��=�(�(rc�0�|j�||�Srr)rrr�functions   rrz%DeferringHookedProducerTests._makeOnes��%�t�#�#�%�h��9�9rc��tt�}|j|d�}|j|j	�t�yrr�r�s   rr�z3DeferringHookedProducerTests.test_more_not_done_yets2����-���=�=��$�/���������,�7rc���td�}g��fd�}|j||�}|j|j�d�|j�g�|j�|j�dg�y)Nr�c�(���j|�yr��append��bytes�Ls �r�callbackz?DeferringHookedProducerTests.test_more_string.<locals>.callback'����
�H�H�U�Or�r��rr�r�rrr�s    @rr�z-DeferringHookedProducerTests.test_more_string$sh�����(����	��=�=��(�3���������'�2�����B���
�
������Q�C� rc���t�}g��fd�}|j||�}|j|j�d�|j�dg�y)Nc�(���j|�yrr�r�s �rr�z?DeferringHookedProducerTests.test_more_nodata.<locals>.callback2r�rrrr�r�s    @rr�z-DeferringHookedProducerTests.test_more_nodata/sL����/����	��=�=��(�3���������#�.�����Q�C� rc�h�|jdd�}|j|j�d�yr�r�r�s  rr�z1DeferringHookedProducerTests.test_more_noproducer8s(���=�=��t�,���������#�.rN)	rr r!rrr�r�r�r�r"rrr�r�s ��)�:�8�
	!�!�/rr�c�b�eZdZd�Z						dd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)�DeferringHttpRequestTestsc��ddlm}|S)Nr)�deferring_http_request)r.r�)rr�s  rrz)DeferringHttpRequestTests._getTargetClass=���:�%�%rNc�8�|j�||||||�Srr)r�channel�req�commandr�version�headers       rrz"DeferringHttpRequestTests._makeOneAs)��&�t�#�#�%��S�'�3����	rc�$�Gd�d�}|�S)Nc��eZdZdZd�Zd�Zy)�7DeferringHttpRequestTests._makeChannel.<locals>.ChannelFc��d|_y�NT)�closed�rs r�close_when_donezGDeferringHttpRequestTests._makeChannel.<locals>.Channel.close_when_doneQs	��"��rc��||_yr)rrr�s  r�push_with_producerzJDeferringHttpRequestTests._makeChannel.<locals>.Channel.push_with_producerSs	�� (��
rN)rr r!r�r�r�r"rr�Channelr�Os���F�
#�
)rr�r")rr�s  r�_makeChannelz&DeferringHttpRequestTests._makeChannelNs��	)�	)��y�rc��|j�}|j|d��}|j�|j|j�y)N�1.0�r�r��r�r�done�
assertTruer��rr��insts   r�test_done_http_10_nokeepalivez7DeferringHttpRequestTests.test_done_http_10_nokeepaliveWs;���#�#�%���}�}�W�e�}�<���	�	��������'rc��|j�}|j|ddg��}|j�|j|j�y)Nr��Connection: Keep-Alive�r�r�r�r�r�s   r�-test_done_http_10_keepalive_no_content_lengthzGDeferringHttpRequestTests.test_done_http_10_keepalive_no_content_length]sJ���#�#�%���}�}���,�-����	
�	�	��������'rc���|j�}|j|ddg��}d|jd<|j�|j	|dd�|j|j�y)Nr�r�r�r2zContent-Length�
Connectionz
Keep-Alive)r�r�
reply_headersr�r$�assertFalser�r�s   r�.test_done_http_10_keepalive_and_content_lengthzHDeferringHttpRequestTests.test_done_http_10_keepalive_and_content_lengthhsr���#�#�%���}�}���,�-����
01����+�,��	�	������l�+�\�:�������(rc��|j�}|j|ddg��}|j�|j|j�y)N�1.1zConnection: closer�r�r�s   r�"test_done_http_11_connection_closez<DeferringHttpRequestTests.test_done_http_11_connection_closetsJ���#�#�%���}�}���'�(����
	
�	�	��������'rc��|j�}|j|d��}d|jd<|j�|j	|j
�y)Nr�r��
notchunked�Transfer-Encoding)r�rr�r�r�r�r�s   r�+test_done_http_11_unknown_transfer_encodingzEDeferringHttpRequestTests.test_done_http_11_unknown_transfer_encoding~sU���#�#�%���}�}������3?����.�/��	�	��������'rc��|j�}|j|d��}d|jd<|j�|j	|j
�y)Nr�r��chunkedr)r�rr�r�r�r�r�s   r�+test_done_http_11_chunked_transfer_encodingzEDeferringHttpRequestTests.test_done_http_11_chunked_transfer_encoding�sW���#�#�%���}�}������3<����.�/��	�	��������(rc���|j�}|j|d��}d|_|j�|j	d|v�|j|j�y)Nr�r�Tr)r�r�use_chunkedr�r�r�r�r�s   r�test_done_http_11_use_chunkedz7DeferringHttpRequestTests.test_done_http_11_use_chunked�s`���#�#�%���}�}������ ����	�	�����+�t�3�4�������(rc��|j�}|j|d��}d|_|j�|j	|j
�y)Nr�r�F)r�rrr�r�r�r�s   r�>test_done_http_11_wo_content_length_no_te_no_use_chunked_closezXDeferringHttpRequestTests.test_done_http_11_wo_content_length_no_te_no_use_chunked_close�sL���#�#�%���}�}������!����	�	��������'rc��|j�}|j|d��}|j�|j|j�y)Nr�r�r�s   r�test_done_http_09z+DeferringHttpRequestTests.test_done_http_09�sD���#�#�%���}�}������	
�	�	��������'r)NzGET / HTTP/1.0�GET�/r�r")rr r!rrr�r�r�r�r�rrrr
rr"rrr�r�<sR��&���������(�	(�
)�(�(�)�	)�(�(rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�DeferringHttpChannelTestsc��ddlm}|S)Nr)�deferring_http_channel)r.r)rrs  rrz)DeferringHttpChannelTests._getTargetClass�r�rc�4�|j�ddd��S)N)�server�conn�addrrr�s rrz"DeferringHttpChannelTests._makeOne�s#��%�t�#�#�%�����	rc��|j�}|j|jd�|j|jd�y)Nr)rr$�delay�last_writable_check)rr�s  r�0test_defaults_delay_and_last_writable_check_timezJDeferringHttpChannelTests.test_defaults_delay_and_last_writable_check_time�s7���-�-�/���������*�����4�4�a�8rc���|j�}d|_t|_tdz}|j	|j|���|j
|jt�y)N�r2��now�rr�_NOWrr��writabler$�rr��laters   r�5test_writable_with_delay_is_False_if_elapsed_lt_delayzODeferringHttpChannelTests.test_writable_with_delay_is_False_if_elapsed_lt_delay�sW���-�-�/����
�&*��#��q�������)�)�e�)�4�5�����4�4�d�;rc���|j�}d|_t|_t|jz}|j	|j|���|j
|jt�y)Nrrrr"s   r�5test_writable_with_delay_is_False_if_elapsed_eq_delayzODeferringHttpChannelTests.test_writable_with_delay_is_False_if_elapsed_eq_delay�s\���-�-�/����
�&*��#��w�}�}�$������)�)�e�)�4�5�����4�4�d�;rc���|j�}d|_t|_t|jzdz}|j	|j|���|j
|j|�y)Nrg�������?r�rrr rr�r!r$r"s   r�4test_writable_with_delay_is_True_if_elapsed_gt_delayzNDeferringHttpChannelTests.test_writable_with_delay_is_True_if_elapsed_gt_delay�s_���-�-�/����
�&*��#��w�}�}�$�s�*������(�(�U�(�3�4�����4�4�e�<rc���|j�}d|_t|_tdz
}|j	|j|���|j
|j|�y)Nrirr(r"s   r�>test_writable_with_delay_is_True_if_system_time_goes_backwardszXDeferringHttpChannelTests.test_writable_with_delay_is_True_if_system_time_goes_backwards�sU���-�-�/����
�&*��#��t�������(�(�U�(�3�4�����4�4�e�<rN)
rr r!rrrr$r&r)r+r"rrrr�s%��&��9�
<�<�=�=rrif��Wc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�"EncryptedDictionaryAuthorizedTestsc��ddlm}|S)Nr��encrypted_dictionary_authorizer)r.r0)rr0s  rrz2EncryptedDictionaryAuthorizedTests._getTargetClass�s��C�.�.rc�.�|j�|�Srr)r�dicts  rrz+EncryptedDictionaryAuthorizedTests._makeOne�s��%�t�#�#�%�d�+�+rc�f�|ji�}|j|jd��y)N�r@�bar�rr��	authorize�r�
authorizers  r�test_authorize_baduserz9EncryptedDictionaryAuthorizedTests.test_authorize_baduser�s)���]�]�2�&�
�����-�-�n�=�>rc�j�|jddi�}|j|jd��y)Nr@�passwordr4r6r8s  r�#test_authorize_gooduser_badpasswordzFEncryptedDictionaryAuthorizedTests.test_authorize_gooduser_badpassword�s.���]�]�E�*�#5�6�
�����-�-�n�=�>rc�j�|jddi�}|j|jd��y)Nr@r<�r@r<�rr�r7r8s  r�$test_authorize_gooduser_goodpasswordzGEncryptedDictionaryAuthorizedTests.test_authorize_gooduser_goodpassword�s-���]�]�E�*�#5�6�
����
�,�,�-@�A�Brc�j�|jddi�}|j|jd��y)Nr@�	pass:word)r@rCr@r8s  r�/test_authorize_gooduser_goodpassword_with_colonzREncryptedDictionaryAuthorizedTests.test_authorize_gooduser_goodpassword_with_colon�s-���]�]�E�+�#6�7�
����
�,�,�-A�B�Crc��dttd��j�z}|jd|i�}|j	|jd��y)N�{SHA}r<r@r4)rr�	hexdigestrr�r7�rr<r9s   r�'test_authorize_gooduser_badpassword_shazJEncryptedDictionaryAuthorizedTests.test_authorize_gooduser_badpassword_sha�sK���T�(�:�"6�7�A�A�C�C���]�]�E�(�#3�4�
�����-�-�n�=�>rc��dttd��j�z}|jd|i�}|j	|jd��y)NrFr<r@r?)rrrGrr�r7rHs   r�(test_authorize_gooduser_goodpassword_shazKEncryptedDictionaryAuthorizedTests.test_authorize_gooduser_goodpassword_shasJ���T�(�:�"6�7�A�A�C�C���]�]�E�(�#3�4�
����
�,�,�-@�A�BrN)rr r!rrr:r=rArDrIrKr"rrr-r-�s-��/�,�?�?�C�D�?�
Crr-c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�SupervisorAuthHandlerTestsc��ddlm}|S)Nr��supervisor_auth_handler)r.rP)rrPs  rrz*SupervisorAuthHandlerTests._getTargetClasss��;�&�&rc�0�|j�||�Srr)rr2r(s   rrz#SupervisorAuthHandlerTests._makeOne
s��%�t�#�#�%�d�G�4�4rc��|jddid�}ddlm}|j|jj
|�y)N�ar2rr/)rr.r0r$r9�	__class__)rr(r0s   r�	test_ctorz$SupervisorAuthHandlerTests.test_ctor
s8���-�-��Q���.��C�����+�+�5�5�8�	:rc��tdddd�}tjtd��}dt	|�zg|_t
�}|jddi|�}|j|�|j|j�y)Nr5z
user:password�Authorization: Basic %s�userr<�r�base64�	b64encoderrr��DummyHandlerrr8r��handled_request�rr=�encodedr(�auth_handlers     r�/test_handle_request_authorizes_good_credentialszJSupervisorAuthHandlerTests.test_handle_request_authorizes_good_credentialssx���2�D�$��E���"�"�8�O�#<�=��3�i��6H�H�I����.���}�}�f�Z�%8�'�B���#�#�G�,�����/�/�0rc��tdddd�}tjtd��}dt	|�zg|_t
�}|jddi|�}|j|�|j|j�y)Nr5zuser:pass:wordrWrXrCrYr^s     r�7test_handle_request_authorizes_good_password_with_colonzRSupervisorAuthHandlerTests.test_handle_request_authorizes_good_password_with_colonsy���2�D�$��E���"�"�8�,<�#=�>��3�i��6H�H�I����.���}�}�f�[�%9�7�C���#�#�G�,�����/�/�0rc��tdddd�}tjtd��}dt	|�zg|_t
�}|jddi|�}|j|�|j|j�y)Nr5zwrong:wrongrWrXr<)rrZr[rrr�r\rr8r�r]r^s     r�6test_handle_request_does_not_authorize_bad_credentialszQSupervisorAuthHandlerTests.test_handle_request_does_not_authorize_bad_credentials&sz���2�D�$��E���"�"�8�M�#:�;��3�i��6H�H�I����.���}�}�f�Z�%8�'�B���#�#�G�,�����0�0�1rN)	rr r!rrrUrarcrer"rrrMrMs ��'�5�:�1�1�2rrMc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�LogWrapperTestsc��ddlm}|S)Nr)�
LogWrapper)r.ri)rris  rrzLogWrapperTests._getTargetClass0s��.��rc�.�|j�|�Srr)r�loggers  rrzLogWrapperTests._makeOne4s��%�t�#�#�%�f�-�-rc���t�}|j|�}|jd�|j}|j	t|�d�|j	|dd�y)Nzfoo
r2rr@)rr�log�datar$rS)rrk�log_wrapper�logdatas    r�'test_strips_trailing_newlines_from_msgsz7LogWrapperTests.test_strips_trailing_newlines_from_msgs7sT������m�m�F�+������ ��+�+������W��q�)�������U�+rc���t�}|j|�}g}|j|_|j	d�|jt
|�d�|j|dd�y)NzServer Errorr2r)rrr��errorrmr$rS)rrkro�errorss    r�(test_logs_msgs_with_error_at_error_levelz8LogWrapperTests.test_logs_msgs_with_error_at_error_level?s[������m�m�F�+�����}�}�������'�����V��a�(�������N�3rc���t�}|j|�}g}|j|_|j	d�|jt
|�d�|j|dd�y)NzGET /r2r)rrr��tracermr$rS)rrkro�tracess    r�'test_logs_other_messages_at_trace_levelz7LogWrapperTests.test_logs_other_messages_at_trace_levelHs[������m�m�F�+�����}�}������� �����V��a�(�������G�,rN)rr r!rrrqruryr"rrrgrg/s���.�,�4�-rrgc�$�eZdZd�Zd�Zd�Zd�Zy)�TopLevelFunctionTestsc�d�t�}||_dtifg|_t	�}ddlm}|||�}	|D]>\}}|j�|jd�}|��*tj|��@	ddlm}	|	j�|S#ddlm}	|	j�wxYw)N�dummyr)�make_http_serversrw)�
socket_map)r
�server_configsr�rpcinterface_factoriesrr.r~rx�getrPr~�supervisor.medusa.asyncore_25r�clear)
r�sconfigsr;rr~�servers�config�s�
socketfilers
          r�_make_http_serversz(TopLevelFunctionTests._make_http_serversRs����.��!)���+2�3K�B�*O�)P��&�%�'��5�#�G�[�9��	�$�
*�	������	�#�Z�Z��/�
��)��I�I�j�)�	
*�
A��������
A�����s�+B�'B�B/c���ddddddd�}	|j|g�|jd�y#t$r)}|j|jdd�Yd}~yd}~wwxYw)	Ni��	localhost�GE�inet_http_server��family�host�port�usernamer<�sectionznothing raisedrz Cannot determine socket type 999)r��fail�
ValueErrorr$�args)rr��excs   r�(test_make_http_servers_socket_type_errorz>TopLevelFunctionTests.test_make_http_servers_socket_type_errordsi���{�5�!�d�.�0��	N��#�#�V�H�-��I�I�&�'���	N����S�X�X�a�[�*L�M�M��	N�s�#/�	A!�A�A!c���tjd��5}|j}ddd�|jtj
j
��tjdddddd�}tj|ddddd	d
�}|j||g�}|jt|�d�|d}|j|d|�|d
}gd�}|j|jD�	cgc]}	|	j��c}	|�|d
}
|j|
d|�|
d
}|j|jD�	cgc]}	|	j��c}	|�y#1swY��@xYwcc}	wcc}	w)NTr�r�r�r�r������r��unix_http_server�r�rw�chmod�chownr�r<r�rrr2)zSupervisor XML-RPC HandlerzLogtail HTTP Request Handlerz!Main Logtail HTTP Request Handlerz&Supervisor Web UI HTTP Request HandlerzDefault HTTP Request Handler)rJrKrLr�rPr&�exists�socket�AF_INET�AF_UNIXr�r$rS�handlers�IDENT)rrVr��inet�unixr��inetdatar�idents�x�unixdatas           r�test_make_http_servers_noauthz3TopLevelFunctionTests.test_make_http_servers_noauthnsP��
�
(�
(��
5�	 �����J�	 ���������
�3�4�����E��D�<N�P�����
�E� �T�d�,�.���)�)�4��,�7������W��q�)��1�:������!��d�+��!�����	
���6�?�?�;�a�!�'�'�;�V�D��1�:������!��d�+��!������6�?�?�;�a�!�'�'�;�V�D�7	 �	 ��,<��
<s�
E"�3E/�E4�"E,c��tjd��5}|j}ddd�|jtj
j
��tjdddddd�}tj|d	d
dddd�}|j||g�}|jt|�d
�ddl
m}|D]2\}}|jD]}	|j!t#|	|�|	�� �4y#1swY��xYw)NTr�r�iHEr�r<r�r�r�r�r�r�rrrO)rJrKrLr�rPr&r�r�r�r�r�r$rSr.rPr�r��
isinstance)
rrVr�r�r�r�rPr�rr(s
          r�test_make_http_servers_withauthz5TopLevelFunctionTests.test_make_http_servers_withauth�s���
�
(�
(��
5�	 �����J�	 ���������
�3�4�����E�%�*�,�.�� ���
�E� �Z�J�,�.���)�)�4��,�7������W��q�)�;�%�	)�N�F�F�!�?�?�
)�����
�7�4K� L� '�)�
)�	)�	 �	 �s�
C5�5C>N)rr r!r�r�r�r�r"rrr{r{Qs���$N�E�<)rr{c��eZdZd�Zd�Zy)r\c��d|_y)NF�r]r�s rrzDummyHandler.__init__�s
��$��rc��d|_yr�r�)rr=s  rr8zDummyHandler.handle_request�s
��#��rN)rr r!rr8r"rrr\r\�s��%�$rr\c��eZdZd�Zd�Zy)r�c�$�t|�|_yr)�listrn)rrns  rrzDummyProducer.__init__�s
����J��	rc�R�|jr|jjd�Sy)Nrr)rn�popr�s rrpzDummyProducer.more�s���9�9��9�9�=�=��#�#�rN)rr r!rrpr"rrr�r��s���rr�c�V�tjtjt�Sr)�unittest�
findTestCases�sys�modulesrr"rr�
test_suiter��s���!�!�#�+�+�h�"7�8�8r�__main__r�)�defaultTest)*rZrPrQr�r�rJr��supervisor.compatrrr�supervisor.tests.baserrrr	r
rrr.r
r�TestCaser+r[rdr�r�r�r�r�rr r-rMrgr{r\r�r�r�mainr"rr�<module>r�s���
�	��
�
���&�'�"�1�:�:�.�.�.�-�(�
I�
I�(2�,��(9�(9�(2�T"2�l�H�,=�,=�"2�JI��*�*�I�V#/�H�$5�$5�#/�J/�h�&7�&7�/�4/�X�%6�%6�/�6#/�8�#4�#4�#/�Jr(�� 1� 1�r(�h/=�� 1� 1�/=�b�� C��):�):� C�D(2��!2�!2�(2�T -�h�'�'� -�DL)�H�-�-�L)�\$�$���9��z���H�M�M�l�+�r

Youez - 2016 - github.com/yon3zu
LinuXploit