403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python313/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python313/Lib/test/__pycache__/test_httpservers.cpython-313.opt-1.pyc
�

��i�����SrSSKJr SSKJrJrJrJr SSKJ	r	J
r
 SSKrSSKrSSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ r  SSK!J"r"J#r# SSKrSSK$J%r% SS	K&J'r'J(r(J)r)J*r* SS
K+J,r, \%RZ"SS9 "S
S5r."SS\R^5r0"SS\Rb\,5r2"SS\25r3"SS\25r4"SS\25r5"SS\25r6Sr7Sr8Sr9Sr:Sr;\Rx"\="\S 5=(a \R|"5S:HS!5\)"5"S"S#\2555r?"S$S%\5r@"S&S'\@5rA"S(S)5rB"S*S+\Rb\,5rC"S,S-\Rb5rD"S.S/\Rb5rE"S0S1\Rb5rFS2rG\HS3:Xa\R�"5 gg)4z�Unittests for the various HTTPServer modules.

Written by Cody A.W. Somerville <cody-somerville@ubuntu.com>,
Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest.
�)�OrderedDict)�BaseHTTPRequestHandler�
HTTPServer�SimpleHTTPRequestHandler�CGIHTTPRequestHandler)�server�
HTTPStatusN)�mock)�BytesIO�StringIO)�support)�is_apple�	os_helper�requires_subprocess�threading_helper)�ExtraAssertionsT)�modulec�$�\rSrSrSrSSjrSrg)�NoLogRequestHandler�)c��g�N�)�self�argss  �*C:\Python313\\Lib\test\test_httpservers.py�log_message�NoLogRequestHandler.log_message*s���Nc��g�N�r)r�ns  r�read�NoLogRequestHandler.read.s��rrr)�__name__�
__module__�__qualname__�__firstlineno__rr$�__static_attributes__rrrrr)s��
�rrc�&�\rSrSrSrSrSrSrg)�TestServerThread�2c�Z�[RRU5 X lXlgr)�	threading�Thread�__init__�request_handler�test_object)rr3r2s   rr1�TestServerThread.__init__3s"�����!�!�$�'�.��&�rc���[SUR5UlURRR	5uUR
lUR
lUR
RR5 SUlURRS5 URR5 g!URR5 f=f)N)�	localhostrg�������?)rr2r�socket�getsocknamer3�HOST�PORT�server_started�set�
serve_forever�server_close�rs r�run�TestServerThread.run8s��� �!1�4�3G�3G�H���7;�{�{�7I�7I�7U�7U�7W�4�����t�/�/�4����'�'�+�+�-����	'��K�K�%�%�d�+��K�K�$�$�&��D�K�K�$�$�&�s�
C�Cc�X�URR5 UR5 gr)r�shutdown�joinr?s r�stop�TestServerThread.stopBs���������	�	�r)r2rr3N)r&r'r(r)r1r@rEr*rrrr,r,2s��'�
'�rr,c�0�\rSrSrSrSrSS04SjrSrg)�BaseTestCase�Gc�D�[R"5Ul[R"5[
l[R"5Ul	[XR5UlURR5 URR5 gr)r�threading_setup�_threadsr�EnvironmentVarGuard�os�environr/�Eventr;r,r2�thread�start�waitr?s r�setUp�BaseTestCase.setUpHse��(�8�8�:��
��2�2�4��
�'�o�o�/���&�t�-A�-A�B������������ � �"rc��URR5 SUl[RR	5 [
R"UR6 gr)rQrErNrO�__exit__r�threading_cleanuprLr?s r�tearDown�BaseTestCase.tearDownPs;�����������
�
�
�����*�*�D�M�M�:r�GETNc���[RRURUR5UlUR
R
X!X45 UR
R5$r)�http�client�HTTPConnectionr9r:�
connection�request�getresponse)r�uri�method�body�headerss     rra�BaseTestCase.requestVsI���+�+�4�4�T�Y�Y��	�	�J���������T�;����*�*�,�,r)rLr`r;rQ)r&r'r(r)rTrYrar*rrrrHrHGs��#�;�#(�d�B�-rrHc��\rSrSr"SS\\5rSrSrSr	Sr
SrS	rS
r
SrSrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrg)�BaseHTTPServerTestCase�\c�R�\rSrSrSrSrSrSrSrSr	Sr
SrS	rS
r
SrSrg
)�&BaseHTTPServerTestCase.request_handler�]�HTTP/1.1c��UR[R5 URSS5 URSS5 UR	5 g)N�Content-Type�	text/html�
Connection�close��
send_responser	�
NO_CONTENT�send_header�end_headersr?s r�do_TEST�.BaseHTTPServerTestCase.request_handler.do_TESTasB�����z�4�4�5����^�[�9����\�7�3����rc��UR[R5 URSS5 URSS5 UR	5 g)Nrprqrr�
keep-alivertr?s r�do_KEEP�.BaseHTTPServerTestCase.request_handler.do_KEEPgsB�����z�4�4�5����^�[�9����\�<�8����rc�&�URS5 g)N����
send_errorr?s r�do_KEYERROR�2BaseHTTPServerTestCase.request_handler.do_KEYERRORms���O�O�C� rc�B�UR[R5 gr�r�r	�	NOT_FOUNDr?s r�do_NOTFOUND�2BaseHTTPServerTestCase.request_handler.do_NOTFOUNDps���O�O�J�0�0�1rc�*�URSSS5 g)Nr�z
Short MessagezThis is a long 
 explanationr�r?s r�do_EXPLAINERROR�6BaseHTTPServerTestCase.request_handler.do_EXPLAINERRORss���O�O�C��;�
=rc��URS5 URSS5 URSS5 UR5 g)Nr�rprqrrrs)rurwrxr?s r�	do_CUSTOM�0BaseHTTPServerTestCase.request_handler.do_CUSTOMws<�����s�#����^�[�9����\�7�3����rc��URS5 URSS5 URSS5 UR5 URSR	S5nUR
R
U5 g)Nr��	X-Special�Dängerous Mindrrrszx-special-incoming�utf-8)rurwrxrf�encode�wfile�write)rres  r�do_LATINONEHEADER�8BaseHTTPServerTestCase.request_handler.do_LATINONEHEADER}si�����s�#����[�*;�<����\�7�3������<�<� 4�5�<�<�W�E�D��J�J���T�"rc�R�UR[URSS55 g�N��r��int�pathr?s r�
do_SEND_ERROR�4BaseHTTPServerTestCase.request_handler.do_SEND_ERROR�����O�O�C��	�	�!�"�
�.�/rc�R�UR[URSS55 gr�r�r?s r�do_HEAD�.BaseHTTPServerTestCase.request_handler.do_HEAD�r�rrN)r&r'r(r)�protocol_version�default_request_versionryr}r�r�r�r�r�r�r�r*rrrr2rl]s;��%��",��	�	�	!�	2�	=�	�	#�	0�	0rr2c���[RU5 [RR	UR
UR5UlURR5 gr)	rHrTr]r^r_r9r:�con�connectr?s rrT�BaseHTTPServerTestCase.setUp�s@�����4� ��;�;�-�-�d�i�i����C��������rc���URRSS5 URR5nURUR[
R5 g)Nr[�/)r�rarb�assertEqual�statusr	�NOT_IMPLEMENTED�r�ress  r�test_command�#BaseHTTPServerTestCase.test_command�sB���������$��h�h�"�"�$��������Z�%?�%?�@rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)Nz	HTTP/1.1
�XYZBOGUSr��	r��
_http_vsn_str�
putrequest�
endheadersrbr�r�r	r�r�s  r�test_request_line_trimming�1BaseHTTPServerTestCase.test_request_line_trimming�s^��!-����������J��,��������h�h�"�"�$��������Z�%?�%?�@rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)N�FUBARr[r��	r�r�r�r�rbr�r�r	�BAD_REQUESTr�s  r�test_version_bogus�)BaseHTTPServerTestCase.test_version_bogus�s^��!(����������E�3�'��������h�h�"�"�$��������Z�%;�%;�<rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)Nz
HTTP/9.9.9r[r�r�r�s  r�test_version_digits�*BaseHTTPServerTestCase.test_version_digits�s^��!-����������E�3�'��������h�h�"�"�$��������Z�%;�%;�<rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)NzHTTP/-9_9_9.+9_9_9r[r�r�r�s  r�"test_version_signs_and_underscores�9BaseHTTPServerTestCase.test_version_signs_and_underscores�s^��!5����������E�3�'��������h�h�"�"�$��������Z�%;�%;�<rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)NzHTTP/909876543210.0r[r�r�r�s  r�"test_major_version_number_too_long�9BaseHTTPServerTestCase.test_major_version_number_too_long��^��!6����������E�3�'��������h�h�"�"�$��������Z�%;�%;�<rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)NzHTTP/1.909876543210r[r�r�r�s  r�"test_minor_version_number_too_long�9BaseHTTPServerTestCase.test_minor_version_number_too_long�r�rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)Nr"r[r�r�r�s  r�test_version_none_get�,BaseHTTPServerTestCase.test_version_none_get�s^��!#����������E�3�'��������h�h�"�"�$��������Z�%?�%?�@rc��SURlURRSS5 URR5 URR	5nURUR[R5 g)Nr"�CUSTOMr�r�r�s  r�test_version_none�(BaseHTTPServerTestCase.test_version_none�s^��!#����������H�c�*��������h�h�"�"�$��������Z�%;�%;�<rc�<�SURlSURlURRSS5 URR	5 URR5nUR
UR[R5 g)N�czHTTP/9.9r[r�)
r��	_http_vsnr�r�r�rbr�r�r	�HTTP_VERSION_NOT_SUPPORTEDr�s  r�test_version_invalid�+BaseHTTPServerTestCase.test_version_invalid�sj�������!+����������E�3�'��������h�h�"�"�$��������Z�%J�%J�Krc��SURlURRSS5 URR5 URR	5nURUR[R5 gr!r�r�s  r�test_send_blank�&BaseHTTPServerTestCase.test_send_blank�s^��!#����������B��#��������h�h�"�"�$��������Z�%;�%;�<rc�0�URRSS5 URRSS5 URR5 URR	5nURUR[R5 g)Nr[r�rrrs)	r�r��	putheaderr�rbr�r�r	r�r�s  r�test_header_close�(BaseHTTPServerTestCase.test_header_close�sf�������E�3�'������<��1��������h�h�"�"�$��������Z�%?�%?�@rc�R�SURlURRSS5 URRSS5 URR	5 URR5nUR
UR[R5 g)Nrnr[r�rrr|)
r�r�r�r�r�rbr�r�r	r�r�s  r�test_header_keep_alive�-BaseHTTPServerTestCase.test_header_keep_alive�sr��!+����������E�3�'������<��6��������h�h�"�"�$��������Z�%?�%?�@rc���URRSS5 URR5nURUR[
R5 g)N�TESTr�)r�rarbr�r�r	rvr�s  r�test_handler�#BaseHTTPServerTestCase.test_handler�sB���������%��h�h�"�"�$��������Z�%:�%:�;rc�4�URRSS5 URR5nURUR	S5S5 URRSS5 URURR5 g)N�KEEPr�rrr|r�)r�rarbr��	getheader�
addCleanuprsr�s  r�test_return_header_keep_alive�4BaseHTTPServerTestCase.test_return_header_keep_alive�si���������%��h�h�"�"�$��������|�4�l�C��������%���������'rc��URRSS5 URR5nURURS5 g)N�KEYERRORr�r��r�rarbr�r�r�s  r�test_internal_key_error�.BaseHTTPServerTestCase.test_internal_key_error�s<��������S�)��h�h�"�"�$��������S�)rc��URRSS5 URR5nURURS5 g)Nr�r�r�r�r�s  r�test_return_custom_status�0BaseHTTPServerTestCase.test_return_custom_status�s<��������3�'��h�h�"�"�$��������S�)rc��URRSS5 URR5nURURS5 UR[
URS555 g)N�EXPLAINERRORr�r��Content-Length)r�rarbr�r��
assertTruer�r�r�s  r�test_return_explain_error�0BaseHTTPServerTestCase.test_return_explain_errorsW���������-��h�h�"�"�$��������S�)�����C�M�M�*:�;�<�=rc��URRSSSS0S9 URR5nURUR	S5S5 URUR5SR
S55 g)	N�LATINONEHEADERr�zX-Special-IncominguÄrger mit Unicode�rfr�r�r�)r�rarbr�r�r$r�r�s  r�test_latin1_header�)BaseHTTPServerTestCase.test_latin1_headersw�������)�3� �(<�9
��	��h�h�"�"�$��������{�3�5F�G��������%9�%@�%@��%I�Jrc�J�URRSS5 URR5nURUR[
R5 UR5nUR[URS55[U55 g)N�NOTFOUNDr�r�)r�rarbr�r�r	r�r$r�r��len)rr��datas   r�test_error_content_length�0BaseHTTPServerTestCase.test_error_content_lengthsp��������S�)��h�h�"�"�$��������Z�%9�%9�:��x�x�z������S�]�]�+;�<�=�s�4�y�Irc��[R[R4n[R[R[R[R[R
4H�nURRSSRU55 URR5nURX#R5 URSURS55 URSURS55 X!;a!URSURS55 UR5nURSU5 M� g)N�
SEND_ERROR�/{}r�rp�Transfer-Encodingr)r	�NOT_MODIFIED�
RESET_CONTENTrv�
PROCESSING�SWITCHING_PROTOCOLSr�ra�formatrbr�r�r�r$�r�allow_transfer_encoding_codes�coder�rs     r�test_send_error�&BaseHTTPServerTestCase.test_send_errors��)3�)@�)@�)3�)A�)A�)C�%��*�*�J�,C�,C��*�*�J�,D�,D��3�3�5�D�
�H�H���\�5�<�<��+=�>��(�(�&�&�(�C����T�:�:�.����T�3�=�=�1A�#B�C����T�3�=�=��#@�A��8�� � ��s�}�}�5H�'I�J��8�8�:�D����S�$�'�5rc��[R[R4n[R[R[R[R[R
4GHPnURRSSRU55 URR5nURX#R5 U[R:XaNUR[URS55S:�5 URSURS55 OBURSURS55 URSURS55 X!;a!URSURS55 UR!5nURSU5 GMS g)	N�HEADrr�rrqrprr)r	r
r�OKrvrr�rarrbr�r�r�r�r��assertInr$rs     r�test_head_via_send_error�/BaseHTTPServerTestCase.test_head_via_send_error*sF��)3�)@�)@�)3�)A�)A�)C�%��]�]�J�$9�$9��,�,�j�.F�.F��3�3�5�D�
�H�H���V�U�\�\�$�%7�8��(�(�&�&�(�C����T�:�:�.��z�}�}�$�����C�M�M�2B�$C� D�q� H�I��
�
�k�3�=�=��+H�I�� � ��s�}�}�5E�'F�G�� � ��s�}�}�^�'D�E��8�� � ��s�}�}�5H�'I�J��8�8�:�D����S�$�'�!5r�r�N)r&r'r(r)rrr2rTr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr*rrrriri\s���,0�-�/E�,0�\�
A�
A�=�=�=�=�=�A�=�L�=�A�A�<�
(�*�
*�
>�K�J�(�"(rric�R^�\rSrSr"SS\\5rU4SjrSrSr	Sr
SrU=r$)	�HTTP09ServerTestCasei@c��\rSrSrSrSrSrg)�$HTTP09ServerTestCase.request_handleriBz$Request handler for HTTP/0.9 server.c�r�URRSURS3R55 g)NzOK: here is z
)r�r�r�r�r?s r�do_GET�+HTTP09ServerTestCase.request_handler.do_GETEs*���J�J���|�D�I�I�;�d�;�B�B�D�ErrN)r&r'r(r)�__doc__r#r*rrrr2r!Bs��2�	Frr2c�4>�[TU]5 [R"[R[R5UlUR
UR
5UlUR
RURUR45 gr)
�superrTr7�AF_INET�SOCK_STREAM�sock�enterContextr�r9r:�r�	__class__s �rrT�HTTP09ServerTestCase.setUpHs]���
��
���M�M�&�.�.�&�2D�2D�E��	��%�%�d�i�i�0��	��	�	���4�9�9�d�i�i�0�1rc��URRS5 URRS5nURUS5 g)NsGET /index.html
�sOK: here is /index.html
)r*�send�recvr�r�s  r�test_simple_get�$HTTP09ServerTestCase.test_simple_getNs6���	�	���-�.��i�i�n�n�T�"������<�=rc��URRS5 URRS5nURSU5 g)NsPOST /index.html
r0s"Bad HTTP/0.9 request type ('POST'))r*r1r2rr�s  r�test_invalid_request�)HTTP09ServerTestCase.test_invalid_requestSs4���	�	���.�/��i�i�n�n�T�"���
�
�;�S�Arc��URRS5 URRS5nURUS5 [R
"[5 URRS5 URRS5nURUS5 SSS5 g!,(df   g=f)NsGET /foo.html
r0sOK: here is /foo.html
sGET /bar.html
r)r*r1r2r��
contextlib�suppress�OSErrorr�s  r�test_single_request�(HTTP09ServerTestCase.test_single_requestXs����	�	���+�,��i�i�n�n�T�"������:�;��
 �
 ��
)��I�I�N�N�/�0��)�)�.�.��&�C����S�#�&�	*�
)�
)�s
�#A	B5�5
C)r*)
r&r'r(r)rrr2rTr3r6r<r*�
__classcell__�r-s@rrr@s/���F�-�/E�F�2�>�
B�
'�'rrc�6�\rSrSr"SS\5rSrSrSrg)�RequestHandlerLoggingTestCaseifc�(�\rSrSrSrSrSrSrSrg)�-RequestHandlerLoggingTestCase.request_handlerigrnc�b�UR[R5 UR5 gr)rur	rrxr?s rr#�4RequestHandlerLoggingTestCase.request_handler.do_GETks �����z�}�}�-����rc�D�UR[RS5 g)NzFile not foundr�r?s r�do_ERROR�6RequestHandlerLoggingTestCase.request_handler.do_ERRORos���O�O�J�0�0�2B�CrrN)	r&r'r(r)r�r�r#rGr*rrrr2rCgs��%��",��	�	Drr2c��[RRURUR5UlUR
R
5 [R"5nUR
RSS5 UR
R5 SSS5 URWR5S5 g!,(df   N/=f)Nr[r�z"GET / HTTP/1.1" 200 -
)
r]r^r_r9r:r�r�r
�captured_stderrrarb�assertEndsWith�getvalue)r�errs  r�test_get�&RequestHandlerLoggingTestCase.test_getrs����;�;�-�-�d�i�i����C���������
�
$�
$�
&�#��H�H���U�C�(��H�H� � �"�'�	
���C�L�L�N�,F�G�	'�
&�s�)7C	�	
Cc��[RRURUR5UlUR
R
5 [R"5nUR
RSS5 UR
R5 SSS5 WR5RS5nURUSS5 URUSS5 g!,(df   NX=f)N�ERRORr��
rz code 404, message File not foundr�z"ERROR / HTTP/1.1" 404 -)r]r^r_r9r:r�r�r
rJrarbrL�splitrK)rrM�liness   r�test_err�&RequestHandlerLoggingTestCase.test_err|s����;�;�-�-�d�i�i����C���������
�
$�
$�
&�#��H�H���W�c�*��H�H� � �"�'�����$�$�T�*�����E�!�H�&H�I����E�!�H�&@�A�
'�
&�s�)7C2�2
DrN)	r&r'r(r)rr2rNrUr*rrrrArAfs��	D�0�	D�H�
BrrAc�<^�\rSrSr"SS\\5rU4SjrU4SjrS#Sjr	S#Sjr
Sr\R"\RS	5S
5r\R"\RS	5S5r\R$"\S5\R$"\R*S
:HS5\R"\R,S5S555r\R$"\S5\R$"\R*S
:HS5\R"\R,S5S555rSr\R"\R4S5S5r\R"\R4S5S5rSrSrSrSr Sr!Sr"Sr#Sr$Sr%Sr&S r'S!r(S"r)U=r*$)$�SimpleHTTPServerTestCasei�c��\rSrSrSrg)�(SimpleHTTPServerTestCase.request_handleri�rN)r&r'r(r)r*rrrr2rZ�s��rr2c�>�[TU]5 [R"5Ul[
R"5n[R"U5 SUl[
R"US9Ul
[RRUR5Ul
SUR-Ul[RRURS5n[!US5nUR#UR5 UR%5 SSS5 [R&"U5R(n[*R*R-U[*R.R05nUR3SS9Ul[6R8R;UR=5SS	9Ulg!,(df   N�=f)
NsWe are the knights who say Ni!)�dirr��test�wbr)�microsecondT��usegmt) r'rTrN�getcwd�cwd�tempfile�
gettempdir�chdirr�mkdtemp�tempdirr��basename�tempdir_name�base_urlrD�openr��flush�stat�st_mtime�datetime�
fromtimestamp�timezone�utc�replace�last_modif_datetime�email�utils�
formatdate�	timestamp�last_modif_header)r�basetempdir�tempname�temp�mtime�
last_modifr-s      �rrT�SimpleHTTPServerTestCase.setUp�sA���
��
���9�9�;����)�)�+��
�����5��	��'�'�K�8����G�G�,�,�T�\�\�:����d�/�/�/��
��7�7�<�<����f�5��
�(�D�
!�T��J�J�t�y�y�!��J�J�L�"�����!�*�*���&�&�4�4�U����!�!�#�
�#-�#5�#5�!�#5�#D�� �!&���!7�!7�� � �"�4�"8�"1���"�
!�s�-,F?�?
G
c��>�[R"UR5 [R"UR
5 [TU]5 g! N=f![TU]5 f=fr)rNrfrc�shutil�rmtreerhr'rYr,s �rrY�!SimpleHTTPServerTestCase.tearDown�sP���	��H�H�T�X�X��
��
�
�d�l�l�+�
�G����
����G���s� A� A�A�A�A*c�^^�UU4SjnSmUTlTR5nURT5 URTRU5 URTR5 U(aURX55 URTRS5 URTRRSS5S5 URTRS5SS5 TR5 U$)Nc�,>�TRmSTlg)zKDon't close reader yet so we can check if there was leftover
buffered inputN)�fp)�reader�responses��r�
close_conn�DSimpleHTTPServerTestCase.check_status_and_reason.<locals>.close_conn�s����[�[�F��H�Kr�
rrrs�rzConnection should be closed)�_close_connr$r�r�r��assertIsNotNone�reason�version�msg�getrs)rr�r�rr�rer�s `    @r�check_status_and_reason�0SimpleHTTPServerTestCase.check_status_and_reason�s����	���)����}�}�������!�������&�1����X�_�_�-�����T�(�	
����)�)�2�.�������)�)�,��@�'�J�������R��#�/L�M������rc���[RRURU5n[R"[RRURU55 Uc[RRUSS9nURURS-U-S-5nURU[R5n[ R""URSUS3SS9n[$R&"5nSUS	3R)US
5nUR+US-U5 UR+US-U5 g![
[4a URSU<S35 GN	f=f)
NzCan not create directory � on current file system�
surrogatepass��errorsr�F��quote�listing for z</�surrogateescape�title>�h1>)rNr�rDrh�mkdirr;�UnicodeEncodeError�skipTest�urllib�parser�rarkr�r	r�html�escape�sys�getfilesystemencodingr�r)	r�dirname�
quotedname�fullpathr�re�displaypath�enc�prefixs	         r�check_list_dir_dirname�/SimpleHTTPServerTestCase.check_list_dir_dirname�s;���7�7�<�<����g�6��	5��H�H�R�W�W�\�\�$�,�,��8�9�
�����+�+�G�O�+�L�J��<�<��
�
�� 3�j� @�3� F�G���+�+�H�j�m�m�D���k�k�T�]�]�O�1�W�I�Q�"?�u�M���'�'�)����}�B�/�6�6�s�<M�N���
�
�f�y�(�$�/��
�
�f�v�o�t�,���+�,�	5��M�M�5�g�[�A3�4�
5�	5�s�>E
�
&E4�3E4c���[RRURU5n[	U5R5[R=(d S-n[US5nURU5 SSS5 URURS-5nURU[R 5n["R$R'USS9nUR(R+5nUR-U5 UR/SUS	3RS
5U5 [0R2"USS9n	UR/S
U	S3RUS5U5 URURS-U-5nURU[R US9 g!,(df   GN7=f![a URSU<S35 GN]f=f)N��r^zCan not create file r�r�r�r�zhref="�"�asciiFr��>�<r��r)rNr�rDrhr�r�r�TESTFN_UNDECODABLErlr�r;r�rarkr�r	rr�r�r�rf�get_content_charsetr�rr�r�)
r�filenamer��content�fr�rer�r��displaynames
          r�check_list_dir_filename�0SimpleHTTPServerTestCase.check_list_dir_filename�s����7�7�<�<����h�7����/�(�(�*�i�.J�.J�.U�g�V��	5��h��%������ �&��<�<��
�
�� 3�4���+�+�H�j�m�m�D���\�\�'�'���'�I�
����2�2�4�����S�!��
�
��
�|�1�-�5�5�g�>��E��k�k�(�%�8���
�
��+��a�(�/�/��5F�G��N��<�<��
�
�� 3�j� @�A���$�$�X�z�}�}�7�$�K�!&�%���	5��M�M�0���=3�4�
5�	5�s0�F?�+F-�=F?�-
F<�7F?�<F?�? G#�"G#zneed os_helper.TESTFN_NONASCIIc�L�[RS-nURU5 g�N�.dir)r�TESTFN_NONASCIIr��rr�s  r�test_list_dir_nonascii_dirname�7SimpleHTTPServerTestCase.test_list_dir_nonascii_dirname�s"���+�+�f�4���#�#�G�,rc�L�[RS-nURU5 g�N�.txt)rr�r��rr�s  r�test_list_dir_nonascii_filename�8SimpleHTTPServerTestCase.test_list_dir_nonascii_filename�s"���,�,�v�5���$�$�X�.rz<undecodable name cannot always be decoded on Apple platforms�win32z+undecodable name cannot be decoded on win32z!need os_helper.TESTFN_UNDECODABLEc�t�[R"[R5S-nUR	U5 gr�)rN�fsdecoderr�r�r�s  r�!test_list_dir_undecodable_dirname�:SimpleHTTPServerTestCase.test_list_dir_undecodable_dirname�s+���+�+�i�:�:�;�f�D���#�#�G�,rc�t�[R"[R5S-nUR	U5 gr�)rNr�rr�r�r�s  r�"test_list_dir_undecodable_filename�;SimpleHTTPServerTestCase.test_list_dir_undecodable_filenames+���;�;�y�;�;�<�v�E���$�$�X�.rc�(�SnURUSS9 g)Nu�.dirz%ff.dir�r�)r�r�s  r�"test_list_dir_undecodable_dirname2�;SimpleHTTPServerTestCase.test_list_dir_undecodable_dirname2
s�����#�#�G�	�#�Brz!need os_helper.TESTFN_UNENCODABLEc�L�[RS-nURU5 gr�)r�TESTFN_UNENCODABLEr�r�s  r�!test_list_dir_unencodable_dirname�:SimpleHTTPServerTestCase.test_list_dir_unencodable_dirnames"���.�.��7���#�#�G�,rc�L�[RS-nURU5 gr�)rr�r�r�s  r�"test_list_dir_unencodable_filename�;SimpleHTTPServerTestCase.test_list_dir_unencodable_filenames"���/�/�&�8���$�$�X�.rc
���SHLnURUS9 US-nURU[RR	USS9S9 SSS5 MN g!,(df   M`=f)N�	zq?zf#z&amp;z&ampz<i>z"dq"z'sq'z%A4z	%E2%82%AC��namer�z&<>'")�safer�)�subTestr�r�r�r�)rr�r�s   r�test_list_dir_escape_dirname�5SimpleHTTPServerTestCase.test_list_dir_escape_dirnamesa��)�D����4��(���-���+�+�G�#)�<�<�#5�#5�g�H�#5�#M�,�O�)�(�)�(�(�s�2A�
A#	c��SHonURUS9 US-nURU5 [R"[R
R
URU55 SSS5 Mq g!,(df   M�=f)Nr�r�r�)r�r�r�unlinkrNr�rDrh)rr�r�s   r�test_list_dir_escape_filename�6SimpleHTTPServerTestCase.test_list_dir_escape_filename&sc��)�D����4��(��&�=���,�,�X�6�� � ������d�l�l�H�!E�F�)�(�)�(�(�s�AA7�7
B	c��SURS3RS5nURURS-5R5nUR	US-U5 UR	US-U5 URURS-5R5nUR	US-U5 UR	US-U5 g)Nr�z/</�latin1z/#123r�r�z/?x=123)rkr�rar$r)rr�r�s   r�%test_list_dir_with_query_and_fragment�>SimpleHTTPServerTestCase.test_list_dir_with_query_and_fragment/s�����
�
��c�2�9�9�(�C���<�<��
�
�� 7�8�=�=�?���
�
�f�y�(�(�3��
�
�f�v�o�x�0��<�<��
�
�	� 9�:�?�?�A���
�
�f�y�(�(�3��
�
�f�v�o�x�0rc��[R"[RRURS55 SUR
S3nUS3nUR
U5nURU[R5 URS5nURXBSS9 SU3nUR
U5nURU[R5 URS5nURUS5 URXBS	S9 SU3nUR
U5nURU[R5 URURS5U5 S
U3nUS3nUR
U5nURU[R5 URS5nURUS
5 g)a!Ensure //evil.co/..%2f../../X does not put //evil.co/ in Location.

//netloc/ in a Location header is a redirect to a new host.
https://github.com/python/cpython/issues/87389

This checks that a path resolving to a directory on our server cannot
resolve into a redirect to another server.
�existing_directoryz2/python.org/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../z/existing_directoryr��Locationznon-attack failed!�r��//zcExpected Location header to start with a single / and end with a / as this is a directory redirect.zhttps://pypi.org/N)rNr�r�rDrhrjrar�r	�MOVED_PERMANENTLYr�r��assertNotStartsWith�assertStartsWith)	r�url�expected_locationr��location�
attack_url�attack3_url�attack_scheme_netloc_2slash_url�expected_scheme_netloc_locations	         r�3test_get_dir_redirect_location_domain_injection_bug�LSimpleHTTPServerTestCase.test_get_dir_redirect_location_domain_injection_bug8s���	��������d�l�l�,@�A�B�B�4�CT�CT�BU�Uh�i��"�e�1�I���<�<��$���$�$�X�z�/K�/K�L��%�%�j�1������:N��O����Y�
��<�<�
�+���$�$�X�z�/K�/K�L��%�%�j�1��� � ��4�0�����@�	�	A�
�3�%�j���<�<��,���$�$�X�z�/K�/K�L�����+�+�J�7�9J�K�->�c�U�*C�'�-L�,M�Q�*O�'��<�<� ?�@���$�$�X�z�/K�/K�L��%�%�j�1��	
���h�(;�<rc�
�URURS-5nURU[RUR
S9 URURS-5nURU[R5 URURS-5nURU[R5 URURS-5nURU[R5 URURS-5nURU[R5 URURS-5nURU[R5 URURS-5nURU[R5 URUR5nURU[R5 URURS	5URS-5 URURS
5S5 URURS-5nURU[R5 URURS
-5nURU[R5 URURS	5URS-5 URS5nURU[R5 URS5nURU[R5 [R"[RRURSS55 URURS-5nURU[R5 Sn[[RRUR S5S5nUR#U5 SSS5 URURS-5nURU[RU5 [R$S:Xa�[R&"5S:wa�[R("URS5 URURS-5nURU[R5 [R("URS5 ggg!,(df   N�=f![R("URS5 f=f)N�/testr��/test/z/test%2fz/test%2Fr�z%2fz%2Fr�r��0�/?hi=2�?hi=1�/?hi=1z/ThisDoesNotExistz/ThisDoesNotExist/�spamz
index.htmlz/spam/sDummy index file
r^�posixri�)rarkr�r	rrr�r�r�r�rN�makedirsr�rDrhrlrjr�r��geteuid�chmod)rr�rr�s    rrN�!SimpleHTTPServerTestCase.test_getis����<�<��
�
�� 7�8���$�$�X�z�}�}�4�9�9�$�M��<�<��
�
�� 8�9���$�$�X�z�/C�/C�D��<�<��
�
�
� :�;���$�$�X�z�/C�/C�D��<�<��
�
�
� :�;���$�$�X�z�/C�/C�D��<�<��
�
�� 3�4���$�$�X�z�}�}�=��<�<��
�
�� 5�6���$�$�X�z�}�}�=��<�<��
�
�� 5�6���$�$�X�z�}�}�=��<�<��
�
�.���$�$�X�z�/K�/K�L�����+�+�J�7�����9L�M�����+�+�,<�=�s�C��<�<��
�
�� 8�9���$�$�X�z�}�}�=��<�<��
�
�� 7�8���$�$�X�z�/K�/K�L�����+�+�J�7�����1�	3��<�<� 3�4���$�$�X�z�/C�/C�D��<�<� >�?���$�$�X�z�/C�/C�D�
���B�G�G�L�L����v�|�D�E��<�<��
�
�� 8�9���$�$�X�z�}�}�=�&��
�"�'�'�,�,�t�0�0�,�?��
F�!�
�G�G�D�M�G��<�<��
�
�� 3�4���$�$�X�z�}�}�d�C��7�7�g��"�*�*�,�!�"3��H�H�T�\�\�1�%�
.��<�<��
�
��(;�<���,�,�X�z�7K�7K�L�������u�-�
#4��G�
F��������u�-�s�T�->T �
T� #Uc�:�URURS-SS9nURU[R5 URUR
S5[[UR555 URUR
S5S5 g)Nrr�rdzcontent-lengthzcontent-typezapplication/octet-stream)
rarkr�r	rr�r��strrr�rr�s  r�	test_head�"SimpleHTTPServerTestCase.test_head�s����<�<��M�M�G�#�F� �4���$�$�X�z�}�}�=�����+�+�,<�=��S����^�,�	.�����+�+�N�;�3�	5rc��[RR5nURUS'UR	UR
S-US9nUR
U[R5 UR[R"SS9-n[RR5n[RRUSS9US'UR	UR
S-US9nUR
U[R5 g)	z�Check that when a request to /test is sent with the request header
If-Modified-Since set to date of last modification, the server returns
status code 304, not 200
�If-Modified-Sincerrr�)�hoursTr`N)rv�message�Messagerzrarkr�r	r
rurp�	timedeltarw�format_datetime)rrfr��new_dts    r�test_browser_cache�+SimpleHTTPServerTestCase.test_browser_cache�s���
�-�-�'�'�)��'+�'=�'=��#�$��<�<��
�
�� 7��<�I���$�$�X�z�/F�/F�G��)�)�H�,>�,>�Q�,G�G���-�-�'�'�)��',�{�{�'B�'B�6��(C�(��#�$��<�<��
�
�� 7��<�I���$�$�X�z�/F�/F�Grc�B�URnU[R"SS9-
n[RR5n[RRUSS9US'URURS-US9nURU[R5 g)Nim)�daysTr`rrr)
rurprrvrrrwrrarkr�r	r)r�dt�old_dtrfr�s     r�test_browser_cache_file_changed�8SimpleHTTPServerTestCase.test_browser_cache_file_changed�s���
�
%�
%���h�(�(�c�2�2���-�-�'�'�)��',�{�{�'B�'B�6��(C�(��#�$��<�<��
�
�� 7��<�I���$�$�X�z�}�}�=rc���[RR5nURUS'SUS'UR	UR
S-US9nUR
U[R5 g)Nr�*z
If-None-Matchrr)	rvrrrzrarkr�r	r)rrfr�s   r�,test_browser_cache_with_If_None_Match_header�ESimpleHTTPServerTestCase.test_browser_cache_with_If_None_Match_header�s`���-�-�'�'�)��'+�'=�'=��#�$�#&��� ��<�<��
�
�� 7��<�I���$�$�X�z�}�}�=rc�$�URSSS9nURU[R5 URSSS9nURU[R5 URSSS9nURU[R5 g)Nr��FOOr�custom�GETs)rar�r	r�rs  r�test_invalid_requests�.SimpleHTTPServerTestCase.test_invalid_requests�sz���<�<��E�<�2���$�$�X�z�/I�/I�J��<�<��H�<�5���$�$�X�z�/I�/I�J��<�<��F�<�3���$�$�X�z�/I�/I�Jrc���URURS-5nURU[RUR
S9 URSnURX R5 g)z�Checks that the datetime returned in Last-Modified response header
is the actual datetime of last modification, rounded to the second
rr�z
Last-modifiedN)	rarkr�r	rrrfr�rz)rr�rzs   r�test_last_modified�+SimpleHTTPServerTestCase.test_last_modified�s^���<�<��
�
�� 7�8���$�$�X�z�}�}�4�9�9�$�M�$�,�,�_�=�����*�,B�,B�Crc��URURS-5nURU[RUR
S9 URURS-5nURU[R5 URURS-5nURU[R5 URUR5nURU[R5 URURS5URS-5 URURS-5nURU[R5 URURS-5nURU[R5 URURS5URS-5 g)	Nrr�rr�r�rrr)
rarjr�r	rrr�r�r�r�rs  r�test_path_without_leading_slash�8SimpleHTTPServerTestCase.test_path_without_leading_slash�sl���<�<�� 1� 1�G� ;�<���$�$�X�z�}�}�4�9�9�$�M��<�<�� 1� 1�H� <�=���$�$�X�z�/C�/C�D��<�<�� 1� 1�C� 7�8���$�$�X�z�}�}�=��<�<�� 1� 1�2���$�$�X�z�/K�/K�L�����+�+�J�7��*�*�S�0�	2��<�<�� 1� 1�H� <�=���$�$�X�z�}�}�=��<�<�� 1� 1�G� ;�<���$�$�X�z�/K�/K�L�����+�+�J�7��*�*�X�5�	7r)rkrcrrurzrhrjr)+r&r'r(r)rrr2rTrYr�r�r��unittest�
skipUnlessrr�r�r��skipIfrr��platformr�r�r�r�r�r�r�r�r�r�rrNrrr#r'r-r0r3r*r>r?s@rrXrX�s����
�-�/G�
�1�*��2-�$L�,����2�2�9�;�-�;�-�����2�2�9�;�/�;�/��_�_�X�S�U�
�_�_�S�\�\�W�,�B�D�
����5�5�<�>�-�>�D�U�-��_�_�X�S�U�
�_�_�S�\�\�W�,�B�D�
����5�5�<�>�/�>�D�U�/�C�����5�5�<�>�-�>�-�����5�5�<�>�/�>�/�O�G�1�/=�b1.�f5�H�$	>�>�K�D�7�7rrXzD#!%s

print("Content-type: text/html")
print()
print("Hello World")
a�#!%s
import os
import sys
import urllib.parse

print("Content-type: text/html")
print()

content_length = int(os.environ["CONTENT_LENGTH"])
query_string = sys.stdin.buffer.read(content_length)
params = {key.decode("utf-8"): val.decode("utf-8")
            for key, val in urllib.parse.parse_qsl(query_string)}

print("%%s, %%s, %%s" %% (params["spam"], params["eggs"], params["bacon"]))
zR#!%s
import os

print("Content-type: text/html")
print()

print(os.environ["%s"])
a'#!%s
import os

print("X-ambv: was here")
print("Content-type: text/html")
print()
print("<pre>")
for k, v in os.environ.items():
    try:
        k.encode('ascii')
        v.encode('ascii')
    except UnicodeEncodeError:
        continue  # see: BPO-44647
    print(f"{k}={v}")
print("</pre>")
z�#!%s
import os
import sys

print("Content-type: text/plain")
print()

content_length = int(os.environ["CONTENT_LENGTH"])
body = sys.stdin.buffer.read(content_length)

print(f"{content_length} {len(body)}")
rz7This test can't be run reliably as root (issue #13308).c���\rSrSr"SS\\5r\RRS5rSr
SrSrSr
S	rS
rSrSrS
rSrSrSrSrSrSrSrSrSrSrg)�CGIHTTPServerTestCasei4c�,^�\rSrSrSrU4SjrSrU=r$)�%CGIHTTPServerTestCase.request_handleri8Nc�>�URR[S5 [TU]"U0UD6 SSS5 g!,(df   g=f)Nz#http\.server\.CGIHTTPRequestHandler)�_test_case_self�assertWarnsRegex�DeprecationWarningr'r1)rr�kwargsr-s   �rr1�.CGIHTTPServerTestCase.request_handler.__init__;sA����%�%�6�6�&�:�<�
�� �$�1�&�1�<�<�<�s	�<�
A
r)r&r'r(r)r>r1r*r>r?s@rr2r<8s�����	2�	2rr2r�c�n�XRl[RU5 [R
"5Ul[R"5Ul	[RRURS5Ul[RRURS5Ul
[RRURS5Ul[RRURS5Ul[RRURS5Ul[R""UR5 [R""UR5 [R""UR5 [R""UR5 [R""UR 5 SUlSUlSUlSUlSUlSUlSUlSUlSUl[6R8"5(ac[RRURS5Ul[<R>"UR:5RA5UlO[BRDUlUR:RGS5 [RRURS5Ul[OUR$S	SS
9nURQ[RUR:-5 SSS5 [RT"UR$S5 [RRURS5Ul[OUR&S	SS
9nURQ[RUR:-5 SSS5 [RT"UR&S5 [RRURS
5Ul[OUR(S	SS
9nURQ[VUR:-5 SSS5 [RT"UR(S5 [RRURS5Ul[OUR*S	SS
9nURQ[RUR:-5 SSS5 [RT"UR*S5 [RRURS5Ul[OUR,S	SS
9nURQ[XUR:S4-5 SSS5 [RT"UR,S5 [RRUR S5Ul[OUR.S	SS
9nURQ[RUR:-5 SSS5 [RT"UR.S5 [RRURS5Ul[OUR0S	SS
9nURQ[ZUR:-5 SSS5 [RT"UR0S5 [RRURS5Ul[OUR2S	SS
9nURQ[\UR:-5 SSS5 [RT"UR2S5 [R^"UR5 g![Ha% URK5 URMS5 GN�f=f!,(df   GNu=f!,(df   GN�=f!,(df   GNy=f!,(df   GN�=f!,(df   GN{=f!,(df   GN�=f!,(df   GN=f!,(df   GN=f)Nzcgi-binz	child-dir�subr\�pythonr�z0Python executable path is not encodable to utf-8znocgi.py�w)�encodingi�zfile1.pyzfile2.pyzfile3.pyzfile4.py�QUERY_STRINGzfile5.pyzfile6.pyzfile7.py)0r2r>rHrTrNrbrcrdrg�
parent_dirr�rD�cgi_dir�
cgi_child_dir�	sub_dir_1�	sub_dir_2�cgi_dir_in_sub_dirr��
nocgi_path�
file1_path�
file2_path�
file3_path�
file4_path�
file5_path�
file6_path�
file7_path�_pythonexe_symlinkr�can_symlink�	pythonexer
�
PythonSymlink�	__enter__r��
executabler�r�rYr�rlr��	cgi_file1r
�	cgi_file2�	cgi_file4�	cgi_file6�	cgi_file7rf)	rr��file1�file2�file3�file4�file5�file6�file7s	         rrT�CGIHTTPServerTestCase.setUpEs��/3���,����4� ��9�9�;���"�*�*�,����w�w�|�|�D�O�O�Y�?����W�W�\�\�$�,�,��D��������d�o�o�u�=��������d�n�n�e�<���"$�'�'�,�,�t�~�~�y�"I���
�������
����#�#�$�
������ �
������ �
����(�(�)�������������������������#'���� � �"�"��W�W�\�\�$�/�/�8�D�D�N�&-�&;�&;�D�N�N�&K�&U�&U�&W�D�#� �^�^�D�N�	N�
�N�N�!�!�'�*�
�'�'�,�,�t���
�C���
�$�/�/�3��
9�R��H�H�Y����/�0�:�
������%�(��'�'�,�,�t�|�|�Z�@���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(��'�'�,�,�t�|�|�Z�@���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(��'�'�,�,�t�'9�'9�:�F���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(��'�'�,�,�t�|�|�Z�@���
�$�/�/�3��
9�U��K�K�	�T�^�^�^�$D�D�E�:�
������%�(��'�'�,�,�t�'>�'>�
�K���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(��'�'�,�,�t�|�|�Z�@���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(��'�'�,�,�t�|�|�Z�@���
�$�/�/�3��
9�U��K�K�	�D�N�N�2�3�:�
������%�(�
������!��Y"�	N��M�M�O��M�M�L�M�	N��
:�
9��
:�
9��
:�
9��
:�
9��
:�
9��
:�
9��
:�
9��
:�
9�sr�7]5�#^'�&#^9�6#_�#_�%_/�(#`�8#`�#`%�5+^$�#^$�'
^6�9
_�
_�
_,�/
_>�
`�
`"�%
`4c�.�SURl[R"UR5 UR
(aUR
R
SSS5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 UR(a [R"UR5 [R "UR"5 [R "UR$5 [R "UR&5 [R "UR(5 [R "UR*5 [,R."[R0R3UR4S55 [R "UR45 [6R9U5 g![6R9U5 f=f)Nzgmon.out)r2r>rNrfrcrWrWrO�removerPrQrRrSrTrUrV�rmdirrKrJrNrMrLrr�r�rDrIrHrYr?s rrY�CGIHTTPServerTestCase.tearDown�s���/3����,�	(��H�H�T�X�X���&�&��'�'�0�0��t�T�B�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*�����	�	�$�/�/�*��H�H�T�'�'�(��H�H�T�\�\�"��H�H�T�,�,�-��H�H�T�^�^�$��H�H�T�^�^�$�
���R�W�W�\�\�$�/�/�:�F�G��H�H�T�_�_�%��!�!�$�'��L�!�!�$�'�s�KK=�=Lc
���0SS_S[_S[_SS_SS_SS_SS_S	S
_S
S
_SS_S
S_SS_SS_SS_SS_SS_SS_SSSSS[SS[SSS.EnUR5H�up#[U[5(a8[	U[
5(a#UR
U[RU5 MR[R"U5nURX4SU<SU<SU<3S9 M� g)Nr"r�z..z/.//..r�z/\z//\z/.//�cgi-bin/file1.py�/cgi-bin/file1.py�az//az/az./az./C:/z/C:/z/a/bz/a/b/z/a/b/.z/a/b/dz/a/b/d/fz/a/b/fz/a/fz//f)z	/a/b/c/..z/a/b/c/../dz/a/b/c/../d/e/../fz/a/b/c/../d/e/../../fz/a/b/c/../d/e/.././././..//fz../a/b/c/../d/e/.././././..//fz/a/b/c/../d/e/../../../fz/a/b/c/../d/e/../../../../fz/a/b/c/../d/e/../../../../../fz/a/b/c/../d/e/../../../../f/..z /a/b/c/../d/e/../../../../f/../.zpath = z	
Got:    z	
Wanted: r�)
�
IndexError�items�
isinstance�type�
issubclass�	Exception�assertRaisesr�_url_collapse_pathr�)r�test_vectorsr��expected�actuals     r�test_url_collapse_path�,CGIHTTPServerTestCase.test_url_collapse_path�s|��
���
��*�
�
�j�
�
��	
�

�$�
�
�6�

�
�D�
�
� 3�
�
 �!4�
�
��
�
�%�
�
�5�
�
�5�
�
�V�
�
�F�
� 
�W�!
�"
�g�#
�$!�#�",�%-�,4�.8�(.�+0�.8�.2�04�9
��<+�0�0�2�N�D��(�D�)�)�j��9�.M�.M��!�!�(�"(�";�";�T�C� �2�2�4�8��� � ��6�"&���&:�!�;�
3rc���URS5nURUR5URS5UR4SUR
-S[R45 g)Nrp�Content-type�Hello Worldrq)rar�r$r�r��linesepr	rr�s  r�test_headers_and_content�.CGIHTTPServerTestCase.test_headers_and_content�sT���l�l�.�/�����
�X�X�Z����~�6��
�
�C�
�d�l�l�
*�K����G�	Irc�z�URS5nURUR[R5 g)Nz)///////////nocgi.py/../cgi-bin/nothere.sh)rar�r�r	r�r�s  r�test_issue19435�%CGIHTTPServerTestCase.test_issue19435�s+���l�l�F�G��������Z�%9�%9�:rc���[RRSSSS.5nSS0nURSSX5nUR	UR5S	UR-5 g)
Nr�rEi@�)r	�eggs�baconr�z!application/x-www-form-urlencodedz/cgi-bin/file2.py�POSTs1, python, 123456)r�r��	urlencoderar�r$r�)r�paramsrfr�s    r�	test_post�CGIHTTPServerTestCase.test_post�s^�����'�'��(�f�=�?��!�$G�H���l�l�.���H���������%9�D�L�L�%H�Irc���[SS5H^nSU-nSU-nS[U50nURSSX45nURUR	5SX"4-UR
-5 M` g)	N��r��Xr�z/cgi-bin/file7.pyr�s%d %d)�rangerrar�r$r�)rrF�sizererfr�s      r�test_large_content_length�/CGIHTTPServerTestCase.test_large_content_length�sk���r�2��A���6�D��$�;�D�'�#�d�)�4�G��,�,�2�F�D�J�C����S�X�X�Z��T�L�)@�4�<�<�)O�P�rc�H�[R"URSS5 [SS5HVnSU-nS[	U50nURSSS	U5nUR
UR5S
UR-5 MX SSS5 g!,(df   g=f)N�timeoutg����MbP?��Ar�r�rpr��xr�)	r
�	swap_attrr2r�rrar�r$r�)rrFr�rfr�s     r�#test_large_content_length_truncated�9CGIHTTPServerTestCase.test_large_content_length_truncated�s���
�
�
�t�3�3�Y��
F��2�r�]���A�v��+�c�$�i�8���l�l�#6���g�N��� � �����^�d�l�l�-J�K�	#�G�
F�
F�s�A'B�
B!c��URS5nUR5 URUR[R
5 g)Nz/cgi-bin/invalid)rar$r�r�r	r�r�s  r�test_invaliduri�%CGIHTTPServerTestCase.test_invaliduris4���l�l�-�.�����
�������Z�%9�%9�:rc��SS[R"S5-0nURSSUS9nURSUR-S[
R4UR5URS	5UR45 g)
Ns
AuthorizationsBasic s
username:passrpr[rr�rqr�)
�base64�	b64encoderar�r�r	rr$r�r�)rrfr�s   r�test_authorization�(CGIHTTPServerTestCase.test_authorizationsz��#�i��#�#�$4�5�'6�7���l�l�.��w�l�G�����
�d�l�l�
*�K����G�
�X�X�Z����~�6��
�
�C�	Erc���URS5nURSUR-S[R4UR5UR
S5UR45 g)Nror�rqr��rar�r�r	rr$r�r�r�s  r�test_no_leading_slash�+CGIHTTPServerTestCase.test_no_leading_slashsT���l�l�-�.�����
�d�l�l�
*�K����G�
�X�X�Z����~�6��
�
�C�	Erc�J�SnU[RS'URS5nURSUR-S[
R4UR5URS5UR45 UR[RSU5 g)NzTest CGI Server�SERVER_SOFTWARErpr�rqr�)
rNrOrar�r�r	rr$r�r�)r�	signaturer�s   r�test_os_environ_is_not_altered�4CGIHTTPServerTestCase.test_os_environ_is_not_altereds���%�	�(1��
�
�$�%��l�l�.�/�����
�d�l�l�
*�K����G�
�X�X�Z����~�6��
�
�C�	E�	
������$5�6�	�Brc���URS5nURSUR-S[R4UR5UR
S5UR45 g)Nz/cgi-bin%2ffile1.pyr�rqr�r�r�s  r�#test_urlquote_decoding_in_cgi_check�9CGIHTTPServerTestCase.test_urlquote_decoding_in_cgi_check$sT���l�l�0�1�����
�d�l�l�
*�K����G�
�X�X�Z����~�6��
�
�C�	Erc���URS5nURSUR-S[R4UR5UR
S5UR45 g)Nz/cgi-bin/child-dir/file3.pyr�rqr�r�r�s  r�test_nested_cgi_path_issue21323�5CGIHTTPServerTestCase.test_nested_cgi_path_issue21323*sT���l�l�8�9�����
�d�l�l�
*�K����G�
�X�X�Z����~�6��
�
�C�	Erc���URS5nURSUR-S[R4UR5UR
S5UR45 g)Nz/cgi-bin/file4.py?a=b?c=dsa=b?c=drqr�r�r�s  r�&test_query_with_multiple_question_mark�<CGIHTTPServerTestCase.test_query_with_multiple_question_mark0sT���l�l�6�7�����
�$�,�,�
&��Z�]�]�C�
�X�X�Z����~�6��
�
�C�	Erc���URS5nURSUR-S[R4UR5UR
S5UR45 g)Nz0/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//sk=aa%2F%2Fbb&//q//p//=//a//b//rqr�r�r�s  r�"test_query_with_continuous_slashes�8CGIHTTPServerTestCase.test_query_with_continuous_slashes6sW���l�l�M�N�����
.����
=�
�*�-�-�
)�
�X�X�Z����~�6��
�
�C�	Erc��[RRS5 URS5nUR	SUR
-S[R4UR5URS5UR45 [RRS5 g![RRS5 f=f)Nz/sub/dir/cgi-binz/sub/dir/cgi-bin/file5.pyr�rqr�)r�cgi_directories�appendrar�r�r	rr$r�r�rkr�s  r� test_cgi_path_in_sub_directories�6CGIHTTPServerTestCase.test_cgi_path_in_sub_directories=s���	M�!�1�1�8�8�9K�L��,�,�:�;�C�����$�,�,�.��Z�]�]�K�����S�]�]�>�:�C�J�J�G�
I�
"�1�1�8�8�9K�L��!�1�1�8�8�9K�L�s�B
B,�,!C
c��SnSU44U4SS4nUH�up4[U5nURU5 URSSUS9nUR[R
RUR5 SU3RS	5nURXER55 SSS5 M� g!,(df   M�=f)
Nz?text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8�Accept)rr")))r�rq)�ACCEPTz
text/plainztext/html,text/plainz/cgi-bin/file6.pyr[rzHTTP_ACCEPT=r�)rr�rar�r]r	rr�r�rr$)r�browser_accept�testsrfr{r�s      r�test_accept�!CGIHTTPServerTestCase.test_acceptGs���U�	���(�
*�N�;��
'�	
��"'��G�!�'�*�G����g�&��l�l�#6��w�l�O��� � ����!3�!3�S�Z�Z�@�)�(��4�;�;�G�D���
�
�h���
�3�	'�&�"'�&�&�s�A9B6�6
C	)rWrKrJrNrcrPrQrRrSrTrUrVrOrIrYrLrMN)r&r'r(r)rrr2rNr�r�rTrYr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r*rrrr:r:4s���	2�-�/D�	2��j�j����(�G�R"�h (�D(;�TI�;�J�Q�L�;�
E�E�C�E�E�E�E�M�4rr:c�8^�\rSrSrSU4SjjrSrSrSrU=r$)�SocketlessRequestHandleriZc�>�[R"5n[5URl[
TU]USSUS9 SUlSUlg)N��	directoryFrn)	r
�Mockr�makefile�return_valuer'r1�
get_calledr�)rr�rar-s   �rr1�!SocketlessRequestHandler.__init__[sC����)�)�+��(/�	����%�
����$��	��B���� *��rc���SUlUR[R5 UR	SS5 UR5 URRS5 g)NTrprq� <html><body>Data</body></html>
)r�rur	rrwrxr�r�r?s rr#�SocketlessRequestHandler.do_GETcsJ��������:�=�=�)������5������
�
���>�?rc��grr)rrrs   rr�$SocketlessRequestHandler.log_messagejs��r)r�r�r)	r&r'r(r)r1r#rr*r>r?s@rr�r�Zs���+�@�
�
rr�c��\rSrSrSrSrg)�!RejectingSocketlessRequestHandlerimc�B�UR[R5 g)NF)r�r	�EXPECTATION_FAILEDr?s r�handle_expect_100�3RejectingSocketlessRequestHandler.handle_expect_100ns�����
�5�5�6�rrN)r&r'r(r)r�r*rrrr�r�ms��rr�c�6�\rSrSrSrSrSr\S5rSr	g)�AuditableBytesIOisc��/Ulgr��datasr?s rr1�AuditableBytesIO.__init__us	����
rc�:�URRU5 gr)r�r�)rrs  rr��AuditableBytesIO.writexs���
�
���$�rc�8�SRUR5$)Nr)rDr�r?s r�getData�AuditableBytesIO.getData{s���x�x��
�
�#�#rc�,�[UR5$r)rr�r?s r�	numWrites�AuditableBytesIO.numWrites~s���4�:�:��rr�N)
r&r'r(r)r1r�r��propertyr�r*rrrr�r�ss%��� �$����rr�c���\rSrSrSr\R"S5rSrSr	Sr
SrSrS	r
S
rSrSrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrg)�BaseHTTPRequestHandlerTestCasei�zdTest the functionality of the BaseHTTPServer.

