Current File : //opt/imh-python/lib/python2.7/test/test_httpservers.pyc
�
��Wc@s#dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZddlmZddlmZddlmZejd�Zd	d#d
��YZdefd��YZd
ejfd��YZde
jfd��YZde
jfd��YZdefd��YZdefd��YZdZ dZ!dZ"e
j#e$ed�o�ej%�dkd�defd��Y�Z&de
jfd ��YZ'dd!�Z)e*d"kre)�ndS($s�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.
i����N(tBaseHTTPRequestHandlert
HTTPServer(tSimpleHTTPRequestHandler(tCGIHTTPRequestHandler(tStringIO(ttest_supportt	threadingtNoLogRequestHandlercBseZd�ZRS(cGsdS(N((tselftargs((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytlog_messages(t__name__t
__module__R
(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyRstSocketlessRequestHandlercBs#eZd�Zd�Zd�ZRS(cCst|_d|_dS(NsHTTP/1.1(tFalset
get_calledtprotocol_version(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt__init__$s	cCsDt|_|jd�|jdd�|j�|jjd�dS(Ni�sContent-Types	text/htmls <html><body>Data</body></html>
(tTrueRt
send_responsetsend_headertend_headerstwfiletwrite(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytdo_GET(s
	

cGsdS(N((RtfmtR	((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR
/s(RRRRR
(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR
#s		tTestServerThreadcBs#eZd�Zd�Zd�ZRS(cCs&tjj|�||_||_dS(N(RtThreadRtrequest_handlerttest_object(RRR((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR4s	cCsstd|j�|_|jjj�d|j_|jjj�d|_z|jj
d�Wd|jj�XdS(Ntiig�������?(Ri(RRtservertsockettgetsocknameRtPORTtserver_startedtsettNonet
serve_forevertserver_close(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytrun9s	cCs|jj�dS(N(Rtshutdown(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytstopCs(RRRR(R*(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR3s		
tBaseTestCasecBs,eZd�Zd�Zddid�ZRS(cCs`tj�|_tj�t_tj�|_t	||j
�|_|jj�|jj
�dS(N(Rtthreading_setupt_threadstEnvironmentVarGuardtostenvironRtEventR#RRtthreadtstarttwait(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytsetUpHs
cCs.|jj�tjj�tj|j�dS(N(R2R*R/R0t__exit__Rtthreading_cleanupR-(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttearDownPs

tGETcCs>tjd|j�|_|jj||||�|jj�S(Nt	localhost(thttplibtHTTPConnectionR"t
connectiontrequesttgetresponse(Rturitmethodtbodytheaders((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR>UsN(RRR5R8R%R>(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR+Gs		tBaseHTTPRequestHandlerTestCasecBsweZdZejd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZRS(sZTest the functionality of the BaseHTTPServer focussing on
    BaseHTTPRequestHandler.
    sHTTP/1.[0-9]+ 200 OKcCst�|_dS(N(R
thandler(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR5ascCsQt|�}t�}||j_||j_|jj�|jd�|j�S(Ni(RREtrfileRthandle_one_requesttseekt	readlines(Rtmessaget	input_msgtoutput((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytsend_typical_requestds	

cCs|j|jj�dS(N(t
assertTrueRER(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytverify_get_calledmscs;x4dD],�|jt�fd�|D��d�qWdS(NsServer: sDate: sContent-Type: c3s|]}|j��VqdS(N(t
startswith(t.0th(t	fieldName(sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pys	<genexpr>rsi(sServer: sDate: sContent-Type: (tassertEqualtsum(RRC((RSsn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytverify_expected_headersps
cCs#|jj|�}|j|�dS(N(tHTTPResponseMatchtsearchtassertIsNotNone(Rtresponsetmatch((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytverify_http_server_responsetscCsV|jd�}|j|d�|j|dd!�|j�|j|dd�dS(NsGET / HTTP/1.1

iii����s <html><body>Data</body></html>
(RMR\RVRORT(Rtresult((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt
test_http_1_1xs

cCsV|jd�}|j|d�|j|dd!�|j�|j|dd�dS(NsGET / HTTP/1.0

iii����s <html><body>Data</body></html>
(RMR\RVRORT(RR]((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt
test_http_1_0s

cCsG|jd�}|jt|�d�|j|dd�|j�dS(NsGET / HTTP/0.9

iis <html><body>Data</body></html>
(RMRTtlenRO(RR]((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt
test_http_0_9�scCsV|jd�}|j|d�|j|dd!�|j�|j|dd�dS(Ns(GET / HTTP/1.0
Expect: 100-continue

iii����s <html><body>Data</body></html>
(RMR\RVRORT(RR]((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_with_continue_1_0�s

cCsB|jddd�}|j|dd�|j|jj�dS(NsGET txiis#HTTP/1.1 414 Request-URI Too Long
(RMRTtassertFalseRER(RR]((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_request_length�s(RRt__doc__tretcompileRWR5RMRORVR\R^R_RaRbRe(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyRDZs										tBaseHTTPServerTestCasecBs�eZdeefd��YZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(RcBsJeZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	RS(sHTTP/1.1cCs;|jd�|jdd�|jdd�|j�dS(Ni�sContent-Types	text/htmlt
Connectiontclose(RRR(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytdo_TEST�s
cCs;|jd�|jdd�|jdd�|j�dS(Ni�sContent-Types	text/htmlRjs
keep-alive(RRR(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytdo_KEEP�s
cCs|jd�dS(Ni�(t
send_error(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytdo_KEYERROR�scCs;|jd�|jdd�|jdd�|j�dS(Ni�sContent-Types	text/htmlRjRk(RRR(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt	do_CUSTOM�s
cCs|jt|jd��dS(Ni(Rntinttpath(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt
do_SEND_ERROR�scCs|jt|jd��dS(Ni(RnRqRr(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytdo_HEAD�s(
RRRtdefault_request_versionRlRmRoRpRsRt(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR�s					cCs6tj|�tjd|j�|_|jj�dS(NR:(R+R5R;R<R"tcontconnect(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR5�s
cCs9|jjdd�|jj�}|j|jd�dS(NR9t/i�(RvR>R?RTtstatus(Rtres((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_command�scCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(Ns	HTTP/1.1
tXYZBOGUSRxi�(Rvt
_http_vsn_strt
putrequestt
endheadersR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_request_line_trimming�s

cCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(NtFUBARR9Rxi�(RvR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_version_bogus�s

cCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(Ns
HTTP/9.9.9R9Rxi�(RvR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_version_digits�s

cCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(NRR9Rxi�(RvR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_version_none_get�s

cCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(NRtCUSTOMRxi�(RvR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_version_none�s

cCs^d|j_d|j_|jjdd�|jj�|jj�}|j|jd�dS(NicsHTTP/9.9R9Rxi�(Rvt	_http_vsnR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_version_invalid�s
cCsRd|j_|jjdd�|jj�|jj�}|j|jd�dS(NRi�(RvR}R~RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_send_blank�s

cCsY|jjdd�|jjdd�|jj�|jj�}|j|jd�dS(NR9RxRjRki�(RvR~t	putheaderRR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_header_close�s

cCsed|j_|jjdd�|jjdd�|jj�|jj�}|j|jd�dS(NsHTTP/1.1R9RxRjs
keep-alivei�(RvR}R~R�RR?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_head_keep_alive�s
cCs9|jjdd�|jj�}|j|jd�dS(NtTESTRxi�(RvR>R?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_handlerscCse|jjdd�|jj�}|j|jd�d�|jjdd�|j|jj�dS(NtKEEPRxRjs
keep-aliveR�(RvR>R?RTt	getheadert
addCleanupRk(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_return_header_keep_alives
cCs9|jjdd�|jj�}|j|jd�dS(NtKEYERRORRxi�(RvR>R?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_internal_key_errorscCs9|jjdd�|jj�}|j|jd�dS(NR�Rxi�(RvR>R?RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_return_custom_statusscCs�d}x�d
D]�}|jjddj|��|jj�}|j||j�|jd|jd��|jd|jd	��||kr�|jd|jd
��n|j�}|jd|�q
WdS(Ni�i0ieifi�t
SEND_ERRORs/{}sContent-LengthsContent-TypesTransfer-EncodingR(i�i0(ieifi�i�i0(	RvR>tformatR?RTRyR%R�tread(Rtallow_transfer_encoding_codestcodeRztdata((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_send_errors
cCsd
}xdD]�}|jjddj|��|jj�}|j||j�|dkr�|jd|jd��|jd	|jd
��n2|jd|jd��|jd|jd
��||kr�|jd|jd��n|j	�}|jd|�q
WdS(Ni�i0iei�i�tHEADs/{}sContent-Lengths	text/htmlsContent-TypesTransfer-EncodingR(i�i0(iei�i�i�i0(
RvR>R�R?RTRyR%R�tassertInR�(RR�R�RzR�((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_head_via_send_error+s
(RRRRRR5R{R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyRi�s$																tSimpleHTTPServerTestCasecBsceZdeefd��YZd�Zd�Zd	d�Zd�Z	d�Z
d�Zd�ZRS(
RcBseZRS((RR(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR?scCs�tj|�tj�|_tj�}tj|�d|_tj	d|�|_
tjj|j
�|_
d|j
|_ttjj|j
d�d�}|j|j�|j�dS(NsWe are the knights who say Ni!tdirRxttesttwb(R+R5R/tgetcwdtcwdttempfilet
gettempdirtchdirR�tmkdtempttempdirRrtbasenamettempdir_nametbase_urltopentjoinRRk(Rtbasetempdirttemp((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR5Bs

	!cCsQz<tj|j�ytj|j�Wntk
r:nXWdtj|�XdS(N(	R/R�R�tshutiltrmtreeR�tOSErrorR+R8(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR8Os
cCsY|j�}|j|�|j|j|�|j|j�|rU|j||�ndS(N(R�RNRTRyRYtreason(RRZRyR�RB((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pytcheck_status_and_reasonYs
cCs|j|jd�}|j|dd|j�|j|jd�}|j|d�|j|jd�}|j|d�|j|j�}|j|d�|j|jd�}|j|d�|j|jd	�}|j|d�|j|jd
�|jd�|jd�}|j|d�|jd�}|j|d�ttjj	|j
d�d���}|j|jd�}|j|d�tjdkrtj�dkrtj
|jd�|j|jd�}|j|d�tj
|jd�nWdQXdS(Ns/testi�R�s/test/i�Rxi-s/?hi=2s?hi=1tLocations/?hi=1s/ThisDoesNotExisttThisDoesNotExists
index.htmltwtposixii�s/ThisDoesNotExists/ThisDoesNotExist/(R>R�R�R�RTR�R�R/RrR�R�tnametgeteuidtchmodR�(RRZtfp((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_getas4$!cCsq|j|jddd�}|j|d�|j|jd�tt|j���|j|jd�d�dS(Ns/testRAR�i�scontent-lengthscontent-typesapplication/octet-stream(R>R�R�RTR�tstrR`R�(RRZ((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt	test_head�scCss|jddd�}|j|d�|jddd�}|j|d�|jddd�}|j|d�dS(NRxRAtFOOi�tcustomtGETs(R>R�(RRZ((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_invalid_requests�scCs
|j|jd�}|j|dd|j�|j|jd�}|j|d�|j|jd�}|j|d�|j|j�}|j|d�|j|jd�}|j|d�|j|jd	�}|j|d�|j|jd
�|jd�dS(Ns/testi�R�s/test/i�Rxi-s/?hi=2s?hi=1R�s/?hi=1(R>R�R�R�RTR�(RRZ((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_path_without_leading_slash�sN(
RRRRRR5R8R%R�R�R�R�R�(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR�>s	
	
	 				s@#!%s

print "Content-type: text/html"
print
print "Hello World"
s�#!%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"))
sR#!%s
import os

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

print(os.environ["%s"])
R�is7This test can't be run reliably as root (issue #13308).tCGIHTTPServerTestCasecBs�eZdeefd��YZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZRS(RcBseZRS((RR(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR�scCs�tj|�tj�|_tjj|jd�|_tjj|jd�|_	tj
|j�tj
|j	�ttd�r�tjj|jd�|_tj
tj|j�ntj|_tjj|jd�|_t|jd��}|jt|j�WdQXtj|jd�tjj|jd�|_t|jd��}|jt|j�WdQXtj|jd�tjj|jd	�|_t|jd��}|jt|j�WdQXtj|jd�tjj|j	d
�|_t|jd��}|jt|j�WdQXtj|jd�tjj|jd�|_t|jd��!}|jt|jdf�WdQXtj|jd�tj�|_tj|j�dS(
Nscgi-bins	child-dirtsymlinktpythonsnocgi.pyR�i�sfile1.pysfile2.pysfile3.pysfile4.pytQUERY_STRING(R+R5R�R�t
parent_dirR/RrR�tcgi_dirt
cgi_child_dirtmkdirthasattrt	pythonexeR�tsyst
executablet
nocgi_pathR�Rt	cgi_file1R�t
file1_patht
file2_patht	cgi_file2t
file3_patht
file4_patht	cgi_file4R�R�R�(RR�tfile1tfile2tfile3tfile4((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR5�s@
 cCs�z�tj|j�|jtjkr8tj|j�ntj|j�tj|j�tj|j	�tj|j
�tj|j�tj|j
�tj|j�tj|j�Wdtj|�XdS(N(R/R�R�R�R�R�tremoveR�R�R�R�R�trmdirR�R�R�R+R8(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR8�sc	CsTidd6td6td6dd6dd6dd6dd6d	d
6d	d	6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6td6dd6dd 6td!6dd"6dd#6}x�|j�D]u\}}t|t�rt|t�r|j|tj|�q�tj|�}|j	||d$d%|||f�q�WdS(&Ns//Rs..s/.//..Rxs//\s/\s/.//s/cgi-bin/file1.pyscgi-bin/file1.pys//atas/as./as/C:/s./C:/s/a/bs/a/b/s/a/b/.s	/a/b/c/..s/a/b/ds/a/b/c/../ds/a/b/d/fs/a/b/c/../d/e/../fs/a/b/fs/a/b/c/../d/e/../../fs/a/b/c/../d/e/.././././..//fs../a/b/c/../d/e/.././././..//fs/a/fs/a/b/c/../d/e/../../../fs//fs/a/b/c/../d/e/../../../../fs/a/b/c/../d/e/../../../../../fs/a/b/c/../d/e/../../../../f/..s /a/b/c/../d/e/../../../../f/../.tmsgspath = %r
Got:    %r
Wanted: %r(
t
IndexErrort	iteritemst
isinstancettypet
issubclasst	ExceptiontassertRaisest
CGIHTTPServert_url_collapse_pathRT(Rttest_vectorsRrtexpectedtactual((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_url_collapse_pathsJ
	cCs>|jd�}|jd|j�|jd�|jf�dS(Ns/cgi-bin/file1.pysHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_headers_and_content/s	cCs&|jd�}|j|jd�dS(Ns)///////////nocgi.py/../cgi-bin/nothere.shi�(R>RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_issue194354scCsctjidd6dd6dd6�}idd6}|jd	d
||�}|j|j�d�dS(NitspamR�teggsi@�tbacons!application/x-www-form-urlencodedsContent-types/cgi-bin/file2.pytPOSTs1, python, 123456
(turllibt	urlencodeR>RTR�(RtparamsRCRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt	test_post8s$
cCs0|jd�}|j�|j|jd�dS(Ns/cgi-bin/invalidi�(R>R�RTRy(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_invaliduri?s
cCsaidtjd�d6}|jddd|�}|jd|j�|jd
�|jf�dS(NsBasic %ss
username:passt
Authorizations/cgi-bin/file1.pyR9RCsHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(tbase64t	b64encodeR>RTR�R�Ry(RRCRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_authorizationDs
	cCs>|jd�}|jd|j�|jd�|jf�dS(Nscgi-bin/file1.pysHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_no_leading_slashKs	cCshd}|tjd<|jd�}|jd|j�|jd�|jf�|jtjd|�dS(	NsTest CGI ServertSERVER_SOFTWAREs/cgi-bin/file1.pysHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(R/R0R>RTR�R�Ry(Rt	signatureRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_os_environ_is_not_alteredQs
	"cCs>|jd�}|jd|j�|jd�|jf�dS(Ns/cgi-bin%2ffile1.pysHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt#test_urlquote_decoding_in_cgi_checkYs	cCs>|jd�}|jd|j�|jd�|jf�dS(Ns/cgi-bin/child-dir/file3.pysHello World
s	text/htmli�sContent-type(sHello World
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_nested_cgi_path_issue21323^s	cCs>|jd�}|jd|j�|jd�|jf�dS(Ns/cgi-bin/file4.py?a=b?c=dsa=b?c=d
s	text/htmli�sContent-type(sa=b?c=d
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt&test_query_with_multiple_question_markcscCs>|jd�}|jd|j�|jd�|jf�dS(Ns0/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//sk=aa%2F%2Fbb&//q//p//=//a//b//
s	text/htmli�sContent-type(sk=aa%2F%2Fbb&//q//p//=//a//b//
s	text/htmli�(R>RTR�R�Ry(RRz((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt"test_query_with_continuous_slashesis
(RRRRRR5R8R�R�R�R�R�R�R�RRRRR(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR��s	,		*										t SimpleHTTPRequestHandlerTestCasecBs2eZdZd�Zd�Zd�Zd�ZRS(s Test url parsing cCs:tj�|_tjj|jd�|_t�|_dS(Ntfilename(R/R�t
translatedRrR�R
RE(R((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyR5sscCss|jjd�}|j||j�|jjd�}|j||j�|jjd�}|j||j�dS(Ns	/filenames/filename?foo=bars/filename?a=b&spam=eggs#zot(REttranslate_pathRTR	(RRr((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_query_argumentsxscCsN|jjd�}|j||j�|jjd�}|j||j�dS(Ns
//filenames//filename?foo=bar(RER
RTR	(RRr((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_start_with_double_slash�scCs#ddl}tj|jdt���|jjd�}|jtjtj�}|j	||j
�|jjd�}|jtjtj�}|j	||j
�|jjd�}|jtjtj�}|j	||j
�|jjd�}|jtjtj�}|j	||j
�WdQXdS(Ni����Rrsc:c:c:foo/filenames\c:../filenamesc:\c:..\foo/filenamesc:c:foo\c:c:bar/filename(tSimpleHTTPServerRt	swap_attrR/tntpathRER
treplacetsepRTR	(RR
Rr((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyttest_windows_colon�s(RRRfR5RRR(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyRqs
			cCs>z)tj�}tjttttt�Wdtj	|�XdS(N(
R/R�Rtrun_unittestRDRRiR�R�R�(tverboseR�((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt	test_main�s	t__main__((+RfR/R�RgR�RR�R�R;R�tunittestR�tBaseHTTPServerRRR
RRRR�Rt
import_moduleRRR
RRtTestCaseR+RDRiR�R�R�R�tskipIfR�R�R�RR%RR(((sn/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httpservers.pyt<module>sDA�l
$	�)