Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.133.112.201
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_wsgiref.pyo
�
@��cc@s�ddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZddl
mZdd	lmZdd
lmZddlZddlZddlZddlmZd
efd��YZdefd��YZd�Zedd�Zd�Zdefd��YZdefd��YZdefd��YZ defd��YZ!de!fd��YZ"defd ��YZ#d!�Z$e%d"kr�e$�ndS(#i����(tTestCase(tsetup_testing_defaults(tHeaders(tBaseHandlertBaseCGIHandler(tutil(t	validator(t
WSGIServertWSGIRequestHandler(tmake_server(tStringIO(t
BaseServerN(tsupportt
MockServercBs eZdZd�Zd�ZRS(sNon-socket HTTP servercCs!tj|||�|j�dS(N(Rt__init__tserver_bind(tselftserver_addresstRequestHandlerClass((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyRscCs/|j\}}||_||_|j�dS(N(Rtserver_nametserver_portt
setup_environ(Rthosttport((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyRs		(t__name__t
__module__t__doc__RR(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR
s	tMockHandlercBs eZdZd�Zd�ZRS(sNon-socket HTTP handlercCs%|j|_|j\|_|_dS(N(trequestt
connectiontrfiletwfile(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytsetup"scCsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytfinish&s(RRRR R!(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR s	cCs|dddg�dgS(	Ns200 OKsContent-Types
text/plaintDatesMon, 05 Jun 2006 18:49:54 GMTs
Hello, world!(sContent-Types
text/plain(R"sMon, 05 Jun 2006 18:49:54 GMT((tenvirontstart_response((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt	hello_app*s
sGET / HTTP/1.0

cCs�tdd|tt�}t|�t�t�tjf\}}}}|t_z|j||fd�Wd|t_X|j�|j�fS(NtiPs	127.0.0.1i�"(s	127.0.0.1i�"(R	R
RR
tsyststderrtfinish_requesttgetvalue(tapptdatatservertinptoutterrtolderr((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt	run_amock1s-	
cCs|�}d}x1|D])}|||ks5t�n|d7}qWy||Wntk
rbnXtd|��yttfWntk
r�n�X|�}t|�|k	r�t�nx)|D]!}|j�|ks�t�q�q�Wy|j�Wntk
rnXtd|��dS(sUtility to compare a generic 2.1/2.2+ iterator with an iterable

    If running under Python 2.2+, this tests the iterator using iter()/next(),
    as well as __getitem__.  'make_it' must be a function returning a fresh
    iterator to be tested (since this may test the iterator twice).iisToo many items from __getitem__sToo many items from .next()N(tAssertionErrort
IndexErrortitert
StopIterationt	NameErrortnext(tmake_ittmatchtittntitem((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcompare_generic_iter>s4	
	

		


tIntegrationTestscBs8eZed�Zd�Zd�Zd�Zd�ZRS(cCs=|j|dtjj�dd|r-dp0dd�dS(Ns/HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/isA
Content-Type: text/plain
Date: Mon, 05 Jun 2006 18:49:54 GMT
sContent-Length: 13
R&s
Hello, world!(tassertEqualR'tversiontsplit(RR/t
has_length((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheck_helloes	(cCs t�\}}|j|�dS(N(R2RD(RR/R0((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttest_plain_hellopscCs?tddddd�\}}|j|j�dd�dS(NR,sGET txis HTTP/1.0

is!HTTP/1.0 414 Request-URI Too Long(R2R@t
splitlines(RR/R0((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttest_request_lengthts!cCs/ttt��\}}|j|dt�dS(NRC(R2RR%RDtFalse(RR/R0((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttest_validated_helloyscCsUd�}tt|��\}}|j|jd��|j|j�dd�dS(NcSs|dd�dgS(Ns200 OKsContent-Types
text/plains
Hello, world!(sContent-Types
text/plain((R#R$((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytbad_apps
s;A server error occurred.  Please contact the administrator.i����s]AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: <type 'tuple'>(R2Rt
assertTruetendswithR@RG(RRKR/R0((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttest_simple_validation_error~s	

(RRtTrueRDRERHRJRN(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR?cs
			tUtilityTestscBs�eZd�Zdd�Zd�Zd�Zdd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cCsfi|d6|d6}tj|�|jtj|�|�|j|d|�|j|d|�|S(NtSCRIPT_NAMEt	PATH_INFO(RRR@tshift_path_info(Rtsn_intpi_intparttsn_outtpi_outtenv((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt
checkShift�s
cCsi}tj|�t|t�r9|j||t�n|j|||�i||6}tj|�|j|||�dS(N(RRt
isinstanceR
tassertIsInstanceR@tassertIs(RtkeytvaluetaltRY((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheckDefault�s


cKs%tj|�|j|||�dS(N(RRR@(RR^R_tkw((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheckCrossDefault�s
cKs*tj|�|jtj|�|�dS(N(RRR@tapplication_uri(RturiRb((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheckAppURI�s
icKs-tj|�|jtj||�|�dS(N(RRR@trequest_uri(RRetqueryRb((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheckReqURI�s
cCs}||d�}t||�|�}|j|jj�x|D]}q?W|j|jj�|j�|j|jj�dS(NcSstjt|�|�S(N(RtFileWrapperR
(ttexttsize((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR9�s(R>tassertFalsetfileliketclosedtcloseRL(RRkRlR:R9R;R=((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pytcheckFW�s
	

cCs�|jddddd�|jddddd�|jddddd�|jddddd�|jdd	ddd�dS(
NR&t/s/xRFs/as/x/ys/a/xs/ys/x/(RZtNone(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestSimpleShifts�s
cCs|jddddd�|jddddd�|jdddd	d�|jdd
dd	d�|jdddd	d�|jdd
dd	d�|jddddd�|jddddd�|jddddd�|jddddd�|jddddd�dS(Ns/a/bs/../ys..s/as/yR&s//ytys/a/b/ys//y/Rrs/./ys/./y/s///./..//y/.//s/y/s///s/a/b/s/.//s/x//RFs/a/b/xs/.(RZRs(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestNormalizedShifts�scCspxidddddddddfd d!d"dtd�fdt�fd#gD]\}}|j||�qLWdS($NtSERVER_NAMEs	127.0.0.1tSERVER_PORTt80tSERVER_PROTOCOLsHTTP/1.0t	HTTP_HOSTtREQUEST_METHODtGETRQR&RRRrswsgi.versioniis
wsgi.run_onceswsgi.multithreadswsgi.multiprocesss
wsgi.inputswsgi.errorsswsgi.url_schemethttp(Rws	127.0.0.1(RxRy(RzsHTTP/1.0(R{s	127.0.0.1(R|R}(RQR&(RRRr(ii(s
wsgi.run_oncei(swsgi.multithreadi(swsgi.multiprocessi(swsgi.url_schemeR~(R
Ra(RR^R_((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestDefaults�s 	cCs�|jdddd�|jdddd�|jdddd�|jdddd	�|jdd
dd�|jdd
dd�|jdddd�dS(NR{sfoo.barRwswsgi.url_schemethttpstHTTPStont1tyesR~tfooRxRyt443(Rc(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestCrossDefaults�scCs�|jtji�d�|jtjidd6�d�|jtjidd6�d�|jtjidd6�d�|jtjidd6�d�dS(NR~R�R�R�R�R�R�(R@Rtguess_scheme(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestGuessScheme�s
   cCs�|jd�|jddd�|jddd�|jddd	d
d�|jdd
d�|jdddd
d�|jddd�|jdd
ddd�dS(Nshttp://127.0.0.1/shttp://127.0.0.1/spamRQs/spamshttp://127.0.0.1/sp%E4ms/sp�mshttp://spam.example.com:2071/R{sspam.example.com:2071Rxt2071shttp://spam.example.com/Rwsspam.example.coms	127.0.0.1shttps://127.0.0.1/R�R�shttp://127.0.0.1:8000/t8000(RfRs(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestAppURIs�s


c	Cs�|jd�|jddd�|jddd�|jdddd	d�|jd
ddd	d�|jdddd	d�|jd
ddd	d�|jdddd	ddd�|jdddd	ddd�|jddddd	ddd�dS(Nshttp://127.0.0.1/shttp://127.0.0.1/spamRQs/spamshttp://127.0.0.1/sp%E4ms/sp�mshttp://127.0.0.1/spammity/spams	/spammityRRs http://127.0.0.1/spammity/sp%E4ms"http://127.0.0.1/spammity/spam;hams	/spam;hams/http://127.0.0.1/spammity/spam;cookie=1234,5678s/spam;cookie=1234,5678s%http://127.0.0.1/spammity/spam?say=nitQUERY_STRINGssay=nis'http://127.0.0.1/spammity/spam?s%E4y=niss%E4y=nii(Ri(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestReqURIss"




cCs)|jdddddddg�dS(Ntxyzi2ixi(i
(Rq(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestFileWrapperscCs�xYdj�D]K}xB||j�|j�|j�fD]}|jtj|��q8Wq
WxYdj�D]K}xB||j�|j�|j�fD]}|jtj|��q�WqiWdS(NsbConnection Keep-Alive Proxy-Authenticate Proxy-Authorization TE Trailers Transfer-Encoding Upgrades4Accept Cache-Control Date Pragma Trailer Via Warning(RBttitletuppertlowerRLRt
is_hop_by_hopRm(RthopR`((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestHopByHops++N(RRRZRsRaRcRfRiRqRtRvRR�R�R�R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyRP�s						
							tHeaderTestscBs#eZd�Zd�Zd�ZRS(cCs=dg}|jttg��d�|jtt|��d�|jt|�j�dg�|jt|�j�dg�|jt|�j�|�|jt|�j�|�tg�}|d=d|d<xx|j|j|j	|j
|jfD]R}|j|d��|j|d��|j|d��|j
|d��q�W|j|dd�d	|d<|j|dd	�|j|j
d�d	g�|j|j	dd
�d	�|j|j	dd
�d
�|j|jdd
�d	�|j|jdd
�d
�|j|dd	�|j|dd
�dS(
NRFRuiiR�tbartFootFOOtbaztwheetzoo(RFRu(R@tlenRtkeystvaluestitemstassertIsNotthas_keyt__contains__tgettget_allt__getitem__RLRmt
setdefault(Rttestthtm((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestMappingInterface/s2	  
+
cCs|jttd�dS(NR�(tassertRaisest	TypeErrorR(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestRequireListNscCs�tg�}|jt|�d�|jdddd�|j|dd�|jt|�d�|jddd	d�|j|jd�dd
g�|jt|�d�dS(Ns
R�R�R�tspamsbar; baz="spam"sfoo: bar; baz="spam"

R�tcheesesbar; cheeses*foo: bar; baz="spam"
Foo: bar; cheese

(RR@tstrt
add_headerRsR�(RR�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt
testExtrasRs
(RRR�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�-s		tErrorHandlercBs,eZdZeejj��Zd�ZRS(s/Simple handler subclass for testing BaseHandlerc
Ks?t|�tj|td�t�t�|dtdt�dS(NR&tmultithreadtmultiprocess(RRRR
RO(RRb((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyRms
(	RRRtdicttosR#R�t
os_environR(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�estTestHandlercBseZdZd�ZRS(sASimple handler subclass for testing BaseHandler, w/error passthrucCs�dS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pythandle_errorws(RRRR�(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�tstHandlerTestscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZRS(iPi2c	Csjidd6dd6dd6dd6d	d
6}tjtd|��$tdd
dd�}|j�WdQXx6d#D].}|jt|d|�|jd|�qkWi}t|�x3|j�D]%\}}||kr�|||<q�q�W|j	id
d6dd6dd6dd
6|j
�d6|j�d6d$d6td6dd6t
d 6t
d!6tjd"6�|j|j|�dS(%Ns/my/hometHOMEs/my/pathtPATHsfr_FR.UTF-8tLANGttest_script_nameRQttest_server_nameRwR�tXtYs/override/homeRAR�R�trun_oncetfile_wrappertwsgi_swsgi.R&s	127.0.0.1s
wsgi.inputswsgi.errorsiiswsgi.versions
wsgi.run_onceR~swsgi.url_schemeswsgi.multithreadswsgi.multiprocessswsgi.file_wrapper(RAR�R�R�R�(ii(Rt	swap_attrR�RR@tgetattrR#RR�tupdatet	get_stdint
get_stderrRIRORRjtassertDictEqual(RR�thandlertattrtexpectedR^R_((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestEnvirons@


	

cCsGtdddi�}|j�x!dD]}|j||j�q&WdS(Nswsgi.url_schemes
wsgi.inputswsgi.errors(swsgi.url_schemes
wsgi.inputswsgi.errors(RRsRtassertInR#(RR�R^((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestCGIEnviron�s

cCs^tdd�}|j�|j|jdd�t�}|j�|j|jdd�dS(NR�R�swsgi.url_schemeR�R~(R�RR@R#(RR�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt
testScheme�s
	
cCsYt�}x3ddddgD]}|jtt||��qW|jt|jd�dS(Nt_flushR�R�tadd_cgi_varsR�(RR�tNotImplementedErrorR�t_write(RR�tname((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestAbstractMethods�s
	cCs�d�}d�}d�}t�}|j|�|j|jj�d�t�}|j|�|j|jj�d�t�}|j|�|j|jj�d�dS(NcSs|dg�|dgS(Ns200 OKswsgi.url_scheme((tets((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttrivial_app1�s
cSs|dg�|d�gS(Ns200 OKswsgi.url_scheme((R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttrivial_app2�scSs|ddg�gS(Ns200 OKsContent-Lengtht12345(sContent-LengthR�((R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttrivial_app4�ss)Status: 200 OK
Content-Length: 4

httpsStatus: 200 OK

https)Status: 200 OK
Content-Length: 12345

(R�trunR@tstdoutR*(RR�R�R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestContentLength�s				
	
	
cCs�d�}d�}t�}|j|�|j|jj�d�|j|jj�d�t�}|j|�|j|jj�d|jt|j�|jf�|j	|jj�j
d�d�dS(NcSs|dg�gS(Ns200 OK((R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt
non_error_app�s
cSstd��dS(Ns This should be caught by handler(R3(R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt	error_app�ss%Status: 200 OK
Content-Length: 0

R&s>Status: %s
Content-Type: text/plain
Content-Length: %d

%sR3i����(R�R�R@R�R*R(terror_statusR�t
error_bodytassertNotEqualtfind(RR�R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestBasicErrorOutput�s			
	
 csnd��fd�}t�}|j|�|j|jj�d��|j|jj�jd�d�dS(NsSome output has been sentcs#|dg���td��dS(Ns200 OKs This should be caught by handler(R3(R�R�(tMSG(s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�
ssStatus: 200 OK

R3i����(R�R�R@R�R*R�R(R�(RR�R�((R�s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestErrorAfterOutputs	
c	CsYd�}d}d}x=d
D]5}|r2d|p5d}xdD]}xdD]�}td|�}t|_||_||_|j|�|j||jj	��td|�}t
|_||_||_|j|�|d	kr|j|jj	�d�qL|jtj
|||f|jj	��|||f|jj	�f�qLWq?WqWdS(NcSs|dg�gS(Ns200 OK((R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�s
sfHTTP/%s 200 OK\r\nDate: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n%sContent-Length: 0\r\n\r\ns%Status: 200 OK
Content-Length: 0

s
FooBar/1.0sServer: %s
R&s1.0s1.1sHTTP/0.9sHTTP/1.0sHTTP/1.1Rz(s
FooBar/1.0N(s1.0s1.1(sHTTP/0.9sHTTP/1.0sHTTP/1.1(RsR�RIt
origin_serverthttp_versiontserver_softwareR�R@R�R*RORLtreR:(	RR�tstdpattshortpattsswtswRAtprotoR�((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestHeaderFormatss.	


			
			
"csSitd6�d���fd�}t�}|j|�|j�dt�dS(Ntclose_calledsSome output has been sentcs6|dg���dtf�fd��Y}|�S(Ns200 OKtCrashyIterablecs eZd�Z�fd�ZRS(css"xtrdVtd��qWdS(Ntblahs This should be caught by handler(ROR3(R((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt__iter__Gs	cst�d<dS(NR�(RO(R(tside_effects(s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyRpLs(RRR�Rp((R�(s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�Fs	(tobject(R�R�R�(R�R�(s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�Ds(RIR�R�R@RO(RR�R�((R�R�s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyttestCloseOnErrorAs
	
i�(RRtmaxDiffR�R�R�R�R�R�R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyR�{s	6				'		
	)cCstjt�dS(N(Rtrun_unittestR(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt	test_mainUst__main__(&tunittestRtwsgiref.utilRtwsgiref.headersRtwsgiref.handlersRRtwsgirefRtwsgiref.validateRtwsgiref.simple_serverRRR	R
tSocketServerRR�R�R'R�RR
RR%R2R>R?RPR�R�R�R�RR(((s8/usr/local/python-2.7/lib/python2.7/test/test_wsgiref.pyt<module>s6
	
	%*�8�	
© 2025 GrazzMean