Test the support for the Expect 100-continue header.
sHTTP/1.[0-9]+ 200 OKc�"�[5Ulgr)r��handlerr?s rrT�$BaseHTTPRequestHandlerTestCase.setUp�s��/�1��rc���[U5n[5nX RlX0RlURR	5 URS5 UR
5$�Nr)rr��rfiler��handle_one_request�seek�	readlines)rr�input�outputs    r�send_typical_request�3BaseHTTPRequestHandlerTestCase.send_typical_request�sQ���� �����"����#�������'�'�)����A�����!�!rc�N�URURR5 gr)r�r�r�r?s r�verify_get_called�0BaseHTTPRequestHandlerTestCase.verify_get_called�s��������/�/�0rc�b^�SH(mUR[U4SjU55S5 M* g)N)sServer: sDate: sContent-Type: c3�D># �UHoRT5v� M g7fr)�
startswith)�.0�h�	fieldNames  �r�	<genexpr>�IBaseHTTPRequestHandlerTestCase.verify_expected_headers.<locals>.<genexpr>�s���� J�'�Q���i�!8�!8�'�s� r�)r��sum)rrfrs  @r�verify_expected_headers�6BaseHTTPRequestHandlerTestCase.verify_expected_headers�s)���B�I����S� J�'� J�J�A�N�Crc�\�URRU5nURU5 gr)�HTTPResponseMatch�searchr�)rr��matchs   r�verify_http_server_response�:BaseHTTPRequestHandlerTestCase.verify_http_server_response�s&���&�&�-�-�h�7�����U�#rc���SURl[Rn[R
R
[S[55nU"URS5 U"URS5 U"URSS5 U"URSS5 U"URS5 SSS5 WR5nURS	U5 URS
U5 UR5nURSUS5 URSUS
5 URSUS5 URSUS5 URSUS5 g!,(df   N�=f)N)�	127.0.0.1i9�stderrz/fooz/barz	/spam %s.rquŸ beansz"GET /foo\b"ar HTTP/1.0"��rz/\x1bbar\x00\x1br�z/spam a.�u/spam \x1b\x7f\x9f beans.�z"GET /foo\\b"ar\x07 HTTP/1.0"�)
r��client_addressrrr
�patch�objectr�rrL�assertNotIn�
splitlinesr)rr�fake_stderrrrTs     r�test_unprintable_not_logged�:BaseHTTPRequestHandlerTestCase.test_unprintable_not_logged�s+��':����#�,�8�8��
�Z�Z�
�
�s�H�h�j�
9�[�����f�-�����&8�9�����k�3�7�����k�3J�K�����&E�F�:��%�%�'�������(������(��!�!�#���
�
�f�e�A�h�'��
�
�)�5��8�4��
�
�j�%��(�+��
�
�7��q��B��
�
�6��a��A�:�
9�s
�A"E'�'
E5c�X�URS5nURUS5 URUSS5 UR5 UR	USS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS	5 URUR
RR5S
5 g)N�GET / HTTP/1.1

