%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_httplib.pyo


Nac@sddlZddlZddlZddlZddlZddlZddlZddlZddlZej	Z	ddl
mZejj
eZejjedZejjedZejjedZejZdfdYZdefd	YZd
ejfdYZde	fd
YZde	fdYZde	fdYZdfdYZdee	fdYZdee	fdYZde	fdYZde	fdYZde	fdYZ ej!e"dZ#e$dkre#ndS( iN(ttest_supportskeycert.pemskeycert2.pemsselfsigned_pythontestdotnet.pemt
FakeSocketcBsDeZejdddZdZddZdZdZRS(cCs:||_||_d|_t|_||_||_dS(Nt(ttextt	fileclasstdatatFalsetfile_closedthosttport(tselfRRRR	((s-/usr/local/lib/python2.7/test/test_httplib.pyt__init__s					cCs|jdj|7_dS(NR(Rtjoin(R
R((s-/usr/local/lib/python2.7/test/test_httplib.pytsendall"scCsR|dkr'|dkr'tjn|j|j|_|j|j_|jS(Ntrtrb(thttplibtUnimplementedFileModeRRtfilet
file_closetclose(R
tmodetbufsize((s-/usr/local/lib/python2.7/test/test_httplib.pytmakefile%s
cCs
t|_dS(N(tTrueR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyR-scCsdS(N((R
((s-/usr/local/lib/python2.7/test/test_httplib.pyR0sN(	t__name__t
__module__tStringIOtNoneRR
RRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs
		tEPipeSocketcBs#eZdZdZdZRS(cCstj||||_dS(N(RRtpipe_trigger(R
RR((s-/usr/local/lib/python2.7/test/test_httplib.pyR5scCs:|j|kr'tjtjdn|j|7_dS(Ntgotcha(RtsocketterrorterrnotEPIPER(R
R((s-/usr/local/lib/python2.7/test/test_httplib.pyR
:scCsdS(N((R
((s-/usr/local/lib/python2.7/test/test_httplib.pyR?s(RRRR
R(((s-/usr/local/lib/python2.7/test/test_httplib.pyR3s		t
NoEOFStringIOcBs&eZdZddZddZRS(sLike StringIO, but raises AssertionError on EOF.

    This is used below to test that httplib doesn't try to read
    more from the underlying file than it should.
    icCs4tjj||}|dkr0tdn|S(NRscaller tried to read past EOF(RtreadtAssertionError(R
tnR((s-/usr/local/lib/python2.7/test/test_httplib.pyR%HscCs4tjj||}|dkr0tdn|S(NRscaller tried to read past EOF(RtreadlineR&(R
tlengthR((s-/usr/local/lib/python2.7/test/test_httplib.pyR(NsN(RRt__doc__R%RR((((s-/usr/local/lib/python2.7/test/test_httplib.pyR$BstHeaderTestscBsbeZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
cCsdtfdY}xttfD]}xdD]}tjd}td|_||_d}i}|rtt	|||<n|j
d	d
|||j|jj|j
dq0Wq#WdS(
NtHeaderCountingBuffercBseZdZdZRS(cSs
i|_dS(N(tcount(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyR[scSsn|jd}t|dkrZ|dj}|jj|d|j|cd7<ntj||dS(Nt:ii(tsplittlentlowerR-t
setdefaulttlisttappend(R
titemtkvtlcKey((s-/usr/local/lib/python2.7/test/test_httplib.pyR4]s(RRRR4(((s-/usr/local/lib/python2.7/test/test_httplib.pyR,Zs	sContent-lengthtHostsAccept-encodingsexample.comtblahblahblahtspamspamspamtPOSTt/i(sContent-lengthR8sAccept-encoding(R3RRRtHTTPConnectionRtsockt_buffertstrR0trequesttassertEqualR-R1(R
R,texplicit_headertheadertconntbodytheaders((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_auto_headersVs
cCs
dtfdY}d}d}xtj||D]k\}}tjd}td|_||_|j	|d||j
|jjd	d
j|q5Wd}xm|D]e}tjd}td|_||_|j	|dd|j
|jjddj|qWxm|D]e}tjd}td|_||_|j	|dd|j
|jjd	d
j|q!Wxytj
||D]e}tjd}td|_||_|j	|dd|j
|jjdd
j|qWdS(NtContentLengthCheckercBseZdZdZRS(cSstj|d|_dS(N(R3RRtcontent_length(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyRvs
cSsd|jdd}t|dkrP|djdkrP|dj|_ntj||dS(NR.iiscontent-length(R/R0R1tstripRJR3R4(R
R5R6((s-/usr/local/lib/python2.7/test/test_httplib.pyR4ys((RRRR4(((s-/usr/local/lib/python2.7/test/test_httplib.pyRIus	RtPUTR;tPATCHsexample.comR<t0s%Header Content-Length incorrect on {}tGETtCONNECTtDELETEtHEADtOPTIONStTRACEs.Header Content-Length set for empty body on {}t t1(NR(RLR;RM(RORPRQRRRSRT(R3Rt	itertoolstproductRR=RR>R?RARBRJtformattchain(R
RItbodiestmethods_with_bodytmethodRFREtmethods_without_body((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_content_length_0ssH

cCstjd}td|_|jdd|jdd|jd|j|jdd|jd	|j|jd
d|jd|j|jd
d|jd|j|jddd|jd|j|jdd|jd|j|jdd|jd|j|jdd|jd|j|jdd|jd|j|jd d!|jd"|j|jd#d$|jd%|j|jd&d$|jd'|j|jd(d$|jd)|j|jd*d$|jd+|jdS(,Nsexample.comROR<sContent-lengthi*sContent-length: 42tFoos bar s
Foo:  bar tBars	baz	s
Bar: 	baz	t
AuthorizationsBearer mytokensAuthorization: Bearer mytokent
IterHeadertIterAtIterBsIterHeader: IterA
	IterBtLatinHeaderssLatinHeader: t
Utf8HeadersÀsUtf8Header: Às
C1-Controls	nextlinesC1-Control: nextlinesEmbedded-Fold-Spacesis
 alloweds!Embedded-Fold-Space: is
 allowedsEmbedded-Fold-Tabsis
	allowedsEmbedded-Fold-Tab: is
	alloweds	Key SpacetvaluesKey Space: values	KeySpace sKeySpace : valuesNonbreakSpacesNonbreakSpace: valuesNonbreakSpacesNonbreakSpace: value(	RR=RRR>t
putrequestt	putheadertassertInR?(R
RE((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_putheaders>cCsd}tjd}td}||_|jdd|j|jj|d}tjd}td}||_|jdd|j|jj|dS(NsCGET /foo HTTP/1.1
Host: [2001::]:81
Accept-Encoding: identity

s[2001::]:81RROs/foosEGET /foo HTTP/1.1
Host: [2001:102A::]
Accept-Encoding: identity

s
[2001:102A::](RR=RR>RAt
assertTrueRt
startswith(R
texpectedRER>((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_ipv6host_headers		cCsad}t|}tj|}|j|j|jdd|j|jdddS(Ns4HTTP/1.1 200 OK
First: val
: nval
Second: val

tFirsttvaltSecond(RRtHTTPResponsetbeginRBt	getheader(R
RFR>tresp((s-/usr/local/lib/python2.7/test/test_httplib.pyt!test_malformed_headers_coped_withs
cCsnd}tjt|}|j|j|jd|j|jdd|j|jddS(Ns|HTTP/1.1 200 OK
Public-Key-Pins: 
pin-sha256="xxx=";
report-uri="https://..."
Transfer-Encoding: chunked

4
body
0

sPublic-Key-PinssTransfer-EncodingtchunkedRF(RRtRRutassertIsNotNoneRvRBR%(R
Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_malformed_truncations
cCsOxdD]}d}||7}|d7}tjt|}|j|j|jdd|j|jdd|d}tjt|}|j|j|jdqWd	}tjt|}|j|j|jdd|j|jdd}tjt|}|j|j|jd
dS(Ns
s
s-HTTP/1.1 200 OK
Transfer-Encoding: chunked
s4
body
0

sTransfer-EncodingRyRFsHTTP/1.0 200 OK
sKHTTP/1.1 200 OK

Name: value
Transfer-Encoding: chunked

4
body
0

R(s
s
(RRtRRuRBRvR%(R
tblankRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_blank_line_formss*






cCsd}tjt|}|j|j|jd|j|jdd|j|jdd}tjt|}|j|j|jddS(NsHTTP/1.1 200 OK
From start
 continued
Name: value
From middle
 continued
Transfer-Encoding: chunked
From end

4
body
0

tNamesTransfer-EncodingRyRFs#HTTP/1.0 200 OK
From alone

body(RRtRRuRzRvRBR%(R
Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_from_line-s

cCs*dttdddttddd}t|}tj|}|j|j|jd	d
|j|jddd
jt	t
tdd}|j|jd||j|jd|jd}|j|j
d|jd||j|jddS(Ns0HTTP/1.1 200 OK
!#$%&'*+-.^_`|~: value
VCHAR: i!i~is
obs-text: iisM
obs-fold: text
 folded with space
	folded with tab
Content-Length: 0

sContent-LengthRNs!#$%&'*+-.^_`|~RhRtVCHARsobs-textsobs-foldRs folded with spacesfolded with tabiii(t	bytearraytrangeRRRtRuRBRvRtmaptchrRzRmRnRktendswith(R
RFR>Rwtvchartfolded((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_parse_all_octetsLs4
!cCstjd}td|_|jddddddddddd d!d"d#d$d%d&d'f}x=|D]5\}}|jtd|j||WdQXqkWdS((Nsexample.comRROR<s
Invalid
Namet
ValidValuesInvalid
NamesInvalid
Names

InvalidNames
InvalidNames
InvalidNames InvalidNames	InvalidNamesInvalid:Names:InvalidNamet	ValidNamesInvalid
Values
Invalid
Values
Invalid
ValuesInvalidValue
s
InvalidValue
s
InvalidValue
sInvalid header(s
Invalid
NameR(sInvalid
NameR(sInvalid
NameR(s

InvalidNameR(s
InvalidNameR(s
InvalidNameR(s InvalidNameR(s	InvalidNameR(sInvalid:NameR(s:InvalidNameR(RsInvalid
Value(Rs
Invalid
Value(Rs
Invalid
Value(RsInvalidValue
(Rs
InvalidValue
(Rs
InvalidValue
(RR=RR>RitassertRaisesRegexpt
ValueErrorRj(R
REtcasestnameRh((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_invalid_headersfs,	(RRRHR_RlRpRxR{R}RRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyR+Us		B	"		
		'		t	BasicTestcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZRS(cCsd}t|}tj|}|j|j|jdd|j|j|j|jd|j|jd}t|}tj|}|j	tj
|jdS(NsHTTP/1.1 200 Ok

TextiRtTextsHTTP/1.1 400.100 Not Ok

Text(RRRtRuRBR%tassertFalsetisclosedRmtassertRaisest
BadStatusLine(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_status_liness
cCs)tjd}|jt|ddS(NRsBadStatusLine("''",)(RRRBtrepr(R
texc((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_bad_status_reprscCsd}t|}tj|}|j|j|jdd|j|j|j|jdd|j|jdS(Ns*HTTP/1.1 200 Ok
Content-Length: 4

TextitTetxt(	RRRtRuRBR%RRRm(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_partial_readss
cCsd}t|}tj|}|j|j|jdd|j|j|j|jdd|j|jdd|j|jdS(NsHTTP/1.1 200 Ok

TextiRRiR(	RRRtRuRBR%RRRm(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyt$test_partial_reads_no_content_lengths
cCsd}t|}tj|}|j|j|jdd|j|j|j|jdd|j|jdd|j|jdS(Ns+HTTP/1.1 200 Ok
Content-Length: 10

TextiRRiR(	RRRtRuRBR%RRRm(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyt"test_partial_reads_incomplete_bodys
cCsx'd
D]}|jtjtj|qWxdddddfD]\}}}tj|}|j}||jkr|jd||jfn||jkr@|jd||jfq@q@WdS(Nswww.python.org:abcsuser:password@www.python.orgs[fe80::207:e9ff:fe9b]:8000sfe80::207:e9ff:fe9bi@swww.python.org:80swww.python.orgiPswww.python.org:s[fe80::207:e9ff:fe9b]s!Host incorrectly parsed: %s != %ss!Port incorrectly parsed: %s != %s(swww.python.org:abcsuser:password@www.python.org(s[fe80::207:e9ff:fe9b]:8000sfe80::207:e9ff:fe9bi@(swww.python.org:80swww.python.orgiP(swww.python.orgswww.python.orgiP(swww.python.org:swww.python.orgiP(s[fe80::207:e9ff:fe9b]sfe80::207:e9ff:fe9biP(RRt
InvalidURLtHTTPt_connRtfailR	(R
thpthtpthttptc((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_host_ports
	cCs`d}d}t|}tj|}|j|jd}||kr\|jdndS(NsHTTP/1.1 200 OK
Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"

No body
srCustomer="WILE_E_COYOTE"; Version="1"; Path="/acme", Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"s
Set-Cookies&multiple headers not combined properly(RRRtRuRvR(R
RthdrtsRtcookies((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_response_headerss
cCsTtdt}tj|dd}|j|jdkrP|jdndS(Ns*HTTP/1.1 200 OK
Content-Length: 14432

R]RRRs)Did not expect response from HEAD request(RR$RRtRuR%R(R
R>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_read_heads	
cCsbdjdtdDd}d|}t|}tj|}|jtj|jdS(Ns
css|]}d|VqdS(s
Header%d: fooN((t.0ti((s-/usr/local/lib/python2.7/test/test_httplib.pys	<genexpr>sisHTTP/1.1 200 OK
(RtxrangeRRRtRt
HTTPExceptionRu(R
RGRRR((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_too_many_headerss
#
cCs|d}ttd}tjd}t|}||_|jdd||j|jj	||j
d|jdS(NsPGET /foo HTTP/1.1
Host: example.com
Accept-Encoding: identity
Content-Length:Rsexample.comROs/foosdef test_send_file(topent__file__RR=RR>RARmRRnRk(R
RoRFRER>((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_send_files	cCsd}tjX}|jd|jdtjd}t|}||_|jdd|WdQX|j	|j
|dS(Ns_GET /foo HTTP/1.1
Host: example.com
Accept-Encoding: identity
Content-Length: 9

fake
datas	fake
dataisexample.comROs/foo(ttempfilet
TemporaryFiletwritetseekRR=RR>RARBR(R
RoRFRER>((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_send_tempfiles

	cCsd}tjd}td}||_|j||j||jd|_|jtjd||j||jd|_|jt	j	||j||jdS(Ns"this is a test this is only a testsexample.comRR(
RR=RRR>tsendRBRtarrayR(R
RoRER>((s-/usr/local/lib/python2.7/test/test_httplib.pyt	test_sends	
		cCsd}t|d}tj|dd}|j|j|jd|jxd
D]}t||}tj|dd}|jzwy|jWnUtjk
r}|j|jd|jt	|d|jt
|dnX|jd	Wd|jXq\WdS(NsDHTTP/1.1 200 OK
Transfer-Encoding: chunked

a
hello worl
1
d
s0
R]ROshello worldRsfoo
sIncompleteRead(11 bytes read)sIncompleteRead expected(Rsfoo
(RRRtRuRBR%RtIncompleteReadtpartialRR@R(R
t
chunked_startR>RwtxR((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_chunked$s&



cCsd}t|d}tj|dd}|j|j|jd|j|jd|j|jd|j|j	dS(NsEHTTP/1.1 200 OK
Transfer-Encoding: chunked

a
hello world
1
d
s0
R]RRRitOK(
RRRtRuRBR%tstatustreasonRmR(R
RR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_chunked_headBs
cCsXtd}tj|dd}|j|j|jd|j|jdS(Ns.HTTP/1.1 200 OK
Content-Length: -1

Hello
R]ROsHello
(RRRtRuRBR%RmR(R
R>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_negative_content_lengthSs

cCstd}tj|dd}|jy|jWnhtjk
r}|j|jd|jt|d|jt	|d|j
|jnX|jddS(Ns.HTTP/1.1 200 OK
Content-Length: 10

Hello
R]ROsHello
s-IncompleteRead(7 bytes read, 3 more expected)sIncompleteRead expected(
RRRtRuR%RRBRRR@RmRR(R
R>RwR((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_incomplete_read[s
cstdd}tjd|_|jtjfdj}|jd|j	|jd|j
ddS(NsgHTTP/1.0 401 Authorization Required
Content-type: text/html
WWW-Authenticate: Basic realm="example"
sContent-Lengthsexample.comcsjdddS(NRLs/urlRF(RA((RE(s-/usr/local/lib/python2.7/test/test_httplib.pyt<lambda>tRisBasic realm="example"swww-authenticate(RRR=R>RR R!tgetresponseRBRRv(R
R>Rw((REs-/usr/local/lib/python2.7/test/test_httplib.pyt
test_epipeks			cCs>d}t|}tj|}|jt|dddS(NsHTTP/1.1 200 Ok

Texttfilenos-HTTPResponse should expose a fileno attribute(RRRtRmthasattr(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_filenoattrzs
cCsW|jddddd}tjt|}|jtjtjf|jdS(Nsdisabled for HTTP 0.9 supportsHTTP/1.1 200 Oktkis
(tskipTestRRtRRtLineTooLongRRu(R
RFRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_overflowing_status_lines
cCsAdddd}tjt|}|jtj|jdS(NsHTTP/1.1 200 OK
X-Foo: barRis

(RRtRRRRu(R
RFRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_overflowing_header_linescCsKdddd}tjt|}|j|jtj|jdS(Ns/HTTP/1.1 200 OK
Transfer-Encoding: chunked

RNisa
hello world
0
(RRtRRuRRR%(R
RFRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_overflowing_chunked_lines
cCsXd}t|}tj|}|j|j|jd|j|jdS(NsHTTP/1.1 200 OkR(RRRtRuRBR%RmR(R
RFR>Rw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_early_eofs
cstjd}gdtjffdY}||_td|_|jdd|jtj|j	|j
|j
|jjdS(Nsexample.comtResponsecseZfdZRS(cs'j|tjj|||dS(N(R4RRtR(R
tpostkw(tresponse(s-/usr/local/lib/python2.7/test/test_httplib.pyRs
(RRR((R(s-/usr/local/lib/python2.7/test/test_httplib.pyRsRROR<(RR=Rttresponse_classRR>RARRRRmR(R
RER((Rs-/usr/local/lib/python2.7/test/test_httplib.pyttest_error_leaks	
cCsad}tjddt}|jdt||_|jtjd|j	WdQXdS(Nshello worldsexample.comtstricttfoosInvalid response(
RR=Rt
set_tunnelRR>RR R!t_tunnel(R
RFRE((s-/usr/local/lib/python2.7/test/test_httplib.pyt%test_proxy_tunnel_without_status_lines
cCsHdtjfdY}|d}td|_|jdddS(sv
        It should be possible to override the default validation
        behavior in putrequest (bpo-38216).
        tUnsafeHTTPConnectioncBseZdZRS(cSsdS(N((R
turl((s-/usr/local/lib/python2.7/test/test_httplib.pyt_validate_paths(RRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRssexample.comRROs/N(RR=RR>Ri(R
RRE((s-/usr/local/lib/python2.7/test/test_httplib.pyt*test_putrequest_override_domain_validationscCsNdtjfdY}|d}td|_|jdddddS(	NRcBseZdZRS(cSsdS(N((R
R((s-/usr/local/lib/python2.7/test/test_httplib.pyt_validate_hosts(RRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRss
example.com
RROR<t	skip_hosti(RR=RR>Ri(R
RRE((s-/usr/local/lib/python2.7/test/test_httplib.pyt(test_putrequest_override_host_validations(RRRRRRRRRRRRRRRRRRRRRRRRRRRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs4				
	
			
										
							
	
tOfflineTestcBseZdZRS(cCs|jtjtjddS(Ns	Not Found(RBRt	responsest	NOT_FOUND(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_responsess(RRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRstTestServerMixincBs eZdZdZdZRS(skA limited socket server mixin.

    This is used by test cases for testing http connection end points.
    cCs\tjtjtj|_tj|j|_tj|_|jj	dd|_dS(Ni(R tAF_INETtSOCK_STREAMtservRt	bind_portR	tfind_unused_porttsource_porttlistenRRE(R
((s-/usr/local/lib/python2.7/test/test_httplib.pytsetUps
cCs<|jr"|jjd|_n|jjd|_dS(N(RERRR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyttearDowns
	

(RRR*RR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs	tSourceAddressTestcBs6eZdZejeedddZRS(cCs[tjt|jdd|jf|_|jj|j|jjj	d|jdS(Ntsource_addressRi(
RR=tHOSTR	RREtconnectRBR>tgetsockname(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyttestHTTPConnectionSourceAddresss
tHTTPSConnections#httplib.HTTPSConnection not definedcCs+tjt|jdd|jf|_dS(NRR(RRRR	RRE(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyt testHTTPSConnectionSourceAddresss(RRRtunittesttskipIfRRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs	tHTTPTestcBseZdZdZRS(cCsjtjdtd|jdd|_|jj|j|jjj	t|j|jjj|jdS(NRR	R(
RRRR	RRERRBRR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyttestHTTPConnections$
cCsd}d}tjd|d||_|jjdtd|j|j|jjj||j|jjj||j	|jjjt|j	|jjj|jdS(Nsunreachable.test.domaint80RR	(
RRRERRR	tassertNotEqualRRRB(R
ttesthostttestport((s-/usr/local/lib/python2.7/test/test_httplib.pyttestHTTPWithConnectHostPort
s(RRRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs	tTimeoutTestcBs)eZdZdZdZdZRS(cCsDtjtjtj|_tj|jt_|jjddS(Ni(	R RRRRRRtPORTR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyRscCs|jjd|_dS(N(RRR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyRs
cCs@|jtjtjdz#tjttj}|j	WdtjdX|j|jj
d|j|jtjtjdz)tjttjdd}|j	WdtjdX|j|jj
d|jtjttjdd}|j	|j|jj
d|jdS(sbThis will prove that the timeout gets through
        HTTPConnection and into the socket.
        iNttimeout(tassertIsNoneR tgetdefaulttimeouttsetdefaulttimeoutRR=RRRRRRBR>t
gettimeoutR(R
thttpConn((s-/usr/local/lib/python2.7/test/test_httplib.pyttestTimeoutAttribute!s*


	

N(RRRRRRR(((s-/usr/local/lib/python2.7/test/test_httplib.pyRs		t	HTTPSTestcBs}eZdZdZdZdZdZejdZ	dZ
dZdZd	Z
d
ZdZRS(cCs#ttds|jdndS(NRsssl support required(RRR(R
((s-/usr/local/lib/python2.7/test/test_httplib.pyREscCs ddlm}||d|S(Ni(tmake_https_servertcertfile(ttest.ssl_serversR(R
RR((s-/usr/local/lib/python2.7/test/test_httplib.pytmake_serverIscCs2tjttjdd}|j|jddS(NR	i(RRRRRRBR	(R
R((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_attributesMscCsddl}tjdtjdXtjdd}|j|j}|jddWdQX|j	|j
jdWdQXdS(Nitnetworksself-signed.pythontest.netiROR<tCERTIFICATE_VERIFY_FAILED(tsslRtrequiresttransient_internetRRRtSSLErrorRARBt	exceptionR(R
RRtexc_info((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_networkedRs
c	Csddl}tjdtjd^|j}tjddd|}|jdd|j}|j	d|j
d	WdQXdS(
NiRsself-signed.pythontest.netitcontextROR<tnginxtserver(RRRRt_create_stdlib_contextRRRARRkRv(R
RRRRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_networked_noverification\s
	cCsttjdtjdRtjdd}|jdd|j}|jd}|jd|WdQXdS(NRswww.python.orgiROR<scontent-types	text/html(	RRRRRRARRvRk(R
RRwtcontent_type((s-/usr/local/lib/python2.7/test/test_httplib.pyt&test_networked_trusted_by_default_cerths
c	Csddl}tjdtjd|j|j}|j|_|jt	t
jddd|}|jdd|j
}|jd}|jd	|WdQXdS(
NiRsself-signed.pythontest.netiRROR<R!R (RRRRt
SSLContexttPROTOCOL_TLSt
CERT_REQUIREDtverify_modetload_verify_locationst CERT_selfsigned_pythontestdotnetRRRARRvRk(R
RRRRwt
server_string((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_networked_good_certss

cCsddl}tjdtjd|j|j}|j|_|jt	t
jddd|}|j|j
}|jddWdQX|j|jjdWdQXdS(	NiRsself-signed.pythontest.netiRROR<R(RRRRR&R'R(R)R*tCERT_localhostRRRRRARBRR(R
RRRR((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_networked_bad_certs

cCsuddl}|jt}tjd|j}|j|j}|jddWdQX|j	|j
jddS(Nit	localhostROR<R(RRR.RRR	RRRARBRR(R
RR!RR((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_local_unknown_certscCsddl}|jt}|j|j}|j|_|jttj	d|j
d|}|jdd|j}|j
|jddS(NiR0RROs/nonexistenti(RRR.R&R'R(R)R*RRR	RARRBR(R
RR!RRRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_local_good_hostnames
cCsddl}|jt}|j|j}|j|_t|_|j	tt
jd|jd|}|j
|j|jddWdQX|jt|_t
jd|jd|}|jdd|j}|j|jddS(NiR0RROR<s/nonexistenti(RRtCERT_fakehostnameR&R'R(R)Rtcheck_hostnameR*RRR	RtCertificateErrorRARRRRBR(R
RR!RRRw((s-/usr/local/lib/python2.7/test/test_httplib.pyttest_local_bad_hostnames	

	cCsx'dD]}|jtjtj|qWx^d
dddddfD]D\}}}tj|}|j||j|j||jqCWdS(Nswww.python.org:abcsuser:password@www.python.orgs[fe80::207:e9ff:fe9b]:8000sfe80::207:e9ff:fe9bi@swww.python.org:443swww.python.orgiswww.python.org:s[fe80::207:e9ff:fe9b]s[fe80::207:e9ff:fe9b]:(swww.python.org:abcsuser:password@www.python.org(s[fe80::207:e9ff:fe9b]:8000sfe80::207:e9ff:fe9bi@(swww.python.org:443swww.python.orgi(swww.python.org:swww.python.orgi(swww.python.orgswww.python.orgi(s[fe80::207:e9ff:fe9b]sfe80::207:e9ff:fe9bi(s[fe80::207:e9ff:fe9b]:sfe80::207:e9ff:fe9bi(RRRRRBRR	(R
RRRR((s-/usr/local/lib/python2.7/test/test_httplib.pyRs
(RRRRRRR#Rtsystem_must_validate_certR%R-R/R1R2R6R(((s-/usr/local/lib/python2.7/test/test_httplib.pyRCs				
			
				tTunnelTestscBseZdZRS(csdddfd}tjd}||_|j|jt|jd|j|jd|j	ddd|j
|jjd|j
|jj
d|jd	|jj|jd
|jj|jd|jj|jd|jj|j|j	d
dd|j
|jjd|j
|jj
d|jd	|jjk|jd|jjkdS(Ns:HTTP/1.0 200 OK

HTTP/1.1 200 OK
Content-Length: 42

cstd|dd|dS(NRiR	i(R(taddressR	R(t
response_text(s-/usr/local/lib/python2.7/test/test_httplib.pytcreate_connectionss	proxy.comsdestination.comRRR<RiPsCONNECT destination.comsHost: destination.com:NonesHost: destination.comsHost: proxy.comRL(RRR=t_create_connectionRRtRuntimeErrorRRRARBR>RR	RkRtassertNotInRm(R
R;RE((R:s-/usr/local/lib/python2.7/test/test_httplib.pyttest_connects*	



(RRR?(((s-/usr/local/lib/python2.7/test/test_httplib.pyR8sc	Cs&tjtttttttt	dS(N(
Rtrun_unittestR+RRRRRRR8(tverbose((s-/usr/local/lib/python2.7/test/test_httplib.pyt	test_mains	t__main__(%RRWRRR R"tosRRtTestCasettestRtpathtdirnameRthereRR.R3R+RRRR$R+RRRRRRRR8treap_threadsRRBR(((s-/usr/local/lib/python2.7/test/test_httplib.pyt<module>sB		0W.)

Zerion Mini Shell 1.0