config root man

Current Path : /usr/local/lib/python2.5/test/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/lib/python2.5/test/test_urllib2_localnet.pyc

³ò
h”Rc@sddkZddkZddkZddkZddkZddkZddkZddklZdei	fd„ƒYZ
deifd„ƒYZddd„ƒYZ
d	eifd
„ƒYZdeifd„ƒYZd
„ZedjoeƒndS(iÿÿÿÿN(ttest_supporttLoopbackHttpServercBs eZdZd„Zd„ZRS(s^HTTP server w/ a few modifications that make it useful for
    loopback testing purposes.
    cCs*tii|||ƒ|iidƒdS(Ngð?(tBaseHTTPServert
HTTPServert__init__tsockett
settimeout(tselftserver_addresstRequestHandlerClass((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyRscCs,|iiƒ\}}|idƒ||fS(s"BaseHTTPServer method, overridden.g$@(RtacceptR(Rtrequesttclient_address((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytget_requests
(t__name__t
__module__t__doc__RR
(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyRs		tLoopbackHttpServerThreadcBs)eZdZd„Zd„Zd„ZRS(s2Stoppable thread that runs a loopback http server.cCsPtii|ƒ||_t|_||_d|if|_tiƒ|_	dS(Ns	127.0.0.1(
t	threadingtThreadRt_RequestHandlerClasstFalset_stopt_portt_server_addresstEventtready(RtportR	((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyR+s			cCst|_|iƒdS(s.Stops the webserver if it's currently running.N(tTrueRtjoin(R((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytstop3s	cCscd}||i_t|i|iƒ}|iiƒ}|iiƒx|ip|i	ƒqFWdS(NsHTTP/1.0(
Rtprotocol_versionRRRtgetsocknameRtsetRthandle_request(Rtprotocolthttpdtsa((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytrun;s	

(RRRRRR&(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyR(s		tDigestAuthHandlercBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„ZRS(
s-Handler for performing digest authentication.cCs1d|_g|_h|_d|_d|_dS(Nis
Test Realmtauth(t_request_numt_noncest_userst_realm_namet_qop(R((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyRNs
				cCs
||_dS(N(R-(Rtqop((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytset_qopUscCs$t|tƒpt‚||_dS(N(t
isinstancetdicttAssertionErrorR+(Rtusers((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt	set_usersXscCs
||_dS(N(R,(Rtrealm((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt	set_realm\scCsA|id7_tit|iƒƒiƒ}|ii|ƒ|S(Ni(R)thashlibtmd5tstrt	hexdigestR*tappend(Rtnonce((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt_generate_nonce_scCs±|idƒ}||d}|idƒ}h}xx|D]p}|idƒ\}}|iƒ}|ddjo"|ddjo|dd!}n
|iƒ}|||<q9W|S(Nt it,t=it"iÿÿÿÿ(tfindtsplittstrip(Rtauth_strtfirst_space_indextpartst	auth_dicttparttnametvalue((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt_create_auth_dictes"cCs°h}|i|ƒ||d<||d<||d<d|}ti|ƒiƒ}d|}ti|ƒiƒ}	||d<|	|d<d|}
ti|
ƒiƒ}||d	jS(
Ntpasswordtmethodturis#%(username)s:%(realm)s:%(password)ss%(method)s:%(uri)stHA1tHA2s3%(HA1)s:%(nonce)s:%(nc)s:%(cnonce)s:%(qop)s:%(HA2)stresponse(tupdateR7R8R:(RRHRMRNROt
final_dicttHA1_strRPtHA2_strRQtresponse_strRR((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt_validate_authvs







cCsg|iddƒ|iddƒ|idd|i|i|iƒfƒ|iƒ|iidƒtS(Ni—sProxy Authentication RequiredsContent-Types	text/htmlsProxy-Authenticates(Digest realm="%s", qop="%s",nonce="%s", sProxy Authentication Required.(	t
send_responsetsend_headerR,R-R=tend_headerstwfiletwriteR(Rtrequest_handler((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt_return_auth_challengeˆs
cCs8t|iƒdjotSn|iidƒp|i|ƒSnó|i|idƒ}|ii|dƒo|i|d}n|i|ƒS|idƒ|ijo|i|ƒSn|ii	|dƒt
}x@|i|igD],}|i
|||i|ƒo
t}qèqèW|p|i|ƒSntSdS(sPerforms digest authentication on the given HTTP request
        handler.  Returns True if authentication was successful, False
        otherwise.

        If no users have been set, then digest auth is effectively
        disabled and this method will always return True.
        isProxy-AuthorizationtusernameR<N(tlenR+Rtheadersthas_keyR_RLtgetR*tremoveRtpatht
short_pathRXtcommand(RR^RHRMtauth_validatedRf((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyR"—s.	
	
(RRRRR/R4R6R=RLRXR_R"(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyR'Ks								tFakeProxyHandlercBs)eZdZeƒZd„Zd„ZRS(sÏThis is a 'fake proxy' that makes it look like the entire
    internet has gone down due to a sudden zombie invasion.  It main
    utility is in providing us with authentication support for
    testing.
    cGsdS(N((Rtformattargs((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytlog_messageÎscCsœti|idƒ\}}}}}}||_|ii|ƒoU|iddƒ|iddƒ|iƒ|ii	d|iƒ|ii	dƒndS(NthttpiÈtOKsContent-Types	text/htmlsYou've reached %s!<BR>sFOur apologies, but our server is down due to a sudden zombie invasion.(
turlparseRfRgtdigest_auth_handlerR"RYRZR[R\R](RtscmtnetlocRftparamstquerytfragment((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytdo_GETÓs!	
(RRRR'RqRmRw(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyRjÅs		tProxyAuthTestscBsfeZdZdZdZdZdZdeZd„Zd„Z	d„Z
d	„Zd
„Zd„Z
RS(shttp://www.foo.comittesterttest123t	TestRealmshttp://127.0.0.1:%dcCsªtiih|i|i<ƒtii|iƒt|itƒ|_	|i	i
ƒ|i	iiƒt
ih|id<ƒ}t
iƒ|_t
i||iƒ|_dS(NRn(RjRqR4tPASSWDtUSERR6tREALMRtPORTtservertstartRtwaitturllib2tProxyHandlert	PROXY_URLtProxyDigestAuthHandlert_digest_auth_handlertbuild_openertopener(Rthandler((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pytsetUpës

cCs|iiƒdS(N(R€R(R((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyttearDownùscCs\|ii|i|i|i|idƒtiidƒ|i	t
i|ii
|iƒdS(NtbadR((R‡tadd_passwordR~tURLR}R|RjRqR/tassertRaisesRƒt	HTTPErrorR‰topen(R((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt-test_proxy_with_bad_password_raises_httperrorüs	cCs3tiidƒ|iti|ii|iƒdS(NR((	RjRqR/RRƒR‘R‰R’R(R((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt,test_proxy_with_no_password_raises_httperrors	cCsm|ii|i|i|i|iƒtiidƒ|i	i
|iƒ}x|iƒoqMW|iƒdS(NR((
R‡RŽR~RR}R|RjRqR/R‰R’treadtclose(Rtresult((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyttest_proxy_qop_auth_works
s
cCs›|ii|i|i|i|iƒtiidƒy|i	i
|iƒ}Wntij
o
d}nX|o#x|iƒoqwW|iƒndS(Nsauth-int(R‡RŽR~RR}R|RjRqR/R‰R’RƒtURLErrortNoneR•R–(RR—((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt0test_proxy_qop_auth_int_works_or_throws_urlerrors
(RRRRR}R|R~R…R‹RŒR“R”R˜R›(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyRxás
						cCstitƒdS(N(Rtrun_unittestRx(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pyt	test_main#st__main__((tsysRRpRƒRtunittestR7ttestRRRRRR'tBaseHTTPRequestHandlerRjtTestCaseRxRR(((s6/usr/local/lib/python2.5/test/test_urllib2_localnet.pys<module>s#zB		


Man Man