rr����r��GET / HTTP/1.1r[r�rnr�
r�rrr�r�r��requestline�commandr��request_version�assertSequenceEqualrfrs�r�results  r�
test_http_1_1�,BaseHTTPRequestHandlerTestCase.test_http_1_1������*�*�+D�E���(�(����3��$�$�V�A�b�\�2���� �������%J�K�������1�1�3C�D�������-�-�u�5�������*�*�C�0�������5�5�z�B�� � ����!5�!5�!;�!;�!=�r�Brc�X�URS5nURUS5 URUSS5 UR5 UR	USS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS	5 URUR
RR5S
5 g)NsGET / HTTP/1.0

rr�r"r��GET / HTTP/1.0r[r��HTTP/1.0rr$r)s  r�
test_http_1_0�,BaseHTTPRequestHandlerTestCase.test_http_1_0�r-rc��URS5nUR[U5S5 URUSS5 UR5 g)NsGET / HTTP/0.9

r�rr�)r�r�rr�r)s  r�
test_http_0_9�,BaseHTTPRequestHandlerTestCase.test_http_0_9�sH���*�*�+D�E������V��a�(�������$I�J���� rc���URS5nURUSS5 URUSURS55 UR	UR
R5 g)Ns)GET /spaced out HTTP/1.1
Host: dummy

