Current File : //opt/imh-python/lib/python2.7/test/test_httplib.pyc
�
��Wc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZej	Z	ddl
mZejj
e�Zejjed�Zejjed�Zejjed�ZejZdfd��YZdefd	��YZd
ejfd��YZde	fd
��YZde	fd��YZde	fd��YZdfd��YZdee	fd��YZdee	fd��YZde	fd��YZde	fd��YZde	fd��YZ ej!e"d��Z#e$dkre#�ndS( i����N(ttest_supportskeycert.pemskeycert2.pemsselfsigned_pythontestdotnet.pemt
FakeSocketcBsDeZejddd�Zd�Zdd�Zd�Zd�ZRS(cCs:||_||_d|_t|_||_||_dS(Nt(ttextt	fileclasstdatatFalsetfile_closedthosttport(tselfRRRR	((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt__init__s					cCs|jdj|�7_dS(NR(Rtjoin(R
R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pytsendall"scCsR|dkr'|dkr'tj��n|j|j�|_|j|j_|jS(Ntrtrb(thttplibtUnimplementedFileModeRRtfilet
file_closetclose(R
tmodetbufsize((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pytmakefile%s
cCs
t|_dS(N(tTrueR(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR-scCsdS(N((R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR0sN(	t__name__t
__module__tStringIOtNoneRR
RRR(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyRs
		tEPipeSocketcBs#eZd�Zd�Zd�ZRS(cCstj||�||_dS(N(RRtpipe_trigger(R
RR((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR5scCs:|j|kr'tjtjd��n|j|7_dS(Ntgotcha(RtsocketterrorterrnotEPIPER(R
R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR
:scCsdS(N((R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR?s(RRRR
R(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR3s		t
NoEOFStringIOcBs&eZdZdd�Zdd�ZRS(s�Like 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.
    i����cCs4tjj||�}|dkr0td��n|S(NRscaller tried to read past EOF(RtreadtAssertionError(R
tnR((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR%HscCs4tjj||�}|dkr0td��n|S(NRscaller tried to read past EOF(RtreadlineR&(R
tlengthR((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR(NsN(RRt__doc__R%RR((((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR$BstHeaderTestscBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs�dtfd��Y}x�ttfD]�}x�dD]�}tjd�}td�|_|�|_d}i}|r�tt	|��||<n|j
d	d
||�|j|jj|j
�d�q0Wq#WdS(
NtHeaderCountingBuffercBseZd�Zd�ZRS(cSs
i|_dS(N(tcount(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR4]s(RRRR4(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_auto_headersVs
cCs
dtfd��Y}d}d}xtj||�D]k\}}tjd�}td�|_|�|_|j	|d|�|j
|jjd	d
j|��q5Wd}xm|D]e}tjd�}td�|_|�|_|j	|dd�|j
|jjddj|��q�Wxm|D]e}tjd�}td�|_|�|_|j	|dd�|j
|jjd	d
j|��q!Wxytj
||�D]e}tjd�}td�|_|�|_|j	|dd�|j
|jjdd
j|��q�WdS(NtContentLengthCheckercBseZd�Zd�ZRS(cSstj|�d|_dS(N(R3RRtcontent_length(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyRvs
cSsd|jdd�}t|�dkrP|dj�dkrP|dj�|_ntj||�dS(NR.iiscontent-length(R/R0R1tstripRJR3R4(R
R5R6((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR4ys((RRRR4(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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(RLsPOSTRM(RORPRQRRRSRT(R3Rt	itertoolstproductRR=RR>R?RARBRJtformattchain(R
RItbodiestmethods_with_bodytmethodRFREtmethods_without_body((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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+|j�dS(,Nsexample.comROR<sContent-lengthi*sContent-length: 42tFoos bar s
Foo:  bar tBars	baz	s
Bar: 	baz	t
AuthorizationsBearer mytokensAuthorization: Bearer mytokent
IterHeadertIterAtIterBsIterHeader: IterA
	IterBtLatinHeaders�sLatinHeader: �t
Utf8HeadersÀsUtf8Header: Às
C1-Controls	next�linesC1-Control: next�linesEmbedded-Fold-Spacesis
 alloweds!Embedded-Fold-Space: is
 allowedsEmbedded-Fold-Tabsis
	allowedsEmbedded-Fold-Tab: is
	alloweds	Key SpacetvaluesKey Space: values	KeySpace sKeySpace : valuesNonbreak�SpacesNonbreak�Space: values�NonbreakSpaces�NonbreakSpace: value(	RR=RRR>t
putrequestt	putheadertassertInR?(R
RE((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_putheader�s>cCs�d}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>((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_ipv6host_header�s		cCsad}t|�}tj|�}|j�|j|jd�d�|j|jd�d�dS(Ns4HTTP/1.1 200 OK
First: val
: nval
Second: val

tFirsttvaltSecond(RRtHTTPResponsetbeginRBt	getheader(R
RFR>tresp((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt!test_malformed_headers_coped_with�s
cCs�tjd�}td�|_|jdd�ddddddddd 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
NameRy(sInvalid
NameRy(sInvalid
NameRy(s

InvalidNameRy(s
InvalidNameRy(s
InvalidNameRy(s InvalidNameRy(s	InvalidNameRy(sInvalid:NameRy(s:InvalidNameRy(RzsInvalid
Value(Rzs
Invalid
Value(Rzs
Invalid
Value(RzsInvalidValue
(Rzs
InvalidValue
(Rzs
InvalidValue
(RR=RR>RitassertRaisesRegexpt
ValueErrorRj(R
REtcasestnameRh((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_invalid_headers�s,	(RRRHR_RlRpRxR(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR+Us		B	"		
t	BasicTestcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs�d}t|�}tj|�}|j�|j|jd�d�|j|j��|j|j�d�|j|j��d}t|�}tj|�}|j	tj
|j�dS(NsHTTP/1.1 200 Ok

TextiRtTextsHTTP/1.1 400.100 Not Ok

Text(RRRtRuRBR%tassertFalsetisclosedRmtassertRaisest
BadStatusLine(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_status_liness
cCs)tjd�}|jt|�d�dS(NRsBadStatusLine("''",)(RR�RBtrepr(R
texc((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_bad_status_repr$scCs�d}t|�}tj|�}|j�|j|jd�d�|j|j��|j|jd�d�|j|j��dS(Ns*HTTP/1.1 200 Ok
Content-Length: 4

TextitTetxt(	RRRtRuRBR%R�R�Rm(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_partial_reads(s
cCs�d}t|�}tj|�}|j�|j|jd�d�|j|j��|j|jd�d�|j|jd�d�|j|j��dS(NsHTTP/1.1 200 Ok

TextiR�R�iR(	RRRtRuRBR%R�R�Rm(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt$test_partial_reads_no_content_length4s
cCs�d}t|�}tj|�}|j�|j|jd�d�|j|j��|j|jd�d�|j|jd�d�|j|j��dS(Ns+HTTP/1.1 200 Ok
Content-Length: 10

TextiR�R�iR(	RRRtRuRBR%R�R�Rm(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt"test_partial_reads_incomplete_bodyAs
cCs�x'd
D]}|jtjtj|�qWx�dddddfD]\}}}tj|�}|j}||jkr�|jd||jf�n||jkr@|jd||jf�q@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(R�Rt
InvalidURLtHTTPt_connRtfailR	(R
thpthtpthttptc((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_host_portNs
	cCs`d}d}t|�}tj|�}|j�|jd�}||kr\|jd�ndS(Ns�HTTP/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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_response_headersbs
cCsTtdt�}tj|dd�}|j�|j�dkrP|jd�ndS(Ns*HTTP/1.1 200 OK
Content-Length: 14432

R]RRRs)Did not expect response from HEAD request(RR$RRtRuR%R�(R
R>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_read_headus	
cCsbdjd�td�D��d}d|}t|�}tj|�}|jtj|j�dS(Ns
css|]}d|VqdS(s
Header%d: fooN((t.0ti((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pys	<genexpr>�si�sHTTP/1.1 200 OK
(RtxrangeRRRtR�t
HTTPExceptionRu(R
RGRR�R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_too_many_headers�s
#
cCs|d}ttd�}tjd�}t|�}||_|jdd|�|j|jj	|��|j
d|j�dS(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>((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_send_file�s	cCs�d}tj��X}|jd�|jd�tjd�}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>((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_send_tempfile�s

	cCs�d}tjd�}td�}||_|j|�|j||j�d|_|jtjd|��|j||j�d|_|jt	j	|��|j||j�dS(Ns"this is a test this is only a testsexample.comRR�(
RR=RRR>tsendRBRtarrayR(R
RoRER>((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt	test_send�s	
		cCsd}t|d�}tj|dd�}|j�|j|j�d�|j�x�d
D]�}t||�}tj|dd�}|j�zwy|j�WnUtjk
r�}|j|jd�|jt	|�d�|jt
|�d�nX|jd	�Wd|j�Xq\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%RtIncompleteReadtpartialR�R@R�(R
t
chunked_startR>RwtxR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_chunked�s&



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

a
hello world
1
d
s0
R]RRRi�tOK(
RRRtRuRBR%tstatustreasonRmR�(R
R�R>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_chunked_head�s
cCsXtd�}tj|dd�}|j�|j|j�d�|j|j��dS(Ns.HTTP/1.1 200 OK
Content-Length: -1

Hello
R]ROsHello
(RRRtRuRBR%RmR�(R
R>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_negative_content_length�s

cCs�td�}tj|dd�}|j�y|j�Wnhtjk
r�}|j|jd�|jt|�d�|jt	|�d�|j
|j��nX|jd�dS(Ns.HTTP/1.1 200 OK
Content-Length: 10

Hello
R]ROsHello
s-IncompleteRead(7 bytes read, 3 more expected)sIncompleteRead expected(
RRRtRuR%R�RBR�R�R@RmR�R�(R
R>RwR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_incomplete_read�s
cstdd�}tjd��|�_|jtj�fd���j�}|jd|j	�|jd|j
d��dS(NsgHTTP/1.0 401 Authorization Required
Content-type: text/html
WWW-Authenticate: Basic realm="example"
sContent-Lengthsexample.comcs�jddd�S(NRLs/urlRF(RA((RE(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt<lambda>si�sBasic realm="example"swww-authenticate(RRR=R>R�R R!tgetresponseRBR�Rv(R
R>Rw((REsj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt
test_epipe�s			cCs>d}t|�}tj|�}|jt|d�d�dS(NsHTTP/1.1 200 Ok

Texttfilenos-HTTPResponse should expose a fileno attribute(RRRtRmthasattr(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_filenoattrs
cCsW|jd�dddd}tjt|��}|jtjtjf|j�dS(Nsdisabled for HTTP 0.9 supportsHTTP/1.1 200 Oktkis
(tskipTestRRtRR�tLineTooLongR�Ru(R
RFRw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_overflowing_status_lines
cCsAdddd}tjt|��}|jtj|j�dS(NsHTTP/1.1 200 OK
X-Foo: barRis

(RRtRR�R�Ru(R
RFRw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_overflowing_header_linescCsKdddd}tjt|��}|j�|jtj|j�dS(Ns/HTTP/1.1 200 OK
Transfer-Encoding: chunked

RNisa
hello world
0
(RRtRRuR�R�R%(R
RFRw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_overflowing_chunked_line s
cCsXd}t|�}tj|�}|j�|j|j�d�|j|j��dS(NsHTTP/1.1 200 OkR(RRRtRuRBR%RmR�(R
RFR>Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_early_eof,s
cs�tjd�}g�dtjf�fd��Y}||_td�|_|jdd�|jtj|j	�|j
��|j
|jj�dS(Nsexample.comtResponsecseZ�fd�ZRS(cs'�j|�tjj|||�dS(N(R4RRtR(R
tpostkw(tresponse(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR:s
(RRR((R�(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�9sRROR<(RR=Rttresponse_classRR>RAR�R�R�RmR(R
RER�((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_error_leak5s	
cCsad}tjddt�}|jd�t|�|_|jtjd��|j	�WdQXdS(Nshello worldsexample.comtstricttfoosInvalid response(
RR=Rt
set_tunnelRR>R{R R!t_tunnel(R
RFRE((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt%test_proxy_tunnel_without_status_lineEs
(RRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�s0				
	
			
										
						tOfflineTestcBseZd�ZRS(cCs|jtjtjd�dS(Ns	Not Found(RBRt	responsest	NOT_FOUND(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_responsesPs(RRR�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�OstTestServerMixincBs eZdZd�Zd�ZRS(skA limited socket server mixin.

    This is used by test cases for testing http connection end points.
    cCs\tjtjtj�|_tj|j�|_tj�|_|jj	d�d|_dS(Ni(R tAF_INETtSOCK_STREAMtservRt	bind_portR	tfind_unused_porttsource_porttlistenRRE(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pytsetUpYs
cCs<|jr"|jj�d|_n|jj�d|_dS(N(RERRR�(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttearDown`s
	

(RRR*R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�Ts	tSourceAddressTestcBs6eZd�Zejeed�d�d��ZRS(cCs[tjt|jdd|jf�|_|jj�|j|jjj	�d|j�dS(Ntsource_addressRi(
RR=tHOSTR	R�REtconnectRBR>tgetsockname(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttestHTTPConnectionSourceAddresshs
tHTTPSConnections#httplib.HTTPSConnection not definedcCs+tjt|jdd|jf�|_dS(NR�R(RR�R�R	R�RE(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt testHTTPSConnectionSourceAddressns(RRR�tunittesttskipIfR�RR�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�gs	tHTTPTestcBseZd�Zd�ZRS(cCsjtjdtd|jdd�|_|jj�|j|jjj	t�|j|jjj|j�dS(NRR	R�(
RR�R�R	RRER�RBR�R(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttestHTTPConnectionys$
cCs�d}d}tjd|d|�|_|jjdtd|j�|j|jjj|�|j|jjj|�|j	|jjjt�|j	|jjj|j�dS(Nsunreachable.test.domaint80RR	(
RR�RER�R�R	tassertNotEqualR�RRB(R
ttesthostttestport((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttestHTTPWithConnectHostPorts(RRR�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�xs	tTimeoutTestcBs)eZdZd�Zd�Zd�ZRS(cCsDtjtjtj�|_tj|j�t_|jjd�dS(Ni(	R R�R�R�RR�R�tPORTR�(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR��scCs|jj�d|_dS(N(R�RR(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR��s
cCs@|jtj��tjd�z#tjttj�}|j	�Wdtjd�X|j|jj
�d�|j�|jtj��tjd�z)tjttjdd�}|j	�Wdtjd�X|j|jj
�d�|j�tjttjdd�}|j	�|j|jj
�d�|j�dS(sbThis will prove that the timeout gets through
        HTTPConnection and into the socket.
        iNttimeout(tassertIsNoneR tgetdefaulttimeouttsetdefaulttimeoutRR=R�R�R�R�RRBR>t
gettimeoutR(R
thttpConn((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttestTimeoutAttribute�s*


	

N(RRRR�R�R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR��s		t	HTTPSTestcBs}eZd�Zd�Zd�Zd�Zd�Zejd��Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZRS(cCs#ttd�s|jd�ndS(NR�sssl support required(R�RR�(R
((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR��scCs ddlm}||d|�S(Ni����(tmake_https_servertcertfile(ttest.ssl_serversR�(R
R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pytmake_server�scCs2tjttjdd�}|j|jd�dS(NR�i(RR�R�R�R�RBR�(R
R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_attributes�scCs�ddl}tjd�tjd��Xtjdd�}|j|j��}|jdd�WdQX|j	|j
jd�WdQXdS(Ni����tnetworksself-signed.pythontest.neti�ROR<tCERTIFICATE_VERIFY_FAILED(tsslRtrequiresttransient_internetRR�R�tSSLErrorRARBt	exceptionR�(R
RR�texc_info((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_networked�s
c	Cs�ddl}tjd�tjd��^|j�}tjddd|�}|jdd�|j�}|j	d|j
d	��WdQXdS(
Ni����R�sself-signed.pythontest.neti�tcontextROR<tnginxtserver(RRRRt_create_stdlib_contextRR�RAR�RkRv(R
RRR�Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_networked_noverification�s
	cCsttjd�tjd��Rtjdd�}|jdd�|j�}|jd�}|jd|�WdQXdS(NR�swww.python.orgi�ROR<scontent-types	text/html(	RRRRR�RAR�RvRk(R
R�Rwtcontent_type((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt&test_networked_trusted_by_default_cert�s
c	Cs�ddl}tjd�tjd���|j|j�}|j|_|jt	�t
jddd|�}|jdd�|j
�}|jd�}|jd	|�WdQXdS(
Ni����R�sself-signed.pythontest.neti�RROR<R
R	(RRRRt
SSLContexttPROTOCOL_TLSv1t
CERT_REQUIREDtverify_modetload_verify_locationst CERT_selfsigned_pythontestdotnetRR�RAR�RvRk(R
RRR�Rwt
server_string((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_networked_good_cert�s

cCs�ddl}tjd�tjd���|j|j�}|j|_|jt	�t
jddd|�}|j|j
��}|jdd�WdQX|j|jjd�WdQXdS(	Ni����R�sself-signed.pythontest.neti�RROR<R(RRRRRRRRRtCERT_localhostRR�R�RRARBRR�(R
RRR�R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_networked_bad_cert�s

cCsuddl}|jt�}tjd|j�}|j|j��}|jdd�WdQX|j	|j
jd�dS(Ni����t	localhostROR<R(RR�RRR�R	R�RRARBRR�(R
RR
R�R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_local_unknown_certscCs�ddl}|jt�}|j|j�}|j|_|jt�tj	d|j
d|�}|jdd�|j�}|j
|jd�dS(Ni����RRROs/nonexistenti�(RR�RRRRRRRR�R	RAR�RBR�(R
RR
RR�Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_local_good_hostnames
cCs�ddl}|jt�}|j|j�}|j|_t|_|j	t�t
jd|jd|�}|j
|j��|jdd�WdQX|j�t|_t
jd|jd|�}|jdd�|j�}|j|jd�dS(Ni����RRROR<s/nonexistenti�(RR�tCERT_fakehostnameRRRRRtcheck_hostnameRRR�R	R�tCertificateErrorRARRR�RBR�(R
RR
RR�Rw((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_local_bad_hostnames	

	cCs�x'dD]}|jtjtj|�qWx^d
dddddfD]D\}}}tj|�}|j||j�|j||j�qCWdS(Nswww.python.org:abcsuser:password@www.python.orgs[fe80::207:e9ff:fe9b]:8000sfe80::207:e9ff:fe9bi@swww.python.org:443swww.python.orgi�swww.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�(R�RR�R�RBRR	(R
R�R�R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR�+s
(RRR�R�R�RRRtsystem_must_validate_certRRRRRRR�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR��s				
			
				tTunnelTestscBseZd�ZRS(cs�d�dd�fd�}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|jjk�dS(Ns:HTTP/1.0 200 OK

HTTP/1.1 200 OK
Content-Length: 42

cst�d|dd|d�S(NRiR	i(R(taddressR�R�(t
response_text(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pytcreate_connectionFss	proxy.comsdestination.comRRR<RiPsCONNECT destination.comsHost: destination.com:NonesHost: destination.comsHost: proxy.comRL(RRR=t_create_connectionR�R�tRuntimeErrorR�RRARBR>RR	RkRtassertNotInRm(R
R$RE((R#sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyttest_connect?s*	



(RRR((((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyR!>sc	Cs&tjtttttttt	�dS(N(
Rtrun_unittestR+R�R�R�R�R�R�R!(tverbose((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt	test_maings	t__main__(%RRWR�RR R"tosR�R�tTestCasettestRtpathtdirnameR�thereRRRRR�RRR$R+R�R�R�R�R�R�R�R!treap_threadsRR+R(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_httplib.pyt<module>s@		��>.�)