HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_httpservers.cpython-310.opt-1.pyc
o

�it��@sHdZddlmZddlmZmZmZmZddlm	Z	m
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddl m!Z!m"Z"ddlZddl#m$Z$dd	l%m&Z&dd
l%m'Z'Gdd�d�Z(Gd
d�dej)�Z*Gdd�dej+�Z,Gdd�de,�Z-Gdd�de,�Z.Gdd�de,�Z/dZ0dZ1dZ2dZ3e�4e5ed�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)0z�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)�	os_helper)�threading_helperc@seZdZdd�Zddd�ZdS)�NoLogRequestHandlercG�dS�N�)�self�argsrr�2/usr/local/lib/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)r�shutdown�joinr-rrr�stop>s
zTestServerThread.stopN)rrrr#r.r1rrrrr .s
r c@s,eZdZdd�Zdd�Zddifdd�ZdS)	�BaseTestCasecCsDt��|_t��t_t��|_	t
||j�|_|j�
�|j	��dSr)rZthreading_setup�_threadsr
ZEnvironmentVarGuard�os�environr!�Eventr+r r$�thread�start�waitr-rrr�setUpDs



zBaseTestCase.setUpcCs*|j��d|_tj��tj|j�dSr)r7r1r4r5�__exit__rZthreading_cleanupr3r-rrr�tearDownLs

zBaseTestCase.tearDown�GETNcCs0tj�|j|j�|_|j�||||�|j��Sr)�http�client�HTTPConnectionr)r*�
connection�request�getresponse)rZuri�method�body�headersrrrrBRs
zBaseTestCase.request)rrrr:r<rBrrrrr2Csr2c@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_TESTcCrI)NrJrKrL�
keep-aliverNr-rrr�do_KEEPcrTz.BaseHTTPServerTestCase.request_handler.do_KEEPcCs|�d�dS)N����
send_errorr-rrr�do_KEYERRORisz2BaseHTTPServerTestCase.request_handler.do_KEYERRORcCs|�tj�dSr�rYr�	NOT_FOUNDr-rrr�do_NOTFOUNDl�z2BaseHTTPServerTestCase.request_handler.do_NOTFOUNDcCs|�ddd�dS)NrWz
Short MessagezThis is a long 
 explanationrXr-rrr�do_EXPLAINERRORos�z6BaseHTTPServerTestCase.request_handler.do_EXPLAINERRORcCs.|�d�|�dd�|�dd�|��dS)NrWrJrKrLrM)rOrQrRr-rrr�	do_CUSTOMss
z0BaseHTTPServerTestCase.request_handler.do_CUSTOMcCsJ|�d�|�dd�|�dd�|��|jd�d�}|j�|�dS)NrW�	X-Special�Dängerous MindrLrMzx-special-incoming�utf-8)rOrQrRrF�encode�wfile�write)rrErrr�do_LATINONEHEADERys
z8BaseHTTPServerTestCase.request_handler.do_LATINONEHEADERcC�|�t|jdd���dS�N��rY�int�pathr-rrr�
do_SEND_ERROR��z4BaseHTTPServerTestCase.request_handler.do_SEND_ERRORcCrhrirkr-rrr�do_HEAD�roz.BaseHTTPServerTestCase.request_handler.do_HEADN)rrr�protocol_version�default_request_versionrSrVrZr]r_r`rgrnrprrrrr$Ysr$cCs,t�|�tj�|j|j�|_|j��dSr)	r2r:r>r?r@r)r*�con�connectr-rrrr:�s
zBaseHTTPServerTestCase.setUpcC�,|j�dd�|j��}|�|jtj�dS)Nr=�/)rsrBrC�assertEqual�statusr�NOT_IMPLEMENTED�r�resrrr�test_command��
z#BaseHTTPServerTestCase.test_commandcC�>d|j_|j�dd�|j��|j��}|�|jtj�dS)Nz	HTTP/1.1
ZXYZBOGUSrv�	rs�
_http_vsn_str�
putrequest�
endheadersrCrwrxrryrzrrr�test_request_line_trimming��


z1BaseHTTPServerTestCase.test_request_line_trimmingcCr~)NZFUBARr=rv�	rsr�r�r�rCrwrxrZBAD_REQUESTrzrrr�test_version_bogus�r�z)BaseHTTPServerTestCase.test_version_boguscCr~)Nz
HTTP/9.9.9r=rvr�rzrrr�test_version_digits�r�z*BaseHTTPServerTestCase.test_version_digitscCr~)Nrr=rvrrzrrr�test_version_none_get�r�z,BaseHTTPServerTestCase.test_version_none_getcCr~)Nr�CUSTOMrvr�rzrrr�test_version_none�s


z(BaseHTTPServerTestCase.test_version_nonecCsFd|j_d|j_|j�dd�|j��|j��}|�|jtj	�dS)N�czHTTP/9.9r=rv)
rsZ	_http_vsnr�r�r�rCrwrxrZHTTP_VERSION_NOT_SUPPORTEDrzrrr�test_version_invalid�s

z+BaseHTTPServerTestCase.test_version_invalidcCs>d|j_|j�dd�|j��|j��}|�|jtj�dSrr�rzrrr�test_send_blank�r�z&BaseHTTPServerTestCase.test_send_blankcCsD|j�dd�|j�dd�|j��|j��}|�|jtj�dS)Nr=rvrLrM)	rsr��	putheaderr�rCrwrxrryrzrrr�test_header_close�s


z(BaseHTTPServerTestCase.test_header_closecCsLd|j_|j�dd�|j�dd�|j��|j��}|�|jtj	�dS)NrHr=rvrLrU)
rsr�r�r�r�rCrwrxrryrzrrr�test_header_keep_alive�s

z-BaseHTTPServerTestCase.test_header_keep_alivecCru)N�TESTrv)rsrBrCrwrxrrPrzrrr�test_handler�r}z#BaseHTTPServerTestCase.test_handlercCsJ|j�dd�|j��}|�|�d�d�|j�dd�|�|jj�dS)NZKEEPrvrLrUr�)rsrBrCrw�	getheaderZ
addCleanuprMrzrrr�test_return_header_keep_alive�s

z4BaseHTTPServerTestCase.test_return_header_keep_alivecC�*|j�dd�|j��}|�|jd�dS)NZKEYERRORrvrW�rsrBrCrwrxrzrrr�test_internal_key_error��
z.BaseHTTPServerTestCase.test_internal_key_errorcCr�)Nr�rvrWr�rzrrr�test_return_custom_status�r�z0BaseHTTPServerTestCase.test_return_custom_statuscCs>|j�dd�|j��}|�|jd�|�t|�d���dS)NZEXPLAINERRORrvrW�Content-Length)rsrBrCrwrx�
assertTruerlr�rzrrr�test_return_explain_error�s
z0BaseHTTPServerTestCase.test_return_explain_errorcCsL|jjddddid�|j��}|�|�d�d�|�|��d�d��dS)	NZLATINONEHEADERrvzX-Special-IncominguÄrger mit Unicode�rFrarbrc)rsrBrCrwr�rrdrzrrr�test_latin1_header�s
�
z)BaseHTTPServerTestCase.test_latin1_headercCsN|j�dd�|j��}|�|jtj�|��}|�t|�	d��t
|��dS)NZNOTFOUNDrvr�)rsrBrCrwrxrr\rrlr��len)rr{�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�rJ�Transfer-Encoding�)r�NOT_MODIFIED�
RESET_CONTENTrPZ
PROCESSING�SWITCHING_PROTOCOLSrsrB�formatrCrwrxr�r�rZallow_transfer_encoding_codes�coder{r�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�rrKrJr�r�)rr�r��OKrPr�rsrBr�rCrwrxr�rlr��assertInrr�rrr�test_head_via_send_errors(��

�z/BaseHTTPServerTestCase.test_head_via_send_errorN)rrrrrr$r:r|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrGXs,.	rGc@s,eZdZGdd�de�Zdd�Zdd�ZdS)�RequestHandlerLoggingTestCasec@s$eZdZdZdZdd�Zdd�ZdS)z-RequestHandlerLoggingTestCase.request_handlerrHcCs|�tj�|��dSr)rOrr�rRr-rrr�do_GET,sz4RequestHandlerLoggingTestCase.request_handler.do_GETcCs|�tjd�dS)NzFile not foundr[r-rrr�do_ERROR0�z6RequestHandlerLoggingTestCase.request_handler.do_ERRORN)rrrrqrrr�r�rrrrr$(s
r$cCsvtj�|j|j�|_|j��t���}|j�	dd�|j�
�Wd�n1s*wY|�|���
d��dS)Nr=rvz"GET / HTTP/1.1" 200 -
)r>r?r@r)r*rsrtr�captured_stderrrBrCr��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)N�ERRORrv�
rz code 404, message File not foundrjz"ERROR / HTTP/1.1" 404 -)r>r?r@r)r*rsrtrr�rBrCr��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!)�dirrv�test�wbr)ZmicrosecondT�Zusegmt) �superr:r4�getcwd�cwd�tempfile�
gettempdir�chdirr��mkdtemp�tempdirrm�basename�tempdir_name�base_urlr0�openrf�flush�stat�st_mtime�datetimeZ
fromtimestamp�timezoneZutc�replace�last_modif_datetime�email�utilsZ
formatdate�	timestamp�last_modif_header)rZbasetempdirZtempnameZtemp�mtimeZ
last_modif��	__class__rrr:Os*



���zSimpleHTTPServerTestCase.setUpcsTz#t�|j�zt�|j�WnYWt���dSWt���dSt���wr)r4r�r��shutil�rmtreer�r�r<r-r�rrr<ds�z!SimpleHTTPServerTestCase.tearDownNcs���fdd�}d�|�_���}|���|��j|�|��j�|r*|�||�|��jd�|��j�	dd�d�|���d�dd���
�|S)	Ncs�j�d�_dS)zWDon't close reader yet so we can check if there was leftover
            buffered inputN)�fpr��reader�responserr�
close_connos
zDSimpleHTTPServerTestCase.check_status_and_reason.<locals>.close_conn�
rLrM�r�zConnection should be closed)Z_close_connrr�rwrx�assertIsNotNone�reason�version�msg�getrM)rr�rxr�r�rErr�r�check_status_and_reasonns
z0SimpleHTTPServerTestCase.check_status_and_reason�darwinz2undecodable name cannot always be decoded on macOS�win32z+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�rvr�r��
surrogatepass)�errorsz	href="%s"�surrogateescape�>%s<F��quote�r�)�sys�getfilesystemencodingr4�fsdecoder
�TESTFN_UNDECODABLEr�rmr0r�rfrBr��platform�listdirr�rr��urllib�parser�r�rd�html�escape)r�enc�filename�fr��namerEZ
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)rBr�rZassertRegexrd�rr�rrr�test_undecodable_parameter�s z3SimpleHTTPServerTestCase.test_undecodable_parameterc	Cs2t�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)aIEnsure //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.
        Zexisting_directoryz2/python.org/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../z/existing_directoryrv�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)r4�mkdirrmr0r�r�rBr�r�MOVED_PERMANENTLYr�rw�assertFalse�
startswithr�)	r�urlZexpected_locationr��locationZ
attack_urlZattack3_urlZattack_scheme_netloc_2slash_urlZexpected_scheme_netloc_locationrrr�3test_get_dir_redirect_location_domain_injection_bug�s2	





�





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/rvr��0�/?hi=2�?hi=1r
�/?hi=1z/ThisDoesNotExistz/ThisDoesNotExist/�spamz
index.htmlz/spam/sDummy index file
r��posixri�)rBr�r�rr�r�r\rrwr�r4�makedirsrmr0r�r�r�rfr�geteuid�chmod)rr�r�rrrrr��sH�

�"�z!SimpleHTTPServerTestCase.test_getcCsT|j|jddd�}|�|tj�|�|�d�tt|j	���|�|�d�d�dS)Nrr��rDzcontent-lengthzcontent-typezapplication/octet-stream)
rBr�r�rr�rwr��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)	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-Sincerr�rj)ZhoursTr�N)r��message�Messager�rBr�r�rr�r�r��	timedeltar��format_datetime)rrFr�Znew_dtrrr�test_browser_caches



�z+SimpleHTTPServerTestCase.test_browser_cachecCsZ|j}|tjdd�}tj��}tjj|dd�|d<|j|j	d|d�}|�
|tj�dS)Nim)ZdaysTr�r"rr�)
r�r�r%r�r#r$r�r&rBr�r�rr�)rZdtZold_dtrFr�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-Matchrr�)	r�r#r$r�rBr�r�rr�)rrFr�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)NrvZFOOrZcustomZGETs)rBr�rryrrrr�test_invalid_requests6sz.SimpleHTTPServerTestCase.test_invalid_requestscCs@|�|jd�}|j|tj|jd�|jd}|�||j�dS)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)	rBr�r�rr�r�rFrwr�)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)	Nrr�rrvrrr
r)
rBr�r�rr�r�r\rrwr�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 systemrvr�Fr�)r4rmr0r�r�rM�OSError�unittestZSkipTestrBr�r�rr�rFZget_content_charset�unlinkr�rrr�rd)rr�fullpathr�rErZ	html_textrrr�test_html_escape_filenameXs"��
z2SimpleHTTPServerTestCase.test_html_escape_filenamer)rrrrrr$r:r<r�r/�skipIfr�r�Z
skipUnlessr
r�rr	rr�r!r'r(r*r+r,r-r2�
__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>")
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$S)%�CGIHTTPServerTestCasec@r�)z%CGIHTTPServerTestCase.request_handlerNr�rrrrr$�r�r$�asciicCst�|�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|_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�s*wYt�&|jd�tj�	|jd�|_t#|jd	dd
��}|�$t%|j�Wd�n	1�s[wYt�&|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#|j)d	dd
��}|�$t*|j�Wd�n	1�s�wYt�&|j)d�t�+|j�dS)Nzcgi-binz	child-dir�subr��pythonrcz0Python executable path is not encodable to utf-8znocgi.py�w)�encodingi�zfile1.pyzfile2.pyzfile3.pyzfile4.pyZQUERY_STRINGzfile5.pyzfile6.py),r2r:r4r�r�r�r��
parent_dirrmr0�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�_pythonexe_symlinkr
Zcan_symlinkZ	pythonexerZ
PythonSymlink�	__enter__r��
executablerd�UnicodeEncodeErrorr<ZskipTestr�rf�	cgi_file1r�	cgi_file2�	cgi_file4�
file6_path�	cgi_file6r�)rr�Zfile1Zfile2Zfile3Zfile4Zfile5Zfile6rrrr:�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�t�
|j�t�
|j�t�
|j�t�
|j�t�
|j�t�
|j�Wt�|�dSt�|�wr)r4r�r�rGr;rA�removerBrCrDrErFrN�rmdirr=r<r@r?r>r;r2r<r-rrrr<�s2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)Nrrz..z/.//..rvz/\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_pathrw)rZtest_vectorsrm�expected�actualrrr�test_url_collapse_pathsv��������	�
���
�������
���z,CGIHTTPServerTestCase.test_url_collapse_pathcCs:|�d�}|�|��|�d�|jfd|jdtjf�dS)NrS�Content-type�Hello WorldrK)rBrwrr�rx�lineseprr�rzrrr�test_headers_and_content9s

�z.CGIHTTPServerTestCase.test_headers_and_contentcCs|�d�}|�|jtj�dS)Nz)///////////nocgi.py/../cgi-bin/nothere.sh)rBrwrxrr\rzrrr�test_issue19435?s
z%CGIHTTPServerTestCase.test_issue19435cCsFtj�dddd��}ddi}|�dd||�}|�|��d	|j�dS)
Nrjr8i@�)rZeggsZbaconr_z!application/x-www-form-urlencodedz/cgi-bin/file2.pyZPOSTs1, python, 123456)r�r��	urlencoderBrwrra)r�paramsrFr{rrr�	test_postCs
�zCGIHTTPServerTestCase.test_postcCs&|�d�}|��|�|jtj�dS)Nz/cgi-bin/invalid)rBrrwrxrr\rzrrr�test_invaliduriKs
z%CGIHTTPServerTestCase.test_invaliduricCsRddt�d�i}|jdd|d�}|�d|jdtjf|��|�d	�|j	f�dS)
Ns
AuthorizationsBasic s
username:passrSr=r�r`rKr_)
�base64Z	b64encoderBrwrarr�rr�rx)rrFr{rrr�test_authorizationPs��z(CGIHTTPServerTestCase.test_authorizationcC�:|�d�}|�d|jdtjf|��|�d�|jf�dS)NrRr`rKr_�rBrwrarr�rr�rxrzrrr�test_no_leading_slashXs

�z+CGIHTTPServerTestCase.test_no_leading_slashcCsZd}|tjd<|�d�}|�d|jdtjf|��|�d�|j	f�|�tjd|�dS)NzTest CGI ServerZSERVER_SOFTWARErSr`rKr_)
r4r5rBrwrarr�rr�rx)rZ	signaturer{rrr�test_os_environ_is_not_altered_s

�z4CGIHTTPServerTestCase.test_os_environ_is_not_alteredcCrj)Nz/cgi-bin%2ffile1.pyr`rKr_rkrzrrr�#test_urlquote_decoding_in_cgi_checkh�

�z9CGIHTTPServerTestCase.test_urlquote_decoding_in_cgi_checkcCrj)Nz/cgi-bin/child-dir/file3.pyr`rKr_rkrzrrr�test_nested_cgi_path_issue21323nroz5CGIHTTPServerTestCase.test_nested_cgi_path_issue21323cCrj)Nz/cgi-bin/file4.py?a=b?c=dsa=b?c=drKr_rkrzrrr�&test_query_with_multiple_question_marktroz<CGIHTTPServerTestCase.test_query_with_multiple_question_markcCrj)Nz0/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//sk=aa%2F%2Fbb&//q//p//=//a//b//rKr_rkrzrrr�"test_query_with_continuous_slasheszs
��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.pyr`rKr_)rZcgi_directories�appendrBrwrarr�rr�rxrPrzrrr� 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)))rurK)ZACCEPTz
text/plainztext/html,text/plainz/cgi-bin/file6.pyr=r�zHTTP_ACCEPT=r6)rZsubTestrBrwr>rr�rxrdr�r)rZbrowser_acceptZtestsrFr\r{rrr�test_accept�s �����z!CGIHTTPServerTestCase.test_acceptN)rrrrrr$r4rardr:r<r^rbrcrfrgrirlrmrnrprqrrrtrvrrrrr5�s&L*	
r5cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�SocketlessRequestHandlerNcs6t��}t�|j_t�j|dd|d�d|_d|_dS)N��	directoryFrH)	r	ZMockr
�makefile�return_valuer�r#�
get_calledrq)rryrBr�rrr#�s


z!SocketlessRequestHandler.__init__cCs6d|_|�tj�|�dd�|��|j�d�dS)NTrJrK� <html><body>Data</body></html>
)r|rOrr�rQrRrerfr-rrrr��s
zSocketlessRequestHandler.do_GETcGrrr)rr�rrrrr�rz$SocketlessRequestHandler.log_messager)rrrr#r�rr4rrr�rrw�srwc@�eZdZdd�ZdS)�!RejectingSocketlessRequestHandlercCs|�tj�dS)NF)rYrZEXPECTATION_FAILEDr-rrr�handle_expect_100�sz3RejectingSocketlessRequestHandler.handle_expect_100N)rrrr�rrrrr��rc@s0eZdZdd�Zdd�Zdd�Zedd��Zd	S)
�AuditableBytesIOcCs
g|_dSr)�datasr-rrrr#�s
zAuditableBytesIO.__init__cCs|j�|�dSr)r�rs)rr�rrrrf�r^zAuditableBytesIO.writecCsd�|j�S)Nr�)r0r�r-rrr�getData��zAuditableBytesIO.getDatacCs
t|j�Sr)r�r�r-rrr�	numWrites�s
zAuditableBytesIO.numWritesN)rrrr#rfr��propertyr�rrrrr��sr�c@s�eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1S)2�BaseHTTPRequestHandlerTestCasezrTest the functionality of the BaseHTTPServer.

       Test the support for the Expect 100-continue header.
       sHTTP/1.[0-9]+ 200 OKcCst�|_dSr)rw�handlerr-rrrr:�r�z$BaseHTTPRequestHandlerTestCase.setUpcCs:t|�}t�}||j_||j_|j��|�d�|��S�Nr)r
r��rfilere�handle_one_request�seek�	readlines)rr#�input�outputrrr�send_typical_request�s

z3BaseHTTPRequestHandlerTestCase.send_typical_requestcCs|�|jj�dSr)r�r�r|r-rrr�verify_get_called�r�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>rj)rw�sum)rrFrr�r�verify_expected_headers�s �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.rTuŸ beansz"GET /foo\b"ar HTTP/1.0"��rz/\x1bbar\x00\x1brjz/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

rrj���r}�GET / HTTP/1.1r=rvrHr�
r�r�r�r�rwr��requestline�commandrm�request_version�assertSequenceEqualrFrV�r�resultrrr�
test_http_1_1��
z,BaseHTTPRequestHandlerTestCase.test_http_1_1cCr�)NsGET / HTTP/1.0

rrjr�r}�GET / HTTP/1.0r=rv�HTTP/1.0rr�r�rrr�
test_http_1_0r�z,BaseHTTPRequestHandlerTestCase.test_http_1_0cCs6|�d�}|�t|�d�|�|dd�|��dS)NsGET / HTTP/0.9

rjrr})r�rwr�r�r�rrr�
test_http_0_9s
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 rj�
)r�r�rr��indexrr�r|r�rrr�test_extra_spaces�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

rrjr�r}r�r=rvr��)ZExpectz100-continuer��rr�rFrrr�test_with_continue_1_0#s
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
rjr�r�sHTTP/1.1 200 OK
r�r}r�r=rvrHr�)r�rwr�r�r�r�r�rmr�r�rFrVr�rrr�test_with_continue_1_10s
z5BaseHTTPRequestHandlerTestCase.test_with_continue_1_1cCsNtd�}t�}t�}||_||_d|_d|_d|_|�d�|�	|j
d�dS)Nr�rHr�r�)r
r�rwr�rer�r�r�rYrwr��rr�r�r�rrr�#test_header_buffering_of_send_error?s
zBBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_errorcCsXtd�}t�}t�}||_||_d|_|�d�|�|jd�|�	�|�|jd�dS)Nr�rHr�rrj)
r
r�rwr�rer�Zsend_response_onlyrwr�rRr�rrr�+test_header_buffering_of_send_response_onlyMs
zJBaseHTTPRequestHandlerTestCase.test_header_buffering_of_send_response_onlycCsvtd�}t�}t�}||_||_d|_|�dd�|�dd�|�|jd�|�	�|�|�
�d�|�|jd�dS)	Nr�rHZFoo�foo�barrsFoo: foo
bar: bar

rj)r
r�rwr�rer�rQrwr�rRr�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�_readAndReseekms


z[BaseHTTPRequestHandlerTestCase.test_header_unbuffered_when_continue.<locals>._readAndReseekr�rHr�r�rsHTTP/1.1 100 Continuerjr�sHTTP/1.1 200 OK)	r
r�r�rer�r�ZassertNotEqualr�rw)rr�r�r�r�rrr�$test_header_unbuffered_when_continueks
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
rjr�css�|]}|dkVqdS)sConnection: close
Nr)r��rrrrr��s�zMBaseHTTPRequestHandlerTestCase.test_with_continue_rejected.<locals>.<genexpr>)r�rr�rwr�rr|r�)rZ
usual_handlerr�rrr�test_with_continue_rejected�s
"
z:BaseHTTPRequestHandlerTestCase.test_with_continue_rejectedcCsD|�ddd�}|�|dd�|�|jj�|�|jjt�dS)NsGET �x�rs#HTTP/1.1 414 Request-URI Too Long
)r�rwrr�r|ZassertIsInstancer�r r�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�rwrr�r|r�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�r6)r�r0r�rrrd)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��iter�handler[�
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	monthnamerwZdate_time_string)rZnowZyearZmonthZdayZhhZmm�ssZwd�y�zr\rrr�test_date_time_string�s

�z4BaseHTTPRequestHandlerTestCase.test_date_time_stringN)rrr�__doc__�re�compiler�r:r�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@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)� SimpleHTTPRequestHandlerTestCasez Test url parsing cCs^tj�t��d�|_tj�dd�|_tj�dd�|_t�|_tdd�|_	tt
�d�d�|_dS)Nrr�r�rx)
r4rmr0r��translated_1�translated_2�translated_3rw�	handler_1�	handler_2�pathlib�PurePath�	handler_3r-rrrr:�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_pathrwr�r�r�r�r��rrmrrr�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_slash�s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)Nrmzc:c:c:foo/filenamez\c:../filenamezc:\c:..\foo/filenamezc:c:foo\c:c:bar/filename)rZ	swap_attrrr4�ntpathr�r�r��seprwr�r�r�r�r�r�rrr�test_windows_colon�sL$�z3SimpleHTTPRequestHandlerTestCase.test_windows_colonN)rrrr�r:r�r�r�rrrrr��sr�c@r~)�MiscTestCasecCsdg}hd�}tt�D]}|�d�s||vrq
tt|�}t|dd�dkr(|�|�q
|�tj|�dS)N>Z
nobody_uidr�rI�_rzhttp.server)r�rr�getattrrsZassertCountEqual�__all__)rr\ZdenylistrZ
module_objectrrr�test_all"s

�zMiscTestCase.test_allN)rrrr�rrrrr�!r�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>6sz2ScriptTestCase.mock_server_class.<locals>.<lambda>)r()r')r{)rH)r	Z	MagicMockr-rrr�mock_server_class0s�����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_unspec=�
�z&ScriptTestCase.test_server_test_unspeccCs0|��}tj|dd�|�|jtjtjf�dS)Nr&rrrrrr�test_server_test_localhostFr	z)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�rwrr'r�rr�rrrrr�test_server_test_ipv6[�

�z$ScriptTestCase.test_server_test_ipv6cCrr�)�
ipv4_addrsr�rr�rwrr'rr
rrr�test_server_test_ipv4brz$ScriptTestCase.test_server_test_ipv4N)rrrr�r	r�rr
rrrrrrrrr�.s


r�cCst�tjt���dSr)r/ZaddModuleCleanupr4r�r�rrrr�setUpModulejsr�__main__)Br��collectionsrZhttp.serverrrrrr>rrr4r'r�r�rhr�r�r�Z
email.messager�Zemail.utilsrZhttp.client�urllib.parser�r�r�r�r!r/r	�ior
rr�rZtest.supportr
rrr"r ZTestCaser2rGr�r�rKrLrMrOr3�hasattrrr5rwrr�r�r�r�r�rr�mainrrrr�<module>st	P$%
�~Z
<