rs
HTTP/1.1 400 r��
)r�r�r�index�assertFalser�r�r)s  r�test_extra_space�/BaseHTTPRequestHandlerTestCase.test_extra_space�sd���*�*�
�
��
	
���f�Q�i�)9�:��$�$�V�A�f�l�l�7�.C�%D�E�������0�0�1rc�\�URS5nURUS5 URUSS5 UR5 UR	USS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS5 UR	UR
RS	5 S
nURUR
RR5U5 g)Ns(GET / HTTP/1.0
Expect: 100-continue

rr�r"r�r/r[r�r0�)�Expectz100-continuer$�rr*rfs   r�test_with_continue_1_0�5BaseHTTPRequestHandlerTestCase.test_with_continue_1_0�s����*�*�+\�]���(�(����3��$�$�V�A�b�\�2���� �������%J�K�������1�1�3C�D�������-�-�u�5�������*�*�C�0�������5�5�z�B�/��� � ����!5�!5�!;�!;�!=�w�Grc��URS5nURUSS5 URUSS5 URUSS5 URUSS5 UR5 URUSS	5 URURR
S
5 URURRS5 URURRS5 URURRS
5 SnURURRR5U5 g)N�(GET / HTTP/1.1
Expect: 100-continue

rsHTTP/1.1 100 Continue
r�r7rsHTTP/1.1 200 OK
r"r�r#r[r�rnr=)r�r�rr�r�r%r&r�r'r(rfrsr?s   r�test_with_continue_1_1�5BaseHTTPRequestHandlerTestCase.test_with_continue_1_1�s���*�*�+\�]��������$@�A�������G�,�������$:�;��$�$�V�A�b�\�2���� �������%J�K�������1�1�3C�D�������-�-�u�5�������*�*�C�0�������5�5�z�B�/��� � ����!5�!5�!;�!;�!=�w�Grc���[S5n[5n[5nXlX#lSUlSUlSUlURS5 URURS5 g)Nr!rnr"�r)rr�r�r�r�r'r%r&r�r�r��rr�r�r�s    r�#test_header_buffering_of_send_error�BBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_error�sb���1�2��!�#��*�,���
��
�",��� ���������3������)�)�1�-rc��[S5n[5n[5nXlX#lSUlUR
S5 URURS5 UR5 URURS5 g)Nr!rnrGrr�)
rr�r�r�r�r'�send_response_onlyr�r�rxrHs    r�+test_header_buffering_of_send_response_only�JBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_response_only	su���1�2��!�#��*�,���
��
�",����"�"�3�'�����)�)�1�-���������)�)�1�-rc��[S5n[5n[5nXlX#lSUlUR
SS5 UR
SS5 URURS5 UR5 URUR5S5 URURS5 g)	Nr!rn�Foo�foo�barrsFoo: foo
bar: bar

