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.145.6.179
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_urllib2.pyc
�
@��cc@s�ddlZddlmZddlmZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlZyddlZWne
k
r�eZnXddlmZdejfd��YZd�Zd	�Zd
�Zd�Zdfd
��YZdfd��YZdefd��YZdejfd��YZdfd��YZdfd��YZdfd��YZdfd��YZdfd��YZ d�Z!d�Z"d ej#fd!��YZ$d"ej%fd#��YZ&d$fd%��YZ'd&ejfd'��YZ(d(�Z)d)ejfd*��YZ*d+ejefd,��YZ+d-ejfd.��YZ,ed/�Z-e.d0kr�e-d1e/�ndS(2i����N(ttest_support(ttest_urllib(tRequesttOpenerDirectortAbstractDigestAuthHandler(t
FakeHTTPMixintTrivialTestscBs5eZd�Zd�Zejed�d��ZRS(cCs�|jttjd�tjjtj�jtj	d�}tj
dkr�ddl}tj|�}|j
|jdd��}ntj
dkr�d|}n
d	|}tj|�}|j�}|j�dS(
Ns	bogus urlt/triscosi����s/.s./tnts
file:///%ss	file://%s(tassertRaisest
ValueErrorturllib2turlopentostpathtabspatht__file__treplacetseptnametstringtexpandt	translatet	maketranstreadtclose(tselftfnameRtfile_urltftbuf((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_trivials$

c
Cs�ddddgfdddgfdddd	d
ddd
gfddddgfg}x-|D]%\}}|jtj|�|�q^WdS(Nsa,b,ctatbtcspath"o,l"og"i"cal, examplespath"o,l"og"i"caltexamplesa, b, "c", "d", "e,f", g, hs"c"s"d"s"e,f"tgthsa="b\"c", d="e\,f", g="h\\i"sa="b"c"sd="e,f"sg="h\i"(tassertEqualRtparse_http_list(RttestsRtlist((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_parse_http_list4ssssl module requiredc
Cs?tj�}|jt��tjdddd|�WdQXdS(Nshttps://localhosttcafiles/nonexistent/pathtcontext(tssltcreate_default_contextR
RRR
(RR-((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_cafile_and_context<s(t__name__t
__module__R R+tunittestt
skipUnlessR.R0(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRs		cCsdS(s�
    The Request.headers dictionary is not a documented interface.  It should
    stay that way, because the complete set of headers are only accessible
    through the .get_header(), .has_header(), .header_items() interface.
    However, .headers pre-dates those methods, and so real code will be using
    the dictionary.

    The introduction in 2.4 of those methods was a mistake for the same reason:
    code that previously saw all (urllib2 user)-provided headers in .headers
    now sees only a subset (and the function interface is ugly and incomplete).
    A better change would have been to replace .headers dict with a dict
    subclass (or UserDict.DictMixin instance?)  that preserved the .headers
    interface and also provided access to the "unredirected" headers.  It's
    probably too late to fix that, though.


    Check .capitalize() case normalization:

    >>> url = "http://example.com"
    >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"]
    'blah'
    >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"]
    'blah'

    Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError,
    but that could be changed in future.

    N((((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_request_headers_dictEtcCsdS(s�
    Note the case normalization of header names here, to .capitalize()-case.
    This should be preserved for backwards-compatibility.  (In the HTTP case,
    normalization to .title()-case is done by urllib2 before sending headers to
    httplib).

    >>> url = "http://example.com"
    >>> r = Request(url, headers={"Spam-eggs": "blah"})
    >>> r.has_header("Spam-eggs")
    True
    >>> r.header_items()
    [('Spam-eggs', 'blah')]
    >>> r.add_header("Foo-Bar", "baz")
    >>> items = r.header_items()
    >>> items.sort()
    >>> items
    [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')]

    Note that e.g. r.has_header("spam-EggS") is currently False, and
    r.get_header("spam-EggS") returns None, but that could be changed in
    future.

    >>> r.has_header("Not-there")
    False
    >>> print r.get_header("Not-there")
    None
    >>> r.get_header("Not-there", "default")
    'default'

    N((((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_request_headers_methodscR6cCsdS(s�
    >>> mgr = urllib2.HTTPPasswordMgr()
    >>> add = mgr.add_password
    >>> add("Some Realm", "http://example.com/", "joe", "password")
    >>> add("Some Realm", "http://example.com/ni", "ni", "ni")
    >>> add("c", "http://example.com/foo", "foo", "ni")
    >>> add("c", "http://example.com/bar", "bar", "nini")
    >>> add("b", "http://example.com/", "first", "blah")
    >>> add("b", "http://example.com/", "second", "spam")
    >>> add("a", "http://example.com", "1", "a")
    >>> add("Some Realm", "http://c.example.com:3128", "3", "c")
    >>> add("Some Realm", "d.example.com", "4", "d")
    >>> add("Some Realm", "e.example.com:3128", "5", "e")

    >>> mgr.find_user_password("Some Realm", "example.com")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/spam")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam")
    ('joe', 'password')
    >>> mgr.find_user_password("c", "http://example.com/foo")
    ('foo', 'ni')
    >>> mgr.find_user_password("c", "http://example.com/bar")
    ('bar', 'nini')

    Actually, this is really undefined ATM
##     Currently, we use the highest-level path where more than one match:

##     >>> mgr.find_user_password("Some Realm", "http://example.com/ni")
##     ('joe', 'password')

    Use latest add_password() in case of conflict:

    >>> mgr.find_user_password("b", "http://example.com/")
    ('second', 'spam')

    No special relationship between a.example.com and example.com:

    >>> mgr.find_user_password("a", "http://example.com/")
    ('1', 'a')
    >>> mgr.find_user_password("a", "http://a.example.com/")
    (None, None)

    Ports:

    >>> mgr.find_user_password("Some Realm", "c.example.com")
    (None, None)
    >>> mgr.find_user_password("Some Realm", "c.example.com:3128")
    ('3', 'c')
    >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128")
    ('3', 'c')
    >>> mgr.find_user_password("Some Realm", "d.example.com")
    ('4', 'd')
    >>> mgr.find_user_password("Some Realm", "e.example.com:3128")
    ('5', 'e')

    N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_password_manager�s>cCsdS(sV
    >>> mgr = urllib2.HTTPPasswordMgr()
    >>> add = mgr.add_password

    The point to note here is that we can't guess the default port if there's
    no scheme.  This applies to both add_password and find_user_password.

    >>> add("f", "http://g.example.com:80", "10", "j")
    >>> add("g", "http://h.example.com", "11", "k")
    >>> add("h", "i.example.com:80", "12", "l")
    >>> add("i", "j.example.com", "13", "m")
    >>> mgr.find_user_password("f", "g.example.com:100")
    (None, None)
    >>> mgr.find_user_password("f", "g.example.com:80")
    ('10', 'j')
    >>> mgr.find_user_password("f", "g.example.com")
    (None, None)
    >>> mgr.find_user_password("f", "http://g.example.com:100")
    (None, None)
    >>> mgr.find_user_password("f", "http://g.example.com:80")
    ('10', 'j')
    >>> mgr.find_user_password("f", "http://g.example.com")
    ('10', 'j')
    >>> mgr.find_user_password("g", "h.example.com")
    ('11', 'k')
    >>> mgr.find_user_password("g", "h.example.com:80")
    ('11', 'k')
    >>> mgr.find_user_password("g", "http://h.example.com:80")
    ('11', 'k')
    >>> mgr.find_user_password("h", "i.example.com")
    (None, None)
    >>> mgr.find_user_password("h", "i.example.com:80")
    ('12', 'l')
    >>> mgr.find_user_password("h", "http://i.example.com:80")
    ('12', 'l')
    >>> mgr.find_user_password("i", "j.example.com")
    ('13', 'm')
    >>> mgr.find_user_password("i", "j.example.com:80")
    (None, None)
    >>> mgr.find_user_password("i", "http://j.example.com")
    ('13', 'm')
    >>> mgr.find_user_password("i", "http://j.example.com:80")
    (None, None)

    N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt"test_password_manager_default_port�R6t
MockOpenercBs)eZgZdejd�Zd�ZRS(cCs!||||_|_|_dS(N(treqtdatattimeout(RR;R<R=((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytopen�scGs|||_|_dS(N(tprototargs(RR?R@((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyterror�sN(R1R2t
addheaderstNonetsockett_GLOBAL_DEFAULT_TIMEOUTR>RA(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR:�stMockFilecBs)eZdd�Zdd�Zd�ZRS(cCsdS(N((Rtcount((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�R6cCsdS(N((RRG((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytreadline�R6cCsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�R6N(R1R2RCRRHR(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRF�stMockHeaderscBseZd�ZRS(cCs
|j�S(N(tvalues(RR((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
getheaderss(R1R2RK(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRIstMockResponsecBs&eZdd�Zd�Zd�ZRS(cCsAtjj||�||||f\|_|_|_|_dS(N(tStringIOt__init__tcodetmsgtheadersturl(RRORPRQR<RR((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRNscCs|jS(N(RQ(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytinfoscCs|jS(N(RR(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytgeturl
sN(R1R2RCRNRSRT(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRLs	t
MockCookieJarcBseZd�Zd�ZRS(cCs
||_dS(N(tach_req(Rtrequest((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytadd_cookie_headerscCs|||_|_dS(N(tec_reqtec_r(RtresponseRW((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytextract_cookiess(R1R2RXR\(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRU
s	t
FakeMethodcBseZd�Zd�ZRS(cCs||_||_||_dS(N(t	meth_namethandletaction(RR^R`R_((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRNs		cGs|j|j|j|�S(N(R_R^R`(RR@((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt__call__s(R1R2RNRa(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR]s	tMockHTTPResponsecBseZd�Zd�ZRS(cCs(||_||_||_||_dS(N(tfpRPtstatustreason(RRcRPRdRe((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRNs			cCsdS(NR6((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR!s(R1R2RNR(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRbs	t
MockHTTPClasscBsYeZd�Zejd�Zd�Zddd�Zddd�Z	d�Z
d�ZRS(cCs(g|_d|_t|_i|_dS(N(treq_headersRCR<tFalsetraise_on_endheaderst_tunnel_headers(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRN%s			cCs||_||_|S(N(thostR=(RRkR=((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRa+s		cCs
||_dS(N(tlevel(RRl((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytset_debuglevel0scCs5||_||_|r$||_n
|jj�dS(N(t_tunnel_hostt_tunnel_portRjtclear(RRktportRQ((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
set_tunnel3s
		cCs}||_||_|dk	r6|j|j�7_n|jj�|rU||_n|jryddl}|j	��ndS(Ni����(
tmethodtselectorRCRgtitemstsortR<RiRDRA(RRsRRtbodyRQRD((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRW;s		
	cCstt�idd�S(Ni�tOK(RbRF(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytgetresponseGscCsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRJsN(R1R2RNRDRERaRmRCRrRWRyR(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRf$s			tMockHandlercBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(i�cCs|j|�dS(N(t_define_methods(Rtmethods((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRNQscCskxd|D]\}t|�dkr.|\}}n
|d}}t|||j�}t|j||�qWdS(Ni(tlenRCR]R_tsetattrt	__class__(RR|tspecRR`tmeth((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR{Ss

cOs*|jjj||||f�|dkr/dS|dkr?|S|dkrdtddid�}|S|dkrztd�S|jd�r�||jd	�d
}yt|�}Wnt	k
r�nXtddid�}|jj
d|d||di�S|d
krtjd��nt
s&t�dS(Nsreturn selfsreturn responsei�RxR6sreturn requestshttp://blah/RAt ithttpitraisetblah(tparenttcallstappendRCRLRt
startswithtrfindtintRRARtURLErrorRhtAssertionError(Rtfn_nameR`R@tkwdstresRO((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR_Ys*

#cCsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRoR6cCs||_g|j_dS(N(R�R�(RR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
add_parentps	cCs#t|d�stS|j|jkS(Nt
handler_order(thasattrtTrueR�(Rtother((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt__lt__ss(	R1R2R�RNR{R_RR�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRzMs					cCs�g}d}xp|D]h}dtfd��Y}||�}|j|7_|j|�|d}|j|�|j|�qW|S(s�Create MockHandlers and add them to an OpenerDirector.

    meth_spec: list of lists of tuples and strings defining methods to define
    on handlers.  eg:

    [["http_error", "ftp_open"], ["http_open"]]

    defines methods .http_error() and .ftp_open() on one handler, and
    .http_open() on another.  These methods just record their arguments and
    return None.  Using a tuple instead of a string causes the method to
    perform some action (see MockHandler.handle()), eg:

    [["http_error"], [("http_open", "return request")]]

    defines .http_error() on one handler (which simply returns None), and
    .http_open() on another handler, which returns a Request object.

    itMockHandlerSubclasscBseZRS((R1R2(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��si(RzR�R�R�tadd_handler(topenert	meth_specthandlersRGtmethsR�R&((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytadd_ordered_mock_handlersys



cGs+t�}x|D]}|j|�qW|S(N(RR�(thandler_instancesR�R&((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytbuild_test_opener�s	
tMockHTTPHandlercBs#eZd�Zd�Zd�ZRS(cCs ||_||_|j�dS(N(RORQtreset(RRORQ((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRN�s		cCsd|_g|_dS(Ni(t_counttrequests(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s	cCs�ddl}ddl}ddlm}|jj|j|��|jdkr�|jd|_tj|j	}|j
||j��}|jj
d|t�|j	||�S||_|j
|d��}tdd|d	|j��SdS(
Ni����(RMiiR�s

i�RxR6(t	mimetoolstcopyRMR�R�tdeepcopyR�thttplibt	responsesROtMessageRQR�RARFR;RLtget_full_url(RR;R�R�RMRRP((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt	http_open�s		(R1R2RNR�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s		tMockHTTPSHandlercBseZd�Zd�ZRS(cCs tjj|�t�|_dS(N(RtAbstractHTTPHandlerRNRfthttpconn(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRN�scCs|j|j|�S(N(tdo_openR�(RR;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
https_open�s(R1R2RNR�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s	tMockPasswordManagercBseZd�Zd�ZRS(cCs(||_||_||_||_dS(N(trealmRRtusertpassword(RR�turiR�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytadd_password�s			cCs"||_||_|j|jfS(N(ttarget_realmt
target_urlR�R�(RR�tauthuri((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytfind_user_password�s		(R1R2R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s	tOpenerDirectorTestscBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs6dtfd��Y}|jtt�j|��dS(Nt
NonHandlercBseZRS((R1R2(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s(tobjectR
t	TypeErrorRR�(RR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_add_non_handler�s	cCsddlm}t�}ddgd
gg}t||�}|jtj��x(dD] }|j||j|d
�qWWdS(Ni����(R�R�sreturn selft
proxy_opentredirect_requesttdotproxytredirects://example.com/(R�sreturn self(R�sreturn self(R�sreturn self(R�R�R�(RR�RR�R�tUnknownHandlerR
R>(RR�toR�R�tscheme((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_badly_named_methods�s			
c
Cs�t�}dddgdgdgd	gg}t||�}td�}|j|�}|j||d�|ddf|ddfg}x[t||j�D]G\}}|\}	}
}}|j|	|
f|�|j||f�q�WdS(
NR�tftp_openthttp_error_302sreturn selfshttp://example.com/ii(R�sreturn self(R�sreturn self(RR�RR>R'tzipR�(
RR�R�R�R;trR�texpectedtgotthandlerRR@R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_handled�s	 cCs�t�}g}xqd	gdfdgdfgD]Q\}}dtfd��Y}||�}||_|j|�|j|�q.W|jd�}|j|jdd|d�|j|jdd|d�dS(
NR�sreturn selfi�iR�cBseZRS((R1R2(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�
sshttp://example.com/i(R�sreturn self(RRzR�R�R�R>R'R�(RR�R�R�R�R�R&R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_handler_orders		
cCs|t�}dgdgg}t||�}td�}|jtj|j|�|j|j|dd|fifg�dS(NR�R�sreturn selfshttp://example.com/i(R�R�(R�sreturn self(	RR�RR
RR�R>R'R�(RR�R�R�R;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_raises	c
Cs't�}dgddgdddgdgg}t||�}d	dd
��Y}td�}|j|�}t|j�dks�t�|d
d|ff|dd||�ddiffg}x]t||j�D]I\}}	|\}
}}|j|
|f|	d �|j||	d�q�WdS(NR�s	error 302thttp_error_400R�R�sreturn responsethttp_error_303t
http_errortUnknowncBseZd�ZRS(cSstS(N(R�(RR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt__eq__7R6(R1R2R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�6sshttp://example.com/iii.R6(R�s	error 302(R�R�(R�sreturn response((	RR�RR>R}R�R�R�R'(
RR�R�R�R�R;R�R�R�R�R�tmethod_nameR@((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_http_error)s$		
cCsst�}d	d
gddgg}t||�}td�}|j|�}|ddf|ddf|ddf|ddfg}x�t|j�D]�\}\}}	}
}|dkr|j||	f||�|jt|
�d�|j|
dt�q�|j||	f||�|jt|
�d�|j|
dt�|
ddk	r�|j|
dt
�q�q�WdS(
Nthttp_requestsreturn requestt
http_responsesreturn responseshttp://example.com/iii(R�sreturn request(R�sreturn response(R�sreturn request(R�sreturn response(RR�RR>t	enumerateR�R'R}tassertIsInstanceRCRL(RR�R�R�R;R�R�tiR�RR@R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_processorsDs(	 ((	R1R2R�R�R�R�R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s						cCsJddl}|j|�}tjdkrF|jd�rF|d}n|S(Ni����R	s///i(turllibtpathname2urlRRR�(RR�turlpath((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytsanepathname2urlhs

tHandlerTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�ZRS(csnddd��Y�dtjf�fd��Y}ddl}d}||�}t�}|_xdd|jd	d	d
ddgd
df	dd|jdd	d
ddgd
df	dd|jdd	d
ddgd
df	dd|jdd	d
ddgd
df	dddd	d	dddgd	df	dd|jd	d	dgddf	gD]\	}}}}	}
}}}
}t|�}d|_|j	|�}|j
|j|	�|j
|j|
�|j
|j
tj|��|j
|j|�|j
|j|�|j
|jj|
�|j
|jj|�|j�}|j
|jd�|�|j
t|d�t|��qHWdS(NtMockFTPWrappercBs#eZd�Zd�Zd�ZRS(cSs
||_dS(N(R<(RR<((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRNtR6cSs2|||_|_tj|j�t|j�fS(N(tfilenametfiletypeRMR<R}(RR�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytretrfileuscSsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRxR6(R1R2RNR�R(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�ss		tNullFTPHandlercs&eZd�Zej�fd�ZRS(cSs
||_dS(N(R<(RR<((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRN{R6csH|||_|_|||_|_||_�|j�|_|jS(N(R�tpasswdRkRqtdirsR<t
ftpwrapper(RR�R�RkRqR�R=(R�(s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytconnect_ftp|s
	(R1R2RNRDRER�((R�(s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�zs	i����srheum rhaponicums ftp://localhost/foo/bar/baz.htmlt	localhostR6tItfootbarsbaz.htmls	text/htmls'ftp://parrot@localhost/foo/bar/baz.htmltparrots*ftp://%25parrot@localhost/foo/bar/baz.htmls%parrots,ftp://%2542parrot@localhost/foo/bar/baz.htmls	%42parrotsftp://localhost:80/foo/bar/iPtDsftp://localhost/baz.gif;type=atAsbaz.gifsContent-typesContent-length((Rt
FTPHandlertftplibR:R�tFTP_PORTRCRR=R�R'R�R�RkRDt
gethostbynameRqR�R�R�R�RStgetR�R}(RR�R�R<R&R�RRRkRqR�R�ttype_R�R�tmimetypeR;R�RQ((R�s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_ftprsL
1	cCs�ddl}ddl}tj�}t�}|_tj}tt	j
j|��}d}d|d|d|jd�|fg}y|j|j
��}	Wn|jk
r�d}	nX|	r�|jd|	|f�nx|D]}
t|d�}z�z|j|�Wd|j�X|jt|
��}z(|j�}
|j�}|j�}Wd|j�Xt	j|�}|j|j�}Wdt	j|�X|j|
|�|j|d	d
�|j|dd�|j|d
|�|j||
�q�Wx�d|dd|jd�t	j�|fdt	j�|fgD]h}
zQt|d�}z|j|�Wd|j�X|jtj|jt|
��Wdt	j|�Xq:Wtj�}t�}|_x�dt fdt!fdt!fdt fdt!fgD]�\}
}t|
�}y|j|�Wn(tjt"fk
rI|j#|�n*X|j#|j$|k�|j|j%d�|j|j%dk|�q�WdS(Ni����s
hello, world
sfile://localhost%ss	file://%ssfile://%s%sR�R6twbsContent-types
text/plainsContent-lengtht13s
Last-modifiedsfile://localhost:80%ssfile:///file_does_not_exist.txtsfile://%s:80%s/%ss,file://somerandomhost.ontheinternet.com%s/%ssfile://ftp.example.com//foo.txts file://ftp.example.com///foo.txtsfile://ftp.example.com/foo.txts"file://somehost//foo/something.txts#file://localhost//foo/something.txttftp(&trfc822RDRtFileHandlerR:R�RtTESTFNR�RRRR�tgethostnametgaierrorR�R>twriteRt	file_openRRRSRTtstatt
formatdatetst_mtimetremoveR'tgetcwdR
R�R�RhtOSErrort
assertTrueR;ttype(RRRDR&R�RR�ttowriteturlst	localaddrRRRR�R<RQtrespurltstatstmodifiedR�R;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt	test_file�s�	

				cCs!tj�}t�}|_d}xGddgD]9\}}t||idd6�}d|_|jdd�t�}|j	||�}|j
|j|j|j
|j|jd	kd
f|j�}	|	j|	j|j|j
�|�|j|jd�|j|jd�|j|j|�|j|jd
�|j|jdddg�|j|j|�q/Wt|_|jtj|j	||�dg|_x}dD]u}td|�}td	d
id�}|j|�}
|dkr|j d|j!�|j d|j!�n.|j|j!dd�|j|j!dd�|j|j!dd�|j|j!dd�|jdd�|jdd�|jdd�|jdd�|j|�}
|j|j!dd�|j|j!dd�|j|j!dd�|j|j!dd�q�WdS(Nshttp://example.com/tGETtPOSTR�R�tFootSpamteggsi�Rxsexample.comiRt
ConnectionRR6sContent-lengthsContent-typet0s!application/x-www-form-urlencodedtHostR�tbaz(RN(RR�(RR(RR�(RR(RR(R6N("RR�R:R�RCRR=tadd_unredirected_headerRfR�RRHRSRTRORPR�thas_keyR'RkRlRsRtRgR<R�RiR
R�RBRLtdo_request_tassertNotIntunredirected_hdrs(RR&R�RRRsR<R;R�R�thdrstnewreq((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt	test_http	sd		
	
c	Cs�tj�}t�}|_d}ddddg}xy|D]q}t||�}|j|�}|j|jdd�|jdd�|j|�}|j|jdd�q;WdS(	NR6s#http://example.com/foo/bar/baz.htmls$http://example.com//foo/bar/baz.htmls$http://example.com/foo//bar/baz.htmls$http://example.com/foo/bar//baz.htmlRsexample.comssomeproxy:3128(
RR�R:R�RR!R'R#t	set_proxyRC(	RR&R�R<tds_urlstds_urltds_reqt	np_ds_reqtp_ds_req((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_http_doubleslashGs	
cCs�tj�}t�}|_d}t|�}|j|�}|j|j�d�|j|j�d�d}t|�}|j|�}|j|j�d�|j|j�d�dS(Nshttp://www.python.org?getspamswww.python.orgs	/?getspamshttp://www.python.orgR6(	RR�R:R�RR!R'tget_hosttget_selector(RR&R�t	weird_urlR;R%turl_without_path((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_fixpath_in_weirdurlsascCs�tj�}t�}|_d}t|�}tddid|�}|j||�}|j||k�|jt|d��tddid|�}|j||�}|j||k�|jt|d��tdd	id|�}|j||�}|j||k�|jt|d��td
did|�}|j|j||�dk�|j
|jd�|j
|j||d
dif�dS(
Nshttp://example.com/i�RxR6R?i�tAcceptedi�sPartial contenti�sBad gatewayR�(
RtHTTPErrorProcessorR:R�RRLR�R
R�RCR'R?R@(RR&R�RRR;R�tnewr((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_errorsts(cCs�t�}tj|�}t�}|_td�}tddid�}|j|�}|j|j	|kox|kn�|j
|j�d�|j|j��|j
||�}|j|j|k�|j|j|ko�|kn�dS(Nshttp://example.com/i�RxR6sexample.com(RURtHTTPCookieProcessorR:R�RRLR�R
RVR'tget_origin_req_hosttis_unverifiableR�RYRZ(RtcjR&R�R;R�R%R5((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_cookies�s	&c
Cs%d}d}tj�}t�}|_x�dD]�}x�dD]�}t|d|�}t||�}|jd	d
�tj	|_
|dk	r�|jdtt|���n|j
dd
�y*||t�|dti|d6��Wn1tjk
r|j|d�|j|�nX|j|jj�|�y|j|jj�d�Wn(tk
ry|j|jj��nXg|jjD]}	|	j�^q�}
|jd|
�|jd|
�|j|jjd	d
�|jd|jj�|jd|jj�q<Wq/Wt|�}tj	|_
|d�}t|dd�}d}tj	|_
y%x|||d�|d}q[WWn*tjk
r�|j|tjj�nXt|dd�}d}tj	|_
y)x"|||d|�|d}q�WWn*tjk
r |j|tjj�nXdS(Nshttp://example.com/a.htmlshttp://example.com/b.htmli-i.i/i3s
blah
blah
s
http_error_%stNonsensesviking=withholdsContent-LengthRtspamtBlahtlocationRscontent-lengthscontent-typec	Ss-|j|t�ddti|d6��dS(Ni.R>R?(R�RFRI(R&R;RR((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��storigin_req_hostsexample.comishttp://example.com/ishttp://example.com/%d(i-i.i/i3(Ns
blah
blah
(RtHTTPRedirectHandlerR:R�RCtgetattrRt
add_headerRDRER=tstrR}RRFRIt	HTTPErrorR'tassertIsNotNoneR;R�t
get_methodtAttributeErrorR
thas_dataRQtlowerR"R#tmax_repeatstmax_redirections(
Rtfrom_urltto_urlR&R�ROR<RsR;txRQR�RG((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_redirect�sj


%	cCsd}dddg}dddg}d}tj�}t�}|_t|�}tj|_xQ|D]I}|d	|}	|jtj	|j
|t�d
dti|	d6��qeWx^|D]V}|d	|}
|j
|t�d
d
ti|
d6��|j
|jj�|
�q�WdS(Nshttp://example.com/a.htmlR�thttpsR�tfiletimaptldapsexample.com/b.htmls://i.sSecurity LoopholeR?sThat's fine(RRAR:R�RRDRER=R
RER�RFRIR'R;R�(RRMt
valid_schemestinvalid_schemestschemeless_urlR&R�R;R�tinvalid_urlt	valid_url((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_invalid_redirect�s$

c	Cs�ddlm}ddlm}|�}||dd�tdd�}tj�}tj�}tj|�}t	||||�}|j
d�|j|jj
d��dS(	Ni����(t	CookieJar(tinteract_netscapeshttp://www.example.com/s	spam=eggsi.s%Location: http://www.cracker.com/

tCookie(t	cookielibR[ttest.test_cookielibR\R�RtHTTPDefaultErrorHandlerRAR7R�R>R
R;t
has_header(	RR[R\R:thhthdehthrhtcpR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_cookie_redirect�s	
cCsrd}tdd|�}tj�}tj�}t|||�}|jd�}|j|j�|j��dS(Ns(http://www.example.com/index.html#OK

i.s
Location: shttp://www.example.com(	R�RR`RAR�R>R'RTtstrip(Rtredirected_urlRbRcRdR�Rc((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_redirect_fragmentscs�tj�d}tj|�t_�jttd��td�����fd�}|tj_tj	d�}�j
|j�d�dS(	Ns(HTTP/1.1 302 Found
Location: ?query

tHTTPConnections/paths/path?querycs?�j|t����j|||||�d|j_dS(NsHTTP/1.1 200 OK

Hello!(R'tnextRWRtfakedata(tconnRsRRtpostkw(t
real_classRR(s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRWsshttp://python.org/pathshttp://python.org/path?query(s/paths/path?query(R�RjRtfakehttpt
addCleanupR~titerRWRR
R'RT(Rt	response1RWRc((RpRRs8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_redirect_no_paths	cCs�t�}tjtdd��}|j|�d	gg}t||�}td�}|j|j�d�|j	|�}|j|j�d�|j|ddfgg|j
D]}|dd!^q��dS(
NR�sproxy.example.com:3128R�sreturn responseshttp://acme.example.com/sacme.example.comii(R�sreturn response(RRtProxyHandlertdictR�R�RR'R.R>R�(RR�tphR�R�R;R�ttup((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_proxy$s	
cCs�dtjd<t�}tjtdd��}|j|�td�}|j|j	�d�|j
|�}|j|j	�d�td�}|j|j	�d�|j
|�}|j|j	�d�tjd=dS(	Ns
python.orgtno_proxyR�sproxy.example.comshttp://www.perl.org/swww.perl.orgshttp://www.python.orgswww.python.org(RtenvironRRRvRwR�RR'R.R>(RR�RxR;R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_proxy_no_proxy5s
	
cCs�t�}tjtdd��}|j|�d	gg}t||�}td�}|j|j�d�|j	|�}|j|j�d�|j|ddfgg|j
D]}|dd!^q��dS(
NRQsproxy.example.com:3128R�sreturn responseshttps://www.example.com/swww.example.comii(R�sreturn response(RRRvRwR�R�RR'R.R>R�(RR�RxR�R�R;R�Ry((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_proxy_httpsEs	
cCst�}tjtdd��}|j|�t�}|j|�td�}|jdd�|jdd�|j|j	�d�|j
|j�|j|�}|j
d
|jj�|jd|jj�|j|j�|j|j	�d�|j|jd	�d�dS(NRQsproxy.example.com:3128shttps://www.example.com/sProxy-AuthorizationtFooBars
User-AgenttGrailswww.example.comsProxy-authorization(sProxy-AuthorizationR(s
User-AgentR�(RRRvRwR�R�RRCR'R.tassertIsNoneRnR>R"R�RgtassertInRFt
get_header(RR�Rxt
https_handlerR;R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt$test_proxy_https_proxy_authorizationTs$	
	
	
	
t"c	Cs�t�}t�}tj|�}d}tdd|||f�}|j|�|j|�|j||d|||dd�dS(NsACME Widget Storei�s(WWW-Authenticate: Basic realm=%s%s%s

t
Authorizations!http://acme.example.com/protected(RR�RtHTTPBasicAuthHandlerR�R�t_test_basic_auth(Rt
quote_charR�tpassword_managertauth_handlerR�thttp_handler((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_basic_authks		

	cCs|jdd�dS(NR�t'(R�(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt(test_basic_auth_with_single_quoted_realm{sc
Cs�t�}t�}tj|�}d}tdd|�}|j|�|j|�d}tj|tf��'|j	||d|||dd�WdQXdS(NsACME Widget Storei�s$WWW-Authenticate: Basic realm=%s

sBasic Auth Realm was unquotedR�s!http://acme.example.com/protected(
RR�RR�R�R�Rtcheck_warningstUserWarningR�(RR�R�R�R�R�RP((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt#test_basic_auth_with_unquoted_realm~s		

	c	Cs�t�}tjtdd��}|j|�t�}tj|�}d}tdd|�}|j|�|j|�|j||d|||dd�dS(NR�sproxy.example.com:3128s
ACME Networksi�s(Proxy-Authenticate: Basic realm="%s"

sProxy-authorizations&http://acme.example.com:3128/protected(	RRRvRwR�R�tProxyBasicAuthHandlerR�R�(RR�RxR�R�R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_proxy_basic_auth�s	
	

	c
	Cs�dtfd��Y}dtjfd��Y}dtjfd��Y}|�}t�}||�}||�}d}tdd	|�}	|j|�|j|�|j|	�|j||d
||	|dd�|j|j	dd
gd�dS(NtRecordingOpenerDirectorcBseZd�Zd�ZRS(cSstj|�g|_dS(N(RRNtrecorded(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRN�s
cSs|jj|�dS(N(R�R�(RRS((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytrecord�s(R1R2RNR�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s	tTestDigestAuthHandlercBseZd�ZRS(c_s*|jjd�tjj|||�dS(Ntdigest(R�R�RtHTTPDigestAuthHandlerthttp_error_401(RR@R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s(R1R2R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��stTestBasicAuthHandlercBseZd�ZRS(c_s*|jjd�tjj|||�dS(Ntbasic(R�R�RR�R�(RR@R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s(R1R2R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��ss
ACME Networksi�s&WWW-Authenticate: Basic realm="%s"

R�s!http://acme.example.com/protectedR�R�i(
RRR�R�R�R�R�R�R'R�(
RR�R�R�R�R�tdigest_handlert
basic_handlerR�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt#test_basic_and_digest_auth_handlers�s$			


	c	Cs�ddl}	d	\}
}|j|||
|�|j||j�|j||j�|j|
|j�|j||j�|j|�}|j|j|�|j|j	|�|jt
|j�d�|j|jdj
|��d|
|f}
d|	j|
�j�}|j|jdj|�|�|j|jdj||�d|_|_|j�|j|�}|jt
|j�d�|j|jdj
|��dS(
Ni����twiletcoyoteiis%s:%ssBasic i(R�R�(tbase64R�R'R�RRR�R�R>R�R�R}R�tassertFalseRatencodestringRgR�R#RCR�(RR�R�tauth_headerR�R�R�trequest_urlt
protected_urlR�R�R�R�tuserpasstauth_hdr_value((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s.
(R1R2R�RR&R-R2R6R;RPRZRfRiRuRzR}R~R�R�R�R�R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�ps,	:	]	>					I													/t	MiscTestscBsteZd�Zd�Zd�Zejed�d��Zejed�d��Z	ejed�d��Z
RS(cCs�dtjfd��Y}dtjfd��Y}dtjfd��Y}tj}|||�}|j||�|j||�|||��}|j||�|j||�||�}|j||�|�}|j|tj�|tj�}|j|tj�|tj��}|j|tj�dtjfd��Y}|||�}|j||�|j||�dS(	Nt
MyHTTPHandlercBseZRS((R1R2(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��st
FooHandlercBseZd�ZRS(cSsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytfoo_open�R6(R1R2R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��st
BarHandlercBseZd�ZRS(cSsdS(N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytbar_open�R6(R1R2R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��stMyOtherHTTPHandlercBseZRS((R1R2(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�s(RtHTTPHandlertBaseHandlertbuild_openertopener_has_handler(RR�R�R�R�R�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_build_opener�s,		cCs8x1|jD]}|j|kr
Pq
q
W|jt�dS(N(R�RR
Rh(RR�t
handler_classR&((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�scCsKt�}|jt��}|jd�WdQX|jt|j�d�dS(Ntinvalids5Unsupported digest authentication algorithm 'invalid'(RR
Rtget_algorithm_implsR'RDt	exception(RR�texc((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_unsupported_algorithm"s	sssl module requiredc	Cs�x�tdd�tdd�D]�}t|�}d|}|jd�z�t|�jdd�}tj}|j|d	|��tj	d
|�WdQX|j|d	|��tj	d|�WdQXWd|j
�XqWdS(Nii!iis//localhost:7777/test%s/sHTTP/1.1 200 OK

Hello.s\s\\scontain control.*shttp:shttps:(trangetchrRqtreprRR�t
InvalidURLtassertRaisesRegexpRR
t
unfakehttp(Rtchar_notcharRWtescaped_char_reprR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt(test_url_path_with_control_char_rejected+s#

	cCs�|jd�d}d|d}zktj}|j|d��tjdj|��WdQX|j|d��tjdj|��WdQXWd|j�XdS(	NsHTTP/1.1 200 OK

Hello.s:localhost:7777?a=1 HTTP/1.1
X-injected: header
TEST: 123s//s:8080/test/?test=as*contain control.*\\r.*(found at least . .)shttp:{}scontain control.*\\nshttps:{}(RqR�R�R�RR
tformatR�(RRkRWR�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt4test_url_path_with_newline_header_injection_rejectedCs
		
	
 c	Cs�x�ttdd��dgD]�}t|�}dj|�}|jd�z�t|�jdd�}tj}|j	|dj|���t
jd	j|��WdQX|j	|dj|���t
jd
j|��WdQXWd|j�XqWdS(Nii!is//localhost{}/test/sHTTP/1.1 200 OK

Hello.s\s\\scontain control.*{}shttp:{}shttps:{}(
R*R�R�R�RqR�RR�R�R�RR
R�(RR�R�RWR�R�((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt(test_url_host_with_control_char_rejectedYs#
			 (R1R2R�R�R�R3R4R.R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR��s	%			tRequestTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(cCs8tjd�|_tjdddidd6�|_dS(Nshttp://www.python.org/~jeremy/R<RQttestsX-Test(RRR�tpost(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pytsetUpns	cCs6|jd|jj��|jd|jj��dS(NRR(R'R�RGR�(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_methodtscCss|j|jj��|jd|jj��|jjd�|j|jj��|jd|jj��dS(NRR=R(R
R�RIR'RGtadd_data(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_add_dataxs
cCs|jd|jj��dS(Nshttp://www.python.org/~jeremy/(R'R�R�(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_get_full_urls	cCsB|jd|jj��tjd�}|jd|j��dS(Ns	/~jeremy/shttp://www.python.org/R(R'R�R/RR(RR;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_selector�scCs|jd|jj��dS(NR�(R'R�tget_type(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_get_type�scCs|jd|jj��dS(Nswww.python.org(R'R�R.(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt
test_get_host�scCs)tjd�}|jd|j��dS(Nshttp://www.%70ython.org/swww.python.org(RRR'R.(RR;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_get_host_unquote�scCsv|j|jj��|jjdd�|j|jj��|jd|jj��|jd|jj��dS(Nswww.perl.orgR�swww.python.org(R
R�t	has_proxyR'R'R8R.(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyRz�s
cCs&td�}|jd|j��dS(Ns<URL:http://www.python.org>swww.python.org(RR'R.(RR;((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_wrapped_url�scCsptd�}|jd|j��td�}|jd|j��d}t|�}|j|j�|�dS(Ns-http://www.python.org/?qs=query#fragment=trues
/?qs=queryshttp://www.python.org/#fun=trueRs.http://docs.python.org/library/urllib2.html#OK(RR'R/R�(RR;RR((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_url_fragment�scCs6|jt|jd��|jt|jd��dS(Nt_Request__r_xxxt_Request__r_method(R�R�R�(R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_private_attributes�scCsdS(sc
        Issue 13211 reveals that HTTPError didn't implement the URLError
        interface even though HTTPError is a subclass of URLError.

        >>> err = urllib2.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None)
        >>> assert hasattr(err, 'reason')
        >>> err.reason
        'something bad happened'
        N((R((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_HTTPError_interface�R6cCs�tjdddddddddd�}|jt|d��t|d�sUt�t|d	�sjt�t|j�st�y|j�Wntk
r�|j	d
�nX|j
|j�d�dS(s]
        Issue 15701= - HTTPError interface has info method available from URLError.
        RPssomething bad happenedRRROR$sContent-Length:42RcReRSserr.info() failedN(RRERCR
R�R�tcallableRSRHtfailR'(Rterr((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyttest_HTTPError_interface_call�s
(R1R2R�R�R�R�R�R�R�R�RzR�R�R�R�R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyR�ls													cCsVddlm}tj||�tjt|�ttttt	f}tj
|�dS(Ni����(ttest_urllib2(R�R�Rtrun_doctestRRR�R�R�R�trun_unittest(tverboseR�R)((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt	test_main�s	t__main__R�(0R3R�RRRRDRMRRRRR�R.tImportErrorRCttest.test_urllibRtTestCaseRR5R7R8R9R:RFRwRIRLRUR]RbRfRzR�R�R�R�R�R�R�R�R�R�R�R�R�R1R�(((s8/usr/local/python-2.7/lib/python2.7/test/test_urllib2.pyt<module>sT

+		!	A	/		),		�	���x\
© 2025 GrazzMean