Your IP : 216.73.216.85


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_httpservers.cpython-310.opt-2.pyc

o

0�i���@sJ	ddlmZddlmZmZmZmZddlmZm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlm Z m!Z!ddlZddl"m#Z#ddl$m%Z%dd	l$m&Z&Gd
d�d�Z'Gdd
�d
ej(�Z)Gdd�dej*�Z+Gdd�de+�Z,Gdd�de+�Z-Gdd�de+�Z.dZ/dZ0dZ1dZ2dZ3e�4e5e
d�o�e
�6�dkd�Gdd�de+��Z7Gdd �d e�Z8Gd!d"�d"e8�Z9Gd#d$�d$�Z:Gd%d&�d&ej*�Z;Gd'd(�d(ej*�Z<Gd)d*�d*ej*�Z=Gd+d,�d,ej*�Z>d-d.�Z?e@d/k�r#e�A�dSdS)0�)�OrderedDict)�BaseHTTPRequestHandler�
HTTPServer�SimpleHTTPRequestHandler�CGIHTTPRequestHandler)�server�
HTTPStatusN)�mock)�BytesIO�StringIO)�support)�	os_helper)�threading_helperc@seZdZdd�Zddd�ZdS)�NoLogRequestHandlercG�dS�N�)�self�argsrr�</opt/alt/python310/lib64/python3.10/test/test_httpservers.py�log_message&szNoLogRequestHandler.log_messageNcC�dS�N�r)r�nrrr�read*�zNoLogRequestHandler.readr)�__name__�
__module__�__qualname__rrrrrrr%src@s$eZdZdd�Zdd�Zdd�ZdS)�TestServerThreadcCstj�|�||_||_dSr)�	threading�Thread�__init__�request_handler�test_object)rr%r$rrrr#/s
zTestServerThread.__init__cCsbtd|j�|_|jj��\|j_|j_|jj�	�d|_z|j�
d�W|j��dS|j��w)N)�	localhostrg�������?)rr$r�socket�getsocknamer%�HOST�PORT�server_started�setZ
serve_foreverZserver_close�rrrr�run4szTestServerThread.runcCs|j��|��dSr)rZshutdown�joinr-rrr�stop>s
zTestServerThread.stopN)rrrr#r.r0rrrrr .s
r c@s,eZdZdd�Zdd�Zddifdd�ZdS)	�BaseTestCasecCsDt��|_t��t_t��|_	t
||j�|_|j�
�|j	��dSr)rZthreading_setup�_threadsr
ZEnvironmentVarGuard�os�environr!ZEventr+r r$�thread�start�waitr-rrr�setUpDs



zBaseTestCase.setUpcCs*|j��d|_tj��tj|j�dSr)r5r0r3r4�__exit__rZthreading_cleanupr2r-rrr�tearDownLs

zBaseTestCase.tearDown�GETNcCs0tj�|j|j�|_|j�||||�|j��Sr)�http�client�HTTPConnectionr)r*Z
connection�request�getresponse)rZuri�method�body�headersrrrr?Rs
zBaseTestCase.request)rrrr8r:r?rrrrr1Csr1c@s�eZdZGdd�dee�Zdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+S),�BaseHTTPServerTestCasec@s\eZdZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)z&BaseHTTPServerTestCase.request_handler�HTTP/1.1cC�0|�tj�|�dd�|�dd�|��dS)N�Content-Type�	text/html�
Connection�close��
send_responser�
NO_CONTENT�send_header�end_headersr-rrr�do_TEST]�z.BaseHTTPServerTestCase.request_handler.do_TESTcCrF)NrGrHrI�
keep-aliverKr-rrr�do_KEEPcrQz.BaseHTTPServerTestCase.request_handler.do_KEEPcCs|�d�dS)N����
send_errorr-rrr�do_KEYERRORisz2BaseHTTPServerTestCase.request_handler.do_KEYERRORcCs|�tj�dSr�rVr�	NOT_FOUNDr-rrr�do_NOTFOUNDl�z2BaseHTTPServerTestCase.request_handler.do_NOTFOUNDcCs|�ddd�dS)NrTz
Short MessagezThis is a long 
 explanationrUr-rrr�do_EXPLAINERRORos�z6BaseHTTPServerTestCase.request_handler.do_EXPLAINERRORcCs.|�d�|�dd�|�dd�|��dS)NrTrGrHrIrJ)rLrNrOr-rrr�	do_CUSTOMss
z0BaseHTTPServerTestCase.request_handler.do_CUSTOMcCsJ|�d�|�dd�|�dd�|��|jd�d�}|j�|�dS)NrT�	X-Special�Dängerous MindrIrJzx-special-incoming�utf-8)rLrNrOrC�encode�wfile�write)rrBrrr�do_LATINONEHEADERys
z8BaseHTTPServerTestCase.request_handler.do_LATINONEHEADERcC�|�t|jdd���dS�N��rV�int�pathr-rrr�
do_SEND_ERROR��z4BaseHTTPServerTestCase.request_handler.do_SEND_ERRORcCrerfrhr-rrr�do_HEAD�rlz.BaseHTTPServerTestCase.request_handler.do_HEADN)rrr�protocol_version�default_request_versionrPrSrWrZr\r]rdrkrmrrrrr$Ysr$cCs,t�|�tj�|j|j�|_|j��dSr)	r1r8r<r=r>r)r*�con�connectr-rrrr8�s
zBaseHTTPServerTestCase.setUpcC�,|j�dd�|j��}|�|jtj�dS)Nr;�/)rpr?r@�assertEqual�statusr�NOT_IMPLEMENTED�r�resrrr�test_command��
z#BaseHTTPServerTestCase.test_commandcC�>d|j_|j�dd�|j��|j��}|�|jtj�dS)Nz	HTTP/1.1
ZXYZBOGUSrs�	rp�
_http_vsn_str�
putrequest�
endheadersr@rtrurrvrwrrr�test_request_line_trimming��


z1BaseHTTPServerTestCase.test_request_line_trimmingcCr{)NZFUBARr;rs�	rpr}r~rr@rtrurZBAD_REQUESTrwrrr�test_version_bogus�r�z)BaseHTTPServerTestCase.test_version_boguscCr{)Nz
HTTP/9.9.9r;rsr�rwrrr�test_version_digits�r�z*BaseHTTPServerTestCase.test_version_digitscCr{)Nrr;rsr|rwrrr�test_version_none_get�r�z,BaseHTTPServerTestCase.test_version_none_getcCr{)Nr�CUSTOMrsr�rwrrr�test_version_none�s


z(BaseHTTPServerTestCase.test_version_nonecCsFd|j_d|j_|j�dd�|j��|j��}|�|jtj	�dS)N�czHTTP/9.9r;rs)
rpZ	_http_vsnr}r~rr@rtrurZHTTP_VERSION_NOT_SUPPORTEDrwrrr�test_version_invalid�s

z+BaseHTTPServerTestCase.test_version_invalidcCs>d|j_|j�dd�|j��|j��}|�|jtj�dSrr�rwrrr�test_send_blank�r�z&BaseHTTPServerTestCase.test_send_blankcCsD|j�dd�|j�dd�|j��|j��}|�|jtj�dS)Nr;rsrIrJ)	rpr~�	putheaderrr@rtrurrvrwrrr�test_header_close�s


z(BaseHTTPServerTestCase.test_header_closecCsLd|j_|j�dd�|j�dd�|j��|j��}|�|jtj	�dS)NrEr;rsrIrR)
rpr}r~r�rr@rtrurrvrwrrr�test_header_keep_alive�s

z-BaseHTTPServerTestCase.test_header_keep_alivecCrr)N�TESTrs)rpr?r@rtrurrMrwrrr�test_handler�rzz#BaseHTTPServerTestCase.test_handlercCsJ|j�dd�|j��}|�|�d�d�|j�dd�|�|jj�dS)NZKEEPrsrIrRr�)rpr?r@rt�	getheaderZ
addCleanuprJrwrrr�test_return_header_keep_alive�s

z4BaseHTTPServerTestCase.test_return_header_keep_alivecC�*|j�dd�|j��}|�|jd�dS)NZKEYERRORrsrT�rpr?r@rtrurwrrr�test_internal_key_error��
z.BaseHTTPServerTestCase.test_internal_key_errorcCr�)Nr�rsrTr�rwrrr�test_return_custom_status�r�z0BaseHTTPServerTestCase.test_return_custom_statuscCs>|j�dd�|j��}|�|jd�|�t|�d���dS)NZEXPLAINERRORrsrT�Content-Length)rpr?r@rtru�
assertTruerir�rwrrr�test_return_explain_error�s
z0BaseHTTPServerTestCase.test_return_explain_errorcCsL|jjddddid�|j��}|�|�d�d�|�|��d�d��dS)	NZLATINONEHEADERrszX-Special-IncominguÄrger mit Unicode�rCr^r_r`)rpr?r@rtr�rrarwrrr�test_latin1_header�s
�
z)BaseHTTPServerTestCase.test_latin1_headercCsN|j�dd�|j��}|�|jtj�|��}|�t|�	d��t
|��dS)NZNOTFOUNDrsr�)rpr?r@rtrurrYrrir��len)rrx�datarrr�test_error_content_length�s

z0BaseHTTPServerTestCase.test_error_content_lengthcCs�tjtjf}tjtjtjtjtjfD]A}|j�dd�|��|j�	�}|�
||j�|�
d|�d��|�
d|�d��||vrI|�
d|�d��|�
�}|�
d|�qdS)NZ
SEND_ERROR�/{}r�rG�Transfer-Encoding�)r�NOT_MODIFIED�
RESET_CONTENTrMZ
PROCESSING�SWITCHING_PROTOCOLSrpr?�formatr@rtrur�r�rZallow_transfer_encoding_codes�coderxr�rrr�test_send_errors"��
�z&BaseHTTPServerTestCase.test_send_errorcCs�tjtjf}tjtjtjtjtjfD]\}|j�dd�|��|j�	�}|�
||j�|tjkrE|�t
|�d��dk�|�d|�d��n|�
d|�d��|�
d|�d��||vrd|�
d|�d��|��}|�
d|�qdS)	N�HEADr�r�rrHrGr�r�)rr�r��OKrMr�rpr?r�r@rtrur�rir��assertInrr�rrr�test_head_via_send_errors(��

�z/BaseHTTPServerTestCase.test_head_via_send_errorN)rrrrrr$r8ryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrDXs,.	rDc@s,eZdZGdd�de�Zdd�Zdd�ZdS)�RequestHandlerLoggingTestCasec@s$eZdZdZdZdd�Zdd�ZdS)z-RequestHandlerLoggingTestCase.request_handlerrEcCs|�tj�|��dSr)rLrr�rOr-rrr�do_GET,sz4RequestHandlerLoggingTestCase.request_handler.do_GETcCs|�tjd�dS)NzFile not foundrXr-rrr�do_ERROR0�z6RequestHandlerLoggingTestCase.request_handler.do_ERRORN)rrrrnror�r�rrrrr$(s
r$cCsvtj�|j|j�|_|j��t���}|j�	dd�|j�
�Wd�n1s*wY|�|���
d��dS)Nr;rsz"GET / HTTP/1.1" 200 -
)r<r=r>r)r*rprqr�captured_stderrr?r@r��getvalue�endswith)r�errrrr�test_get3s

��z&RequestHandlerLoggingTestCase.test_getcCs�tj�|j|j�|_|j��t���}|j�	dd�|j�
�Wd�n1s*wY|���d�}|�
|d�d��|�
|d�d��dS)NZERRORrs�
rz code 404, message File not foundrgz"ERROR / HTTP/1.1" 404 -)r<r=r>r)r*rprqrr�r?r@r��splitr�r�)rr��linesrrr�test_err>s

�z&RequestHandlerLoggingTestCase.test_errN)rrrrr$r�r�rrrrr�'sr�cs�eZdZGdd�dee�Z�fdd�Z�fdd�Zd'dd	�Ze	�
ejd
kd�e	�
ejdkd
�e	�
ejd�dd����Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z�ZS)(�SimpleHTTPServerTestCasec@�eZdZdS)z(SimpleHTTPServerTestCase.request_handlerN�rrrrrrrr$L�r$cs�t���t��|_t��}t�|�d|_tj	|d�|_
tj�|j
�|_
d|j
|_tj�|j
d�}t|d��}|�|j�|��Wd�n1sMwYt�|�j}tj�|tjj�}|jdd�|_tjj|��dd	�|_dS)
NsWe are the knights who say Ni!)�dirrs�test�wbr)ZmicrosecondT�Zusegmt) �superr8r3�getcwd�cwd�tempfileZ
gettempdir�chdirr��mkdtemp�tempdirrj�basename�tempdir_name�base_urlr/�openrc�flush�stat�st_mtime�datetimeZ
fromtimestamp�timezoneZutc�replace�last_modif_datetime�email�utilsZ
formatdate�	timestamp�last_modif_header)rZbasetempdirZtempnameZtemp�mtimeZ
last_modif��	__class__rrr8Os*



���zSimpleHTTPServerTestCase.setUpcsTz#t�|j�zt�|j�WnYWt���dSWt���dSt���wr)r3r�r��shutilZrmtreer�r�r:r-r�rrr:ds�z!SimpleHTTPServerTestCase.tearDownNcs���fdd�}d�|�_���}|���|��j|�|��j�|r*|�||�|��jd�|��j�	dd�d�|���d�dd���
�|S)	Ncs	�j�d�_dSr)�fpr��reader�responserr�
close_connos
zDSimpleHTTPServerTestCase.check_status_and_reason.<locals>.close_conn�
rIrJ�r�zConnection should be closed)Z_close_connrr�rtru�assertIsNotNone�reason�version�msg�getrJ)rr�rur�r�rBrr�r�check_status_and_reasonns
z0SimpleHTTPServerTestCase.check_status_and_reason�darwinz2undecodable name cannot always be decoded on macOSZwin32z+undecodable name cannot be decoded on win32z!need os_helper.TESTFN_UNDECODABLEcCst��}t�tj�d}ttj�|j	|�d��}|�
tj�Wd�n1s(wY|�|jd�}tj
dkrKt�|j	�D]
}|dkrJ|}nq@|�|tj�}tjj|dd�}|�d|�|d	�|�|�d
tj|dd��|d	�|�|�|jd|�}|j|tjtjd
�dS)Nz.txtr�rsr�r��
surrogatepass)�errorsz	href="%s"�surrogateescape�>%s<F��quote�r�)�sys�getfilesystemencodingr3�fsdecoder
�TESTFN_UNDECODABLEr�rjr/r�rcr?r��platform�listdirr�rr��urllib�parser�r�ra�html�escape)r�enc�filename�fr��namerBZ
quotednamerrr�test_undecodable_filename�s0�
�

�
�

�z2SimpleHTTPServerTestCase.test_undecodable_filenamecCsd|�|jd���}|�|d|j�d��d��|�|jd���}|�|d|j�d��d��dS)Nz/?x=123zlisting for z/\?x=123�latin1z/?x=%bbz/\?x=\xef\xbf\xbd)r?r�rZassertRegexra�rr�rrr�test_undecodable_parameter�s z3SimpleHTTPServerTestCase.test_undecodable_parameterc	Cs4	t�tj�|jd��d|j�d�}|�d�}|�|�}|�|tj	�|�
d�}|j||dd�d|��}|�|�}|�|tj	�|�
d�}|j|�
d�|d�|j||d	d�d|��}|�|�}|�|tj	�|�|�
d�|�d
|��}|�d�}|�|�}|�|tj	�|�
d�}|j|�
d
�|d�dS)NZexisting_directoryz2/python.org/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../z/existing_directoryrs�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/)r3�mkdirrjr/r�r�r?r�r�MOVED_PERMANENTLYr�rt�assertFalse�
startswithr�)	rZurlZexpected_locationr��locationZ
attack_urlZattack3_urlZattack_scheme_netloc_2slash_urlZexpected_scheme_netloc_locationrrr�3test_get_dir_redirect_location_domain_injection_bug�s4





�





zLSimpleHTTPServerTestCase.test_get_dir_redirect_location_domain_injection_bugc
Cs|�|jd�}|j|tj|jd�|�|jd�}|�|tj�|�|jd�}|�|tj�|�|j�}|�|tj�|�|�	d�d�|�|jd�}|�|tj�|�|jd�}|�|tj�|�|�	d	�|jd
�|�d�}|�|tj�|�d�}|�|tj�t
�t
j�
|jd
d��|�|jd�}|�|tj�d}tt
j�
|jd�d��
}|�|�Wd�n1s�wY|�|jd�}|�|tj|�t
jdk�rt
��dk�r
t
�|jd�z|�|jd�}|�|tj�Wt
�|jd�dSt
�|jd�wdSdS)N�/testr��/test/rsr��0�/?hi=2�?hi=1r�/?hi=1z/ThisDoesNotExistz/ThisDoesNotExist/�spamz
index.htmlz/spam/sDummy index file
r��posixri�)r?r�r�rr�r�rYrrtr�r3�makedirsrjr/r�r�r�rcr��geteuid�chmod)rr�r�r�rrrr��sH�

�"�z!SimpleHTTPServerTestCase.test_getcCsT|j|jddd�}|�|tj�|�|�d�tt|j	���|�|�d�d�dS)Nrr��rAzcontent-lengthzcontent-typezapplication/octet-stream)
r?r�r�rr�rtr��strr�r�rrrr�	test_heads
���z"SimpleHTTPServerTestCase.test_headcCs�	tj��}|j|d<|j|jd|d�}|�|tj�|j	t
jdd�}tj��}tjj
|dd�|d<|j|jd|d�}|�|tj�dS)N�If-Modified-Sincerr�rg)ZhoursTr�)r��message�Messager�r?r�r�rr�r�r��	timedeltar��format_datetime)rrCr�Znew_dtrrr�test_browser_caches



�z+SimpleHTTPServerTestCase.test_browser_cachecCsZ|j}|tjdd�}tj��}tjj|dd�|d<|j|j	d|d�}|�
|tj�dS)Nim)ZdaysTr�rrr�)
r�r�rr�rrr�rr?r�r�rr�)rZdtZold_dtrCr�rrr�test_browser_cache_file_changed"s

�z8SimpleHTTPServerTestCase.test_browser_cache_file_changedcCsBtj��}|j|d<d|d<|j|jd|d�}|�|tj�dS)Nr�*z
If-None-Matchrr�)	r�rrr�r?r�r�rr�)rrCr�rrr�,test_browser_cache_with_If_None_Match_header-s


zESimpleHTTPServerTestCase.test_browser_cache_with_If_None_Match_headercCsX|jddd�}|�|tj�|jddd�}|�|tj�|jddd�}|�|tj�dS)NrsZFOOrZcustomZGETs)r?r�rrvrrrr�test_invalid_requests6sz.SimpleHTTPServerTestCase.test_invalid_requestscCsB	|�|jd�}|j|tj|jd�|jd}|�||j�dS)Nrr�z
Last-modified)	r?r�r�rr�r�rCrtr�)rr�r�rrr�test_last_modified?s

z+SimpleHTTPServerTestCase.test_last_modifiedcCs�|�|jd�}|j|tj|jd�|�|jd�}|�|tj�|�|jd�}|�|tj�|�|j�}|�|tj�|�|jd�}|�|tj�|�|jd�}|�|tj�|�|�	d�|jd�dS)	Nrr�r
rsrrrr)
r?r�r�rr�r�rYrrtr�rrrr�test_path_without_leading_slashHs�z8SimpleHTTPServerTestCase.test_path_without_leading_slashc	Cs�d}tj�|j|�}z	t|d���Wnty!t�d|��wz|�	|j
d�}|�|tj
�}|j��}Wt�|�nt�|�w|�|�dtj|dd�}|�|�|�|�dS)Nz<test&>.txtr�z-Can not create file %s on current file systemrsr�Fr�)r3rjr/r�r�rJ�OSError�unittestZSkipTestr?r�r�rr�rCZget_content_charset�unlinkr�r�r�r�ra)rr��fullpathr�rBr�Z	html_textrrr�test_html_escape_filenameXs"��
z2SimpleHTTPServerTestCase.test_html_escape_filenamer)rrrrrr$r8r:r�r'�skipIfr�r�Z
skipUnlessr
r�r�rrr�rrr r"r#r$r%r*�
__classcell__rrr�rr�Ks4

���1*				r�zD#!%s

print("Content-type: text/html")
print()
print("Hello World")
z�#!%s
import cgi

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

form = cgi.FieldStorage()
print("%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"),
                          form.getfirst("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)}")
rz7This test can't be run reliably as root (issue #13308).c@s�eZdZGdd�dee�Zej�d�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(S))�CGIHTTPServerTestCasec@r�)z%CGIHTTPServerTestCase.request_handlerNr�rrrrr$�r�r$�asciic	Csvt�|�t��|_t��|_tj�	|jd�|_
tj�	|j
d�|_tj�	|jd�|_tj�	|jd�|_
tj�	|j
d�|_t�|j
�t�|j�t�|j�t�|j
�t�|j�d|_d|_d|_d|_d|_d|_d|_d|_d|_t��r�tj�	|jd�|_t�|j���|_ntj |_z|j�!d�Wnt"y�|�#�|�$d�Ynwtj�	|jd�|_t%|jd	dd
��}|�&t'|j�Wd�n1s�wYt�(|jd�tj�	|j
d�|_t%|jd	dd
��}|�&t'|j�Wd�n1s�wYt�(|jd�tj�	|j
d
�|_t%|jd	dd
��}|�&t)|j�Wd�n	1�s0wYt�(|jd�tj�	|jd�|_t%|jd	dd
��}|�&t'|j�Wd�n	1�sawYt�(|jd�tj�	|j
d�|_t%|jd	dd
��}|�&t*|jdf�Wd�n	1�s�wYt�(|jd�tj�	|jd�|_t%|jd	dd
��}|�&t'|j�Wd�n	1�s�wYt�(|jd�tj�	|j
d�|_t%|jd	dd
��}|�&t+|j�Wd�n	1�s�wYt�(|jd�tj�	|j
d�|_t%|jd	dd
��}|�&t,|j�Wd�n	1�s'wYt�(|jd�t�-|j�dS)Nzcgi-binz	child-dir�subr��pythonr`z0Python executable path is not encodable to utf-8znocgi.py�w)�encodingi�zfile1.pyzfile2.pyzfile3.pyzfile4.pyZQUERY_STRINGzfile5.pyzfile6.pyzfile7.py).r1r8r3r�r�r�r��
parent_dirrjr/�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
Zcan_symlinkZ	pythonexerZ
PythonSymlink�	__enter__r��
executablera�UnicodeEncodeErrorr:ZskipTestr�rc�	cgi_file1r�	cgi_file2�	cgi_file4�	cgi_file6�	cgi_file7r�)	rr�Zfile1Zfile2Zfile3Zfile4Zfile5Zfile6Zfile7rrrr8�s�


���������zCGIHTTPServerTestCase.setUpc	Csz�t�|j�|jr|j�ddd�|jrt�|j�|jr$t�|j�|jr-t�|j�|j	r6t�|j	�|j
r?t�|j
�|jrHt�|j�|jrQt�|j�|j
rZt�|j
�t�|j�t�|j�t�|j�t�|j�t�|j�t�|j�Wt�|�dSt�|�wr)r3r�r�rAr9r9�remover:r;r<r=r>r?r@�rmdirr5r4r8r7r6r3r1r:r-rrrr:s6zCGIHTTPServerTestCase.tearDownc
Cs�idd�dt�dt�dd�dd�dd�dd�d	d
�d
d
�dd�d
d�dd�dd�dd�dd�dd�dd�dddddtddtddd��}|��D])\}}t|t�r^t|t�r^|�|tj|�qGt�|�}|j	||d|||fd�qGdS)Nrrz..z/.//..rsz/\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 = %r
Got:    %r
Wanted: %rr)
�
IndexError�items�
isinstance�type�
issubclass�	Exception�assertRaisesrZ_url_collapse_pathrt)rZtest_vectorsrj�expectedZactualrrr�test_url_collapse_path&sv��������	�
���
�������
���z,CGIHTTPServerTestCase.test_url_collapse_pathcCs:|�d�}|�|��|�d�|jfd|jdtjf�dS)NrM�Content-type�Hello WorldrH)r?rtrr�ru�lineseprr�rwrrr�test_headers_and_contentPs

�z.CGIHTTPServerTestCase.test_headers_and_contentcCs|�d�}|�|jtj�dS)Nz)///////////nocgi.py/../cgi-bin/nothere.sh)r?rtrurrYrwrrr�test_issue19435Vs
z%CGIHTTPServerTestCase.test_issue19435cCsFtj�dddd��}ddi}|�dd||�}|�|��d	|j�dS)
Nrgr0i@�)rZeggsZbaconrXz!application/x-www-form-urlencodedz/cgi-bin/file2.py�POSTs1, python, 123456)r�r�Z	urlencoder?rtrrZ)r�paramsrCrxrrr�	test_postZs
�zCGIHTTPServerTestCase.test_postcCs^tdd�D]'}d|>}d|}dt|�i}|�dd||�}|�|��d||f|j�qdS)	N��rg�Xr�z/cgi-bin/file7.pyr]s%d %d)�rangerr?rtrrZ)rr1�sizerBrCrxrrr�test_large_content_lengthbs �z/CGIHTTPServerTestCase.test_large_content_lengthcCs�t�|jdd��.tdd�D]}d|>}dt|�i}|�ddd	|�}|�|��d
|j�qWd�dS1s9wYdS)NZtimeoutg����MbP?��Argr�rMr]�xrY)	r�	swap_attrr$rcrr?rtrrZ)rr1rdrCrxrrr�#test_large_content_length_truncatedjs�"�z9CGIHTTPServerTestCase.test_large_content_length_truncatedcCs&|�d�}|��|�|jtj�dS)Nz/cgi-bin/invalid)r?rrtrurrYrwrrr�test_invalidurirs
z%CGIHTTPServerTestCase.test_invaliduricCsRddt�d�i}|jdd|d�}|�d|jdtjf|��|�d	�|j	f�dS)
Ns
AuthorizationsBasic s
username:passrMr;r�rYrHrX)
�base64Z	b64encoder?rtrZrr�rr�ru)rrCrxrrr�test_authorizationws��z(CGIHTTPServerTestCase.test_authorizationcC�:|�d�}|�d|jdtjf|��|�d�|jf�dS)NrLrYrHrX�r?rtrZrr�rr�rurwrrr�test_no_leading_slashs

�z+CGIHTTPServerTestCase.test_no_leading_slashcCsZd}|tjd<|�d�}|�d|jdtjf|��|�d�|j	f�|�tjd|�dS)NzTest CGI ServerZSERVER_SOFTWARErMrYrHrX)
r3r4r?rtrZrr�rr�ru)rZ	signaturerxrrr�test_os_environ_is_not_altered�s

�z4CGIHTTPServerTestCase.test_os_environ_is_not_alteredcCrn)Nz/cgi-bin%2ffile1.pyrYrHrXrorwrrr�#test_urlquote_decoding_in_cgi_check��

�z9CGIHTTPServerTestCase.test_urlquote_decoding_in_cgi_checkcCrn)Nz/cgi-bin/child-dir/file3.pyrYrHrXrorwrrr�test_nested_cgi_path_issue21323�rsz5CGIHTTPServerTestCase.test_nested_cgi_path_issue21323cCrn)Nz/cgi-bin/file4.py?a=b?c=dsa=b?c=drHrXrorwrrr�&test_query_with_multiple_question_mark�rsz<CGIHTTPServerTestCase.test_query_with_multiple_question_markcCrn)Nz0/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//sk=aa%2F%2Fbb&//q//p//=//a//b//rHrXrorwrrr�"test_query_with_continuous_slashes�s
��z8CGIHTTPServerTestCase.test_query_with_continuous_slashesc	Csdz*tj�d�|�d�}|�d|jdtjf|��|�	d�|j
f�Wtj�d�dStj�d�w)Nz/sub/dir/cgi-binz/sub/dir/cgi-bin/file5.pyrYrHrX)rZcgi_directories�appendr?rtrZrr�rr�rurJrwrrr� test_cgi_path_in_sub_directories�s
�z6CGIHTTPServerTestCase.test_cgi_path_in_sub_directoriesc	Cs�d}d|ff|fddf}|D]>\}}t|�}|�|��)|jdd|d�}|�tjj|j�d|���d	�}|�	||�
��Wd�n1sGwYqdS)
Nz?text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8�Accept)rr)))ryrH)ZACCEPTz
text/plainztext/html,text/plainz/cgi-bin/file6.pyr;r�zHTTP_ACCEPT=r.)rZsubTestr?rtr<rr�rurar�r)rZbrowser_acceptZtestsrCrVrxrrr�test_accept�s �����z!CGIHTTPServerTestCase.test_acceptN)rrrrrr$r3rZrar8r:rWr[r\r_rerjrkrmrprqrrrtrurvrxrzrrrrr-�s*S*	
r-cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�SocketlessRequestHandlerNcs6t��}t�|j_t�j|dd|d�d|_d|_dS)N��	directoryFrE)	r	ZMockr
Zmakefile�return_valuer�r#�
get_calledrn)rr}r?r�rrr#�s


z!SocketlessRequestHandler.__init__cCs6d|_|�tj�|�dd�|��|j�d�dS)NTrGrH� <html><body>Data</body></html>
)rrLrr�rNrOrbrcr-rrrr��s
zSocketlessRequestHandler.do_GETcGrrr)rr�rrrrr�rz$SocketlessRequestHandler.log_messager)rrrr#r�rr,rrr�rr{�sr{c@�eZdZdd�ZdS)�!RejectingSocketlessRequestHandlercCs|�tj�dS)NF)rVrZEXPECTATION_FAILEDr-rrr�handle_expect_100�sz3RejectingSocketlessRequestHandler.handle_expect_100N)rrrr�rrrrr���r�c@s0eZdZdd�Zdd�Zdd�Zedd��Zd	S)
�AuditableBytesIOcCs
g|_dSr)�datasr-rrrr#�s
zAuditableBytesIO.__init__cCs|j�|�dSr)r�rw)rr�rrrrc�r[zAuditableBytesIO.writecCsd�|j�S)Nr�)r/r�r-rrr�getData��zAuditableBytesIO.getDatacCs
t|j�Sr)r�r�r-rrr�	numWrites�s
zAuditableBytesIO.numWritesN)rrrr#rcr��propertyr�rrrrr��sr�c@s�eZdZ	e�d�Zdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0S)1�BaseHTTPRequestHandlerTestCasesHTTP/1.[0-9]+ 200 OKcCst�|_dSr)r{�handlerr-rrrr8�r�z$BaseHTTPRequestHandlerTestCase.setUpcCs:t|�}t�}||j_||j_|j��|�d�|��S�Nr)r
r��rfilerb�handle_one_request�seek�	readlines)rr�input�outputrrr�send_typical_request�s

z3BaseHTTPRequestHandlerTestCase.send_typical_requestcCs|�|jj�dSr)r�r�rr-rrr�verify_get_calledr�z0BaseHTTPRequestHandlerTestCase.verify_get_calledcs,dD]�|�t�fdd�|D��d�qdS)N)sServer: sDate: sContent-Type: c3s�|]}|���VqdSr)r	)�.0�h�Z	fieldNamerr�	<genexpr>s�zIBaseHTTPRequestHandlerTestCase.verify_expected_headers.<locals>.<genexpr>rg)rt�sum)rrCrr�r�verify_expected_headerss �z6BaseHTTPRequestHandlerTestCase.verify_expected_headerscCs|j�|�}|�|�dSr)�HTTPResponseMatch�searchr�)rr��matchrrr�verify_http_server_response	sz:BaseHTTPRequestHandlerTestCase.verify_http_server_responsecCs�d|j_tj}tj�tdt���(}||jd�||jd�||jdd�||jdd�||jd�Wd�n1s;wY|�	�}|�
d	|�|�
d
|�|��}|�d|d�|�d|d
�|�d|d�|�d|d�|�d|d�dS)N)�	127.0.0.1i9�stderrz/fooz/barz	/spam %s.rNuŸ beansz"GET /foo\b"ar HTTP/1.0"��rz/\x1bbar\x00\x1brgz/spam a.�u/spam \x1b\x7f\x9f beans.�z"GET /foo\\b"ar\x07 HTTP/1.0"�)
r�Zclient_addressrrr	�patch�objectr�rr�ZassertNotIn�
splitlinesr�)rrZfake_stderrr�r�rrr�test_unprintable_not_logged
s$�z:BaseHTTPRequestHandlerTestCase.test_unprintable_not_loggedcC�|�d�}|�|d�|�|dd��|��|�|dd�|�|jjd�|�|jjd�|�|jjd�|�|jj	d	�|�
|jj��d
�dS)N�GET / HTTP/1.1

rrg���r��GET / HTTP/1.1r;rsrEr�
r�r�r�r�rtr��requestline�commandrj�request_version�assertSequenceEqualrCrP�r�resultrrr�
test_http_1_1"�
z,BaseHTTPRequestHandlerTestCase.test_http_1_1cCr�)NsGET / HTTP/1.0

rrgr�r��GET / HTTP/1.0r;rs�HTTP/1.0rr�r�rrr�
test_http_1_0.r�z,BaseHTTPRequestHandlerTestCase.test_http_1_0cCs6|�d�}|�t|�d�|�|dd�|��dS)NsGET / HTTP/0.9

rgrr�)r�rtr�r�r�rrr�
test_http_0_9:s
z,BaseHTTPRequestHandlerTestCase.test_http_0_9cCsH|�d�}|�|d�d��|�|d|�d���|�|jj�dS)Ns)GET /spaced out HTTP/1.1
Host: dummy

rs
HTTP/1.1 400 rg�
)r�r�r	r��indexrr�rr�rrr�test_extra_space@s�z/BaseHTTPRequestHandlerTestCase.test_extra_spacecCs�|�d�}|�|d�|�|dd��|��|�|dd�|�|jjd�|�|jjd�|�|jjd�|�|jj	d	�d
}|�
|jj��|�dS)Ns(GET / HTTP/1.0
Expect: 100-continue

rrgr�r�r�r;rsr��)ZExpectz100-continuer��rr�rCrrr�test_with_continue_1_0Js
z5BaseHTTPRequestHandlerTestCase.test_with_continue_1_0cCs�|�d�}|�|dd�|�|dd�|�|dd�|�|dd��|��|�|dd	�|�|jjd
�|�|jjd�|�|jjd�|�|jjd
�d}|�	|jj
��|�dS)N�(GET / HTTP/1.1
Expect: 100-continue

rsHTTP/1.1 100 Continue
rgr�r�sHTTP/1.1 200 OK
r�r�r�r;rsrEr�)r�rtr�r�r�r�r�rjr�r�rCrPr�rrr�test_with_continue_1_1Ws
z5BaseHTTPRequestHandlerTestCase.test_with_continue_1_1cCsNtd�}t�}t�}||_||_d|_d|_d|_|�d�|�	|j
d�dS)Nr�rEr�r�)r
r�r{r�rbr�r�r�rVrtr��rr�r�r�rrr�#test_header_buffering_of_send_errorfs
zBBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_errorcCsXtd�}t�}t�}||_||_d|_|�d�|�|jd�|�	�|�|jd�dS)Nr�rEr�rrg)
r
r�r{r�rbr�Zsend_response_onlyrtr�rOr�rrr�+test_header_buffering_of_send_response_onlyts
zJBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_response_onlycCsvtd�}t�}t�}||_||_d|_|�dd�|�dd�|�|jd�|�	�|�|�
�d�|�|jd�dS)	Nr�rEZFoo�foo�barrsFoo: foo
bar: bar

rg)r
r�r{r�rbr�rNrtr�rOr�r�rrr�$test_header_buffering_of_send_header�szCBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_headercCs�dd�}td�}t�}||j_||j_d|j_|j��|�||�d�||��d�}|�|dd�|�|d	d�|�|d
d�dS)NcSs(|��}|�d�|��}|�|�|Sr�)�tellr�r)r��posr�rrr�_readAndReseek�s


z[BaseHTTPRequestHandlerTestCase.test_header_unbuffered_when_continue.<locals>._readAndReseekr�rEr�r�rsHTTP/1.1 100 Continuergr�sHTTP/1.1 200 OK)	r
r�r�rbr�r�ZassertNotEqualr�rt)rr�r�r�r�rrr�$test_header_unbuffered_when_continue�s
zCBaseHTTPRequestHandlerTestCase.test_header_unbuffered_when_continuecCst|j}t�|_|�d�}|�|dd�|�|dd��|�|jj�|�tdd�|dd�D��d�||_dS)Nr�rs!HTTP/1.1 417 Expectation Failed
rgr�css�|]}|dkVqdS)sConnection: close
Nr)r��rrrrr��s�zMBaseHTTPRequestHandlerTestCase.test_with_continue_rejected.<locals>.<genexpr>)r�r�r�rtr�rrr�)rZ
usual_handlerr�rrr�test_with_continue_rejected�s
"
z:BaseHTTPRequestHandlerTestCase.test_with_continue_rejectedcCsD|�ddd�}|�|dd�|�|jj�|�|jjt�dS)NsGET rh�rs#HTTP/1.1 414 Request-URI Too Long
)r�rtrr�rZassertIsInstancer�rr�rrr�test_request_length�sz2BaseHTTPRequestHandlerTestCase.test_request_lengthcCsH|�dddd�}|�|dd�|�|jj�|�|jjd�dS)NsGET / HTTP/1.1
X-Foo: bar�rr�s

rsHTTP/1.1 431 Line too long
r��r�rtrr�rr�r�rrr�test_header_length�s�z1BaseHTTPRequestHandlerTestCase.test_header_lengthcCs<|�d�}|�|dd�|�|jj�|�|jjd�dS)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�r�r�rrr�test_too_many_headers�s�z4BaseHTTPRequestHandlerTestCase.test_too_many_headerscCs8|�d�}d�|�}d}|�tj|dd��d�|�dS)Ns*<script>alert("hello")</script> / HTTP/1.1r�z<script>alert("hello")</script>Fr�r.)r�r/r�r�r�ra)rr��textrrr�test_html_escape_on_error�s�
 z8BaseHTTPRequestHandlerTestCase.test_html_escape_on_errorcsZ��fdd�}|�j_td���j����tt��td���j����tt��dS)Ncst���j_dSr)�nextr�Zclose_connectionr�Zclose_valuesrrrr��r[zPBaseHTTPRequestHandlerTestCase.test_close_connection.<locals>.handle_one_request)T)FFT)r�r��iterZhandlerU�
StopIterationr�)rr�rr�r�test_close_connection�s

z4BaseHTTPRequestHandlerTestCase.test_close_connectionc	Csdt��}t�|�\	}}}}}}}}	}
d|jj|||jj|||||f}|�|jj|d�|�dS)Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)r�)�time�gmtimer�ZweekdaynameZ	monthnamertZdate_time_string)rZnowZyearZmonthZdayZhhZmmZssZwd�y�zrVrrr�test_date_time_string�s

�z4BaseHTTPRequestHandlerTestCase.test_date_time_stringN)rrr�re�compiler�r8r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s4
	

r�c@s.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
� SimpleHTTPRequestHandlerTestCasecCs^tj�t��d�|_tj�dd�|_tj�dd�|_t�|_tdd�|_	tt
�d�d�|_dS)Nr�r�r�r|)
r3rjr/r��translated_1�translated_2�translated_3r{�	handler_1�	handler_2�pathlibZPurePath�	handler_3r-rrrr8�sz&SimpleHTTPRequestHandlerTestCase.setUpcCs�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�dS)Nz	/filenamez/filename?foo=barz/filename?a=b&spam=eggs#zot�r��translate_pathrtr�r�r�r�r��rrjrrr�test_query_arguments�s$z5SimpleHTTPRequestHandlerTestCase.test_query_argumentscCs�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�|j�d�}|�||j�dS)Nz
//filenamez//filename?foo=barr�r�rrr�test_start_with_double_slashsz=SimpleHTTPRequestHandlerTestCase.test_start_with_double_slashcCs2t�tjdt���|j�d�}|�tjtj�}|�	||j
�|j�d�}|�tjtj�}|�	||j�|j
�d�}|�tjtj�}|�	||j�|j�d�}|�tjtj�}|�	||j
�|j�d�}|�tjtj�}|�	||j�|j
�d�}|�tjtj�}|�	||j�|j�d�}|�tjtj�}|�	||j
�|j�d�}|�tjtj�}|�	||j�|j
�d�}|�tjtj�}|�	||j�|j�d�}|�tjtj�}|�	||j
�|j�d�}|�tjtj�}|�	||j�|j
�d�}|�tjtj�}|�	||j�Wd�dS1�swYdS)Nrjzc:c:c:foo/filenamez\c:../filenamezc:\c:..\foo/filenamezc:c:foo\c:c:bar/filename)rrirr3�ntpathr�r�r��seprtr�r�r�r�r�r�rrr�test_windows_colonsL$�z3SimpleHTTPRequestHandlerTestCase.test_windows_colonN)rrrr8r�r�r�rrrrr��sr�c@r�)�MiscTestCasecCsdg}hd�}tt�D]}|�d�s||vrq
tt|�}t|dd�dkr(|�|�q
|�tj|�dS)N>Z
nobody_uidrCr��_rzhttp.server)r�rr	�getattrrwZassertCountEqual�__all__)rrVZdenylistr�Z
module_objectrrr�test_allIs

�zMiscTestCase.test_allN)rrrr�rrrrr�Hr�r�c@sdeZdZdd�Ze�d�dd��Ze�d�dd��ZdZd	Z	e�d�d
d��Z
e�d�dd
��ZdS)�ScriptTestCasecCs0tjtjtjtjtjdd�d�d�d�d�d�S)NcSr)N)rrrrrrr�<lambda>]sz2ScriptTestCase.mock_server_class.<locals>.<lambda>)r()r')r~)rB)r	Z	MagicMockr-rrr�mock_server_classWs�����z ScriptTestCase.mock_server_classzbuiltins.printcCs0|��}tj|dd�|�|jtjtjf�dS�N�ZServerClass�bind�r�rr�r��address_familyr'�AF_INET6�AF_INET�rr��mock_serverrrr�test_server_test_unspecd�
�z&ScriptTestCase.test_server_test_unspeccCs0|��}tj|dd�|�|jtjtjf�dS)Nr&r�rrrrr�test_server_test_localhostmrz)ScriptTestCase.test_server_test_localhost)z::z'2001:0db8:85a3:0000:0000:8a2e:0370:7334z::1)z0.0.0.0z8.8.8.8r�cC�6|jD]}|��}tj||d�|�|jtj�qdSr�)�
ipv6_addrsr�rr�rtrr'r�rr�r�rrrr�test_server_test_ipv6��

�z$ScriptTestCase.test_server_test_ipv6cCr	r�)�
ipv4_addrsr�rr�rtrr'rrrrr�test_server_test_ipv4�r
z$ScriptTestCase.test_server_test_ipv4N)rrrr�r	r�rrr
rrrrrrrr�Us


r�cCst�tjt���dSr)r'ZaddModuleCleanupr3r�r�rrrr�setUpModule�sr�__main__)B�collectionsrZhttp.serverrrrrr<rrr3r'r�r�rlr�r�r�Z
email.messager�Zemail.utilsr�Zhttp.clientZurllib.parser�r�r�r�r!r'r	�ior
rr�rZtest.supportr
rrr"r ZTestCaser1rDr�r�rErFrGrHrIr+�hasattrrr-r{r�r�r�r�r�r�rr�mainrrrr�<module>sx	P$%
�Z
<