r�)rr�r�r�r�r'rwr�r�rxr�rHs    r�$test_header_buffering_of_send_header�CBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_headers����1�2��!�#��*�,���
��
�",������E�5�)����E�5�)�����)�)�1�-�����������)�+J�K�����)�)�1�-rc��Sn[S5n[5nX RlX0RlSURlURR5 UR
U"U5S5 U"U5RS5nURUSS5 URUSS5 URUS	S
5 g)Nc��UR5nURS5 UR5nURU5 U$r�)�tellr�r$)r��posrs   r�_readAndReseek�[BaseHTTPRequestHandlerTestCase.test_header_unbuffered_when_continue.<locals>._readAndReseek)s3���&�&�(�C�
�F�F�1�I��6�6�8�D�
�F�F�3�K��KrrCrnrr7rsHTTP/1.1 100 Continuer�rsHTTP/1.1 200 OK)	rr�r�r�r'r��assertNotEqualrSr�)rrYr�r�r*s     r�$test_header_unbuffered_when_continue�CBaseHTTPRequestHandlerTestCase.test_header_unbuffered_when_continue's���	��I�J�����"����#����'1����$����'�'�)����N�6�2�C�8���'�-�-�g�6��������$<�=�������C�(�������$6�7rc�N�URn[5UlURS5nURUSS5 UR	USS5 URURR5 UR[SUSS55S5 Xlg)NrCrs!HTTP/1.1 417 Expectation Failed
r�r"c3�*# �UH	oS:Hv� M g7f)sConnection: close
Nr)r�rs  rr�MBaseHTTPRequestHandlerTestCase.test_with_continue_rejected.<locals>.<genexpr>Fs���Q�L�q�":�:�L�s�)r�r�r�r�rr9r�r)r�
usual_handlerr*s   r�test_with_continue_rejected�:BaseHTTPRequestHandlerTestCase.test_with_continue_rejected=s������
�8�:����*�*�+\�]��������$J�K��$�$�V�A�b�\�2�	
������0�0�1�����Q�F�1�R�L�Q�Q�ST�U�$�rc��URSSS--5nURUSS5 URURR5 URURR[5 g)NsGET r��rsHTTP/1.1 414 URI Too Long
)r�r�r9r�r��assertIsInstancer%rr)s  r�test_request_length�2BaseHTTPRequestHandlerTestCase.test_request_lengthIsd���*�*�7�T�E�\�+A�B��������$D�E�������0�0�1����d�l�l�6�6��<rc��URSSS--S-5nURUSS5 URURR5 URURR
S5 g)NsGET / HTTP/1.1
X-Foo: bar�rrfs

rsHTTP/1.1 431 Line too long
r#�r�r�r9r�r�r%r)s  r�test_header_length�1BaseHTTPRequestHandlerTestCase.test_header_lengthQsl���*�*�+�d�U�l�:�[�H�J��������$E�F�������0�0�1�������1�1�3C�Drc���URS5nURUSS5 URURR5 URURR
S5 g)Ns�GET / HTTP/1.1
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar
X-Foo: bar

rsHTTP/1.1 431 Too many headers
r#rlr)s  r�test_too_many_headers�4BaseHTTPRequestHandlerTestCase.test_too_many_headersYs^���*�*�E�G��������$H�I�������0�0�1�������1�1�3C�Drc��URS5nSRU5nSnUR[R"USS9RS5U5 g)Ns*<script>alert("hello")</script> / HTTP/1.1rz<script>alert("hello")</script>Fr�r�)r�rDrr�r�r�)rr*�texts   r�test_html_escape_on_error�8BaseHTTPRequestHandlerTestCase.test_html_escape_on_error`sL���*�*�9�;�����&�!��0���
�
�d�k�k�$�e�4�;�;�G�D�f�Mrc�8^^�UU4SjnUTRl[S5mTRR5 TR	[
[T5 [S5mTRR5 TR	[
[T5 g)Nc�:>�[T5TRlgr)�nextr��close_connection)�close_valuesrs��rr��PBaseHTTPRequestHandlerTestCase.test_close_connection.<locals>.handle_one_requestjs���,0��,>�D�L�L�)r)T)FFT)r�r��iter�handlerx�
StopIterationrx)rr�rzs` @r�test_close_connection�4BaseHTTPRequestHandlerTestCase.test_close_connectiongsl���	?�*<����'��G�}�����������-��|�<��0�1�����������-��|�<rc	�(�[R"5n[R"U5u	p#pEpgp�n
SURRUUURRUX%Xg4-nURURR
US9U5 g)Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)ry)�time�gmtimer��weekdayname�	monthnamer��date_time_string)r�now�year�month�day�hh�mm�ss�wd�y�zr{s            r�test_date_time_string�4BaseHTTPRequestHandlerTestCase.test_date_time_stringvs����i�i�k��15���S�1A�.��S�b�b�Q�8��L�L�$�$�R�(���L�L�"�"�5�)��b�	<
�
��	
������6�6��6�E�x�Pr)r�N) r&r'r(r)r%�re�compilerrTr�r�rrrr+r1r4r:r@rDrIrMrSr\rcrhrmrprtrr�r*rrrr�r��s����
�
�
�#:�;��2�"�1�O�$�B�*
C�
C�!�2�H�
H�.�.�.� 8�,
%�=�E�E�N�
=�
Qrr�c�0�\rSrSrSrSrSrSrSrSr	g)	� SimpleHTTPRequestHandlerTestCasei�zTest url parsing c��[RR[R"5S5Ul[RRSS5Ul[RRSS5Ul[5Ul[SS9Ul	[[R"S5S9Ulg)Nr�rQrRr�)
rNr�rDrb�translated_1�translated_2�translated_3r��	handler_1�	handler_2�pathlib�PurePath�	handler_3r?s rrT�&SimpleHTTPRequestHandlerTestCase.setUp�sz���G�G�L�L�����j�A����G�G�L�L��
�;����G�G�L�L��
�;���1�3���1�E�B���1�G�<L�<L�U�<S�T��rc���URRS5nURXR5 URRS5nURXR
5 URRS5nURXR5 URRS5nURXR5 URRS5nURXR
5 URRS5nURXR5 URRS5nURXR5 URRS5nURXR
5 URRS5nURXR5 g)Nz	/filenamez/filename?foo=barz/filename?a=b&spam=eggs#zot�r��translate_pathr�r�r�r�r�r��rr�s  r�test_query_arguments�5SimpleHTTPRequestHandlerTestCase.test_query_arguments�sp���~�~�,�,�[�9������0�0�1��~�~�,�,�[�9������0�0�1��~�~�,�,�[�9������0�0�1��~�~�,�,�-@�A������0�0�1��~�~�,�,�-@�A������0�0�1��~�~�,�,�-@�A������0�0�1��~�~�,�,�-J�K������0�0�1��~�~�,�,�-J�K������0�0�1��~�~�,�,�-J�K������0�0�1rc��URRS5nURXR5 URRS5nURXR
5 URRS5nURXR5 URRS5nURXR5 URRS5nURXR
5 URRS5nURXR5 g)Nz
//filenamez//filename?foo=barr�r�s  r�test_start_with_double_slash�=SimpleHTTPRequestHandlerTestCase.test_start_with_double_slash�s����~�~�,�,�\�:������0�0�1��~�~�,�,�\�:������0�0�1��~�~�,�,�\�:������0�0�1��~�~�,�,�-A�B������0�0�1��~�~�,�,�-A�B������0�0�1��~�~�,�,�-A�B������0�0�1rc��	�[R"[RS[5 UR
R
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 UR
R
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 UR
R
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 UR
R
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 URR
S5nUR[R[R5nURXR5 SSS5 g!,(df   g=f)Nr�zc:c:c:foo/filenamez\c:../filenamezc:\c:..\foo/filenamezc:c:foo\c:c:bar/filename)r
r�rrN�ntpathr�r�rt�sepr�r�r�r�r�r�r�s  r�test_windows_colon�3SimpleHTTPRequestHandlerTestCase.test_windows_colon�s1��
�
�
�v�y�y�&�&�
9��>�>�0�0�1E�F�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1E�F�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1E�F�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1B�C�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1B�C�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1B�C�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1I�J�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1I�J�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1I�J�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1L�M�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1L�M�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5��>�>�0�0�1L�M�D��<�<��
�
�B�F�F�3�D����T�#4�#4�5�O:�
9�
9�s�R1S%�%
S3)r�r�r�r�r�r�N)
r&r'r(r)r%rTr�r�r�r*rrrr�r��s���U�2�,
2�(6rr�c��\rSrSrSrSrg)�MiscTestCasei�c��/n1Skn[[5HTnURS5(dX2;aM [[U5n[USS5S:XdMCUR	U5 MV UR[RU5 g)N>r]r\�
nobody_uid�_r'zhttp.server)r\rr�getattrr��assertCountEqual�__all__)rr{�denylistr��
module_objects     r�test_all�MiscTestCase.test_all�sp����7����K�D����s�#�#�t�'7��#�F�D�1�M��}�l�D�9�]�J�����%� �	
���f�n�n�h�7rrN)r&r'r(r)r�r*rrrr�r��s��	8rr�c���\rSrSrSr\R"S5S5r\R"S5S5rSr	Sr
\R"S5S5r\R"S5S	5rS
r
g)�ScriptTestCasei�c��[R"[R"[R"[R"[R"SS9S9S9S9S9$)Nc��g)N)r"rrrrr�<lambda>�2ScriptTestCase.mock_server_class.<locals>.<lambda>�s��r)r8)r7)r�)r[)r
�	MagicMockr?s r�mock_server_class� ScriptTestCase.mock_server_class�sF���~�~�����.�.�!%���#�~�~�(7� �"���

�
	
rzbuiltins.printc���UR5n[R"USS9 URUR[
R[
R45 g�N��ServerClass�bind�r�rr]r�address_familyr7�AF_INET6r(�rr��mock_servers   r�test_server_test_unspec�&ScriptTestCase.test_server_test_unspec�sC���,�,�.������$�7��
�
��&�&�
�_�_�f�n�n�-�	
rc���UR5n[R"USS9 URUR[
R[
R45 g)Nr6r�r�r�s   r�test_server_test_localhost�)ScriptTestCase.test_server_test_localhostsC���,�,�.������+�>��
�
��&�&�
�_�_�f�n�n�-�	
r)z::z'2001:0db8:85a3:0000:0000:8a2e:0370:7334z::1)z0.0.0.0z8.8.8.8rc���URHQnUR5n[R"X2S9 UR	UR
[R5 MS gr�)�
ipv6_addrsr�rr]r�r�r7r��rr�r�r�s    r�test_server_test_ipv6�$ScriptTestCase.test_server_test_ipv6sD���O�O�D��0�0�2�K��K�K�K�;����[�7�7����I�$rc���URHQnUR5n[R"X2S9 UR	UR
[R5 MS gr�)�
ipv4_addrsr�rr]r�r�r7r(r�s    r�test_server_test_ipv4�$ScriptTestCase.test_server_test_ipv4sD���O�O�D��0�0�2�K��K�K�K�;����[�7�7����H�$rrN)r&r'r(r)r�r
rr�r�r�r�r�r�r*rrrr�r��s���
�
�Z�Z� �!�
�"�
�
�Z�Z� �!�
�"�
��J��J�
�Z�Z� �!�J�"�J�
�Z�Z� �!�I�"�Irr�c�t�[R"[R[R"55 gr)r5�addModuleCleanuprNrfrbrrr�setUpModuler�&s�����b�h�h��	�	��4r�__main__)Jr%�collectionsr�http.serverrrrrr]rr	r9rNr7r�r�r�r�r�r��
email.messagerv�email.utilsr��http.client�urllib.parser�rdr�rpr/r5r
�iorrr]r
�test.supportrrrr�test.support.testcaser�requires_working_socketrr0r,�TestCaserHrirrArXr]r^r_r`rar7�hasattrrr:r�r�r�r�r�r�r�r�r&�mainrrr�<module>r�s����
$�5�5�#��	�
�
�	�
�
��
����������� �����2����t�,����y�'�'��*-�8�$�$�o�-�*a(�\�a(�H#'�<�#'�L B�L� B�Fd7�|�d7�N
�	�
�	�"
�	�
�	�$
�	�
�����Y�'�=�B�J�J�L�A�,=�A�C���`4�L�`4��C�`4�F	
�7�
�&�(@��
�
� }Q�X�%6�%6��}Q�@W6�x�'8�'8�W6�t
8�8�$�$�
8�9I�X�&�&�9I�x5��z���M�M�O�r

Youez - 2016 - github.com/yon3zu
LinuXploit