tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
R\¬Qc@sCddlZddlmZddlZddlZddlZddlZddlmZmZdej    fd„ƒYZ
d„Z d„Z d„Z d    „Zd
fd „ƒYZd fd „ƒYZdefd„ƒYZdejfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZd„Zd„Zdejfd„ƒYZd ejfd!„ƒYZd"fd#„ƒYZd$ej    fd%„ƒYZ d&„Z!d'ej    fd(„ƒYZ"d)ej    fd*„ƒYZ#d+ej    fd,„ƒYZ$e%d-„Z&e'd.kr?e&d/e(ƒndS(0iÿÿÿÿN(t test_support(tRequesttOpenerDirectort TrivialTestscBseZd„Zd„ZRS(cCsÎ|jttjdƒtjjtjƒjddƒ}tj    dkrddl
}tj |ƒ}|j |j ddƒƒ}ntj    dkr›d    |}n
d
|}tj|ƒ}|jƒ}|jƒdS( Ns    bogus urls\t/triscosiÿÿÿÿs/.s./tnts
file:///%ss    file://%s(t assertRaisest
ValueErrorturllib2turlopentostpathtabspatht__file__treplacetnametstringtexpandt    translatet    maketranstreadtclose(tselftfnameRtfile_urltftbuf((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_trivials!  
 c
Cs‹ddddgfdddgfdddd    d
d d 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"(t assertEqualR    tparse_http_list(RttestsRtlist((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_parse_http_list*s (t__name__t
__module__RR'(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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((((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_request_headers_dict3scCsdS(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((((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_request_headers_methodsQscCsdS(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((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_password_managerrs>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((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt"test_password_manager_default_port³st
MockOpenercBs)eZgZdejd„Zd„ZRS(cCs!||||_|_|_dS(N(treqtdatattimeout(RR/R0R1((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytopenäscGs|||_|_dS(N(tprototargs(RR3R4((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyterroræsN(R(R)t
addheaderstNonetsockett_GLOBAL_DEFAULT_TIMEOUTR2R5(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR.âstMockFilecBs)eZdd„Zdd„Zd„ZRS(cCsdS(N((Rtcount((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRêscCsdS(N((RR;((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytreadlineëscCsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRìsN(R(R)R7RR<R(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR:és  t MockHeaderscBseZd„ZRS(cCs
|jƒS(N(tvalues(RR((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt
getheadersïs(R(R)R?(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR=îst MockResponsecBs&eZdd„Zd„Zd„ZRS(cCsAtjj||ƒ||||f\|_|_|_|_dS(N(tStringIOt__init__tcodetmsgtheadersturl(RRCRDRER0RF((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBóscCs|jS(N(RE(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytinfoöscCs|jS(N(RF(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytgeturløsN(R(R)R7RBRGRH(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR@òs     t MockCookieJarcBseZd„Zd„ZRS(cCs ||_dS(N(tach_req(Rtrequest((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytadd_cookie_headerüscCs|||_|_dS(N(tec_reqtec_r(RtresponseRK((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytextract_cookiesþs(R(R)RLRP(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRIûs    t
FakeMethodcBseZd„Zd„ZRS(cCs||_||_||_dS(N(t    meth_namethandletaction(RRRRTRS((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBs        cGs|j|j|j|ŒS(N(RSRRRT(RR4((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt__call__s(R(R)RBRU(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRQs    tMockHTTPResponsecBseZd„Zd„ZRS(cCs(||_||_||_||_dS(N(tfpRDtstatustreason(RRWRDRXRY((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRB
s            cCsdS(Nt((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRs(R(R)RBR(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRV    s    t MockHTTPClasscBsYeZd„Zejd„Zd„Zddd„Zddd„Z    d„Z
d„Z RS(cCs(g|_d|_t|_i|_dS(N(t req_headersR7R0tFalsetraise_on_endheaderst_tunnel_headers(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBs            cCs||_||_|S(N(thostR1(RR`R1((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRUs        cCs ||_dS(N(tlevel(RRa((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytset_debuglevelscCs5||_||_|r$||_n |jjƒdS(N(t _tunnel_hostt _tunnel_portR_tclear(RR`tportRE((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt
set_tunnel!s
         cCs}||_||_|dk    r6|j|jƒ7_n|jjƒ|rU||_n|jryddl}|j    ƒ‚ndS(Niÿÿÿÿ(
tmethodtselectorR7R\titemstsortR0R^R8R5(RRhRFtbodyRER8((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRK)s                cCsttƒiddƒS(NiÈtOK(RVR:(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt getresponse5scCsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR8sN( R(R)RBR8R9RURbR7RgRKRnR(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR[s            t MockHandlercBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(iôcCs|j|ƒdS(N(t_define_methods(Rtmethods((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRB?scCskxd|D]\}t|ƒdkr.|\}}n |d}}t|||jƒ}t|j||ƒqWdS(Ni(tlenR7RQRStsetattrt    __class__(RRqtspecRRTtmeth((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRpAs   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 krt j dƒ‚nt s&t‚dS(Ns return selfsreturn responseiÈRmRZsreturn requests http://blah/R5t ithttpitraisetblah(tparenttcallstappendR7R@Rt
startswithtrfindtintRR5R    tURLErrorR]tAssertionError(Rtfn_nameRTR4tkwdstresRC((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRSGs*    
 # cCsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR]scCs||_g|j_dS(N(R{R|(RR{((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt
add_parent^s    cCs#t|dƒstS|j|jkS(Nt handler_order(thasattrtTrueR‡(Rtother((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt__lt__as(    R(R)R‡RBRpRSRR†R‹(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRo;s                    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((R(R)(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRŒ}si(RoR‡R†R}t add_handler(topenert    meth_specthandlersR;tmethsRŒR"((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytadd_ordered_mock_handlersgs   
 cGs+tƒ}x|D]}|j|ƒqW|S(N(RR(thandler_instancesRŽR"((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytbuild_test_opener†s     tMockHTTPHandlercBs#eZd„Zd„Zd„ZRS(cCs ||_||_|jƒdS(N(RCREtreset(RRCRE((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBs        cCsd|_g|_dS(Ni(t_counttrequests(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR–”s    cCs÷ddl}ddl}ddl}ddlm}|jj|j|ƒƒ|jdkr¹|jd|_|j|j    }|j
||j ƒƒ}|j j d|tƒ|j    ||ƒS||_|j
|dƒƒ}tdd|d    |jƒƒSdS(
Niÿÿÿÿ(RAiiRxs
 
iÈRmRZ(t    mimetoolsthttplibtcopyRAR˜R}tdeepcopyR—t    responsesRCtMessageRER{R5R:R/R@t get_full_url(RR/R™RšR›RARRD((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt    http_open—s$        (R(R)RBR–R (((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR•Œs        tMockHTTPSHandlercBseZd„Zd„ZRS(cCs tjj|ƒtƒ|_dS(N(R    tAbstractHTTPHandlerRBR[thttpconn(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBªscCs|j|j|ƒS(N(tdo_openR£(RR/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt
https_open®s(R(R)RBR¥(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR¡¦s    tMockPasswordManagercBseZd„Zd„ZRS(cCs(||_||_||_||_dS(N(trealmRFtusertpassword(RR§turiR¨R©((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt add_password²s            cCs"||_||_|j|jfS(N(t target_realmt
target_urlR¨R©(RR§tauthuri((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytfind_user_password·s        (R(R)R«R¯(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR¦±s    tOpenerDirectorTestscBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs6dtfd„ƒY}|jttƒj|ƒƒdS(Nt
NonHandlercBseZRS((R(R)(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR±Às(tobjectRt    TypeErrorRR(RR±((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_add_non_handler¿s    cCsddlm}tƒ}d d gd gg}t||ƒ}|jtjƒƒx(dD] }|j||j|d
ƒqWWdS(Niÿÿÿÿ(RR¤s return selft
proxy_opentredirect_requesttdotproxytredirects://example.com/(sdo_opens return self(Rµs return self(R¶s return self(R·sproxysredirect(R    RRR’RtUnknownHandlerRR2(RRtoRRtscheme((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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_302s return selfshttp://example.com/ii(s    http_opens return self(s    http_opens return self(RR’RR2R#tzipR|( RR»RRR/trR|texpectedtgotthandlerRR4R„((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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 s return selfiôiRŒcBseZRS((R(R)(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRŒûsshttp://example.com/i(s    http_opens return self(RRoR‡R}RR2R#R|(RR»RR‘R‡RŒR"RÁ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_handler_orderôs           cCs|tƒ}dgdgg}t||ƒ}tdƒ}|jtj|j|ƒ|j|j|dd|fifgƒdS(NR Rys return selfshttp://example.com/i(s    http_opensraise(s    http_opens return self(    RR’RRR    RR2R#R|(RR»RRR/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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_400RyR¿sreturn responsethttp_error_303t
http_errortUnknowncBseZd„ZRS(cSstS(N(R‰(RRŠ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt__eq__%s(R(R)RÌ(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRË$sshttp://example.com/iii.RZ(s    http_opens    error 302(RÈsraise(shttp_error_302sreturn response((    RR’RR2RrR|R‚RÀR#( RR»RRRËR/RÁR|RÂRÃRÄt method_nameR4((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_http_errors$          
c Csvtƒ}d    d
gd d 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ƒ|j    |
ddkpjt |
dt ƒƒq•WdS( Nt http_requestsreturn requestt http_responsesreturn responseshttp://example.com/iii(s http_requestsreturn request(s http_responsesreturn response(s http_requestsreturn request(s http_responsesreturn response( RR’RR2t    enumerateR|R#RrtassertIsInstancet
assertTrueR7t
isinstanceR@( RR»RRR/RÁR|tiRÄRR4R„((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_processors2s(       ( (    R(R)R´R½RÅRÆRÇRÎRÖ(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR°½s                        cCsJddl}|j|ƒ}tjdkrF|jdƒrF|d}n|S(NiÿÿÿÿRs///i(turllibt pathname2urlR RR~(R R×turlpath((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytsanepathname2urlVs
  t HandlerTestscBsÈeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „Zd„Zdd„Zd„Zd„Zd„Zd„Zd„ZRS(csnddd„ƒY‰dtjf‡fd†ƒY}ddl}d}||ƒ}tƒ}|_xdd|jd    d    d
d d gd df    dd|jdd    d
d d gd df    dd|jdd    d
d d gd df    dd|jdd    d
d d gd df    dddd    d    dd d 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(R0(RR0((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBbscSs2|||_|_tj|jƒt|jƒfS(N(tfilenametfiletypeRAR0Rr(RRÝRÞ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytretrfilecscSsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRfs(R(R)RBRßR(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRÜas        tNullFTPHandlercs&eZd„Zej‡fd†ZRS(cSs ||_dS(N(R0(RR0((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBiscsH|||_|_|||_|_||_ˆ|jƒ|_|jS(N(R¨tpasswdR`RftdirsR0t
ftpwrapper(RR¨RáR`RfRâR1(RÜ(sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt connect_ftpjs
    (R(R)RBR8R9Rä((RÜ(sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRàhs    iÿÿÿÿsrheum rhaponicums ftp://localhost/foo/bar/baz.htmlt    localhostRZtItfootbarsbaz.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_PORTR7RR1R¾R#R¨RáR`R8t gethostbynameRfRâRãRÝRÞRGtgetR€Rr(RRàRíR0R"R»RFR`RfR¨Ráttype_RâRÝtmimetypeR/RÁRE((RÜsY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_ftp`sL
 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|d d ƒ|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://%ss file://%s%sRåRZtwbs 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(&trfc822R8R    t FileHandlerR.R{RtTESTFNRÚR R R Rït gethostnametgaierrorR}R2twriteRt    file_openRRRGRHtstatt
formatdatetst_mtimetremoveR#tgetcwdRRR‰R]tOSErrorRÓR/ttype(RR÷R8R"R»RùRÙttowriteturlst    localaddrRFRRÁR0REtrespurltstatstmodifiedRöR/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt    test_filešs„     
                         c Cs!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/tGETtPOSTRzRètFootSpamteggsiÈRms example.comiRt
ConnectionRRZsContent-lengths Content-typet0s!application/x-www-form-urlencodedtHostRçtbaz(R N(R sblah(Rsclose(Rsbar(RR(RR(RZN("R    R¢R.R{R7RR1tadd_unredirected_headerR[R¤RR<RGRHRCRDRðthas_keyR#R`RaRhRiR\R0R‰R^RRR6R@t do_request_t assertNotIntunredirected_hdrs( RR"R»RFRhR0R/RxRÁthdrstnewreq((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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(    NRZs#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.htmlRs example.comssomeproxy:3128(
R    R¢R.R{RRR#Rt    set_proxyR7(    RR"R»R0tds_urlstds_urltds_reqt    np_ds_reqtp_ds_req((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_http_doubleslash5s      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.orgRZ(    R    R¢R.R{RRR#tget_hostt get_selector(RR"R»t    weird_urlR/Rturl_without_path((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_fixpath_in_weirdurlsOs   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
d id|ƒ}|j|j||ƒdkƒ|j
|j d ƒ|j
|j ||d
d ifƒdS( Nshttp://example.com/iÈRmRZR3iÊtAcceptediÎsPartial contentiös Bad gatewayRx( R    tHTTPErrorProcessorR.R{RR@RÐRÓRˆR7R#R3R4(RR"R»RFR/RÁtnewr((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_errorsbs(  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ÈRmRZs example.com(RIR    tHTTPCookieProcessorR.R{RR@RÏRÓRJR#tget_origin_req_hosttis_unverifiableRÐRMRN(RtcjR"R»R/RÁRR+((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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«|jd t t |ƒƒƒn|j d d ƒy*||tƒ|dti|d6ƒƒWn3tjk
r|j|dko|dk    ƒnX|j|jjƒ|ƒy|j|jjƒdƒWn(tk
r{|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]Wn*tjk
r§|j| tjjƒnXt|ddƒ}d} tj    |_
y(x!| ||d| ƒ| d} qÒWn*tjk
r |j| tjjƒnXdS(Nshttp://example.com/a.htmlshttp://example.com/b.htmli-i.i/i3s
blah
blah
s http_error_%stNonsensesviking=withholdsContent-LengthRtspamtBlahtlocationR scontent-lengths content-typec    Ss-|j|tƒddti|d6ƒƒdS(Ni.R4R5(R¿R:R=(R"R/RF((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR¹´storigin_req_hosts example.comishttp://example.com/ishttp://example.com/%d(i-i.i/i3(Ns
blah
blah
(R    tHTTPRedirectHandlerR.R{R7tgetattrRt
add_headerR8R9R1tstrRrRR:R=t    HTTPErrorRÓR#R/RŸt
get_methodtAttributeErrorthas_dataREtlowerRRt max_repeatstmax_redirections( Rtfrom_urltto_urlR"R»RCR0RhR/txRER¹R;((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_redirectŠsh     # %         c Csd}dddg}dddg}d}tjƒ}tƒ}|_t|ƒ}tj|_xQ|D]I}|d    |}    |jtj    |j
|t ƒd
d t i|    d 6ƒƒqeWx^|D]V}|d    |}
|j
|t ƒd
d t i|
d 6ƒƒ|j |jjƒ|
ƒq¹WdS(Nshttp://example.com/a.htmlRxthttpsRötfiletimaptldapsexample.com/b.htmls://i.sSecurity LoopholeR5s That's fine(R    R7R.R{RR8R9R1RR;R¿R:R=R#R/RŸ( RRBt valid_schemestinvalid_schemestschemeless_urlR"R»R/R¼t invalid_urlt    valid_url((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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    cookielibRPttest.test_cookielibRQR•R    tHTTPDefaultErrorHandlerR7R-R”R2RÓR/t
has_header(    RRPRQR0thhthdehthrhtcpR»((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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    RUR7R”R2R#RHtstrip(Rtredirected_urlRWRXRYR»RW((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_redirect_fragmentøs  cCsÎtƒ}tjtddƒƒ}|j|ƒd    gg}t||ƒ}tdƒ}|j|jƒdƒ|j    |ƒ}|j|jƒdƒ|j|ddfgg|j
D]}|dd!^q°ƒdS(
NRxsproxy.example.com:3128R sreturn responseshttp://acme.example.com/sacme.example.comii(s    http_opensreturn response( RR    t ProxyHandlertdictRR’RR#R$R2R|(RR»tphRRR/RÁttup((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt
test_proxys       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_proxyRxsproxy.example.comshttp://www.perl.org/s www.perl.orgshttp://www.python.orgswww.python.org( R tenvironRR    R_R`RRR#R$R2(RR»RaR/RÁ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_proxy_no_proxys        cCsÎtƒ}tjtddƒƒ}|j|ƒd    gg}t||ƒ}tdƒ}|j|jƒdƒ|j    |ƒ}|j|jƒdƒ|j|ddfgg|j
D]}|dd!^q°ƒdS(
NRFsproxy.example.com:3128R¥sreturn responseshttps://www.example.com/swww.example.comii(s
https_opensreturn response( RR    R_R`RR’RR#R$R2R|(RR»RaRRR/RÁRb((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_proxy_https"s       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( NRFsproxy.example.com:3128shttps://www.example.com/sProxy-AuthorizationtFooBars
User-AgenttGrailswww.example.comsProxy-authorization(sProxy-AuthorizationRh(s
User-AgentRi(RR    R_R`RR¡RR9R#R$t assertIsNoneRcR2RR£R\tassertIntassertIsNotNonet
get_header(RR»Rat https_handlerR/RÁ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt$test_proxy_https_proxy_authorization1s$                     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((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_basic_authHs              cCs|jddƒdS(NRtt'(Rx(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt(test_basic_auth_with_single_quoted_realmXsc 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 unquotedRqs!http://acme.example.com/protected(
RR¦R    RrR•RRtcheck_warningst UserWarningRs(RRŽRuRvR§RwRD((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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(NRxsproxy.example.com:3128s ACME Networksi—s(Proxy-Authenticate: Basic realm="%s"
 
sProxy-authorizations&http://acme.example.com:3128/protected(    RR    R_R`RR¦tProxyBasicAuthHandlerR•Rs(RRŽRaRuRvR§Rw((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_proxy_basic_authms               c
   Csõdtfd„ƒY}dtjfd„ƒY}dtjfd„ƒY}|ƒ}tƒ}||ƒ}||ƒ}d}tdd    |ƒ}    |j|ƒ|j|ƒ|j|    ƒ|j||d
||    |d d ƒ|j|j    d d gdƒdS(NtRecordingOpenerDirectorcBseZd„Zd„ZRS(cSstj|ƒg|_dS(N(RRBtrecorded(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRBˆs cSs|jj|ƒdS(N(RR}(RRG((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytrecord‹s(R(R)RBR‚(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR€‡s    tTestDigestAuthHandlercBseZd„ZRS(c_s*|jjdƒtjj|||ŽdS(Ntdigest(R{R‚R    tHTTPDigestAuthHandlerthttp_error_401(RR4R„((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR†Žs (R(R)R†(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRƒstTestBasicAuthHandlercBseZd„ZRS(c_s*|jjdƒtjj|||ŽdS(Ntbasic(R{R‚R    RrR†(RR4R„((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR†“s (R(R)R†(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR‡’ss ACME Networksi‘s&WWW-Authenticate: Basic realm="%s"
 
Rqs!http://acme.example.com/protectedR„Rˆi(
RR    R…RrR¦R•RRsR#R(
RR€RƒR‡RŽRutdigest_handlert basic_handlerR§Rw((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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 |j dj |ƒƒd|
| f} d|    j| ƒjƒ}|j|j dj|ƒ|ƒ|j|j dj||ƒd|_|_|jƒ|j|ƒ} |jt
|j ƒdƒ|j |j dj |ƒƒdS(
Niÿÿÿÿtwiletcoyoteiis%s:%ssBasic i(RŒR(tbase64R«R#R§RFR¨R©R2R¬R­RrR˜t assertFalseRVt encodestringR\RmRR7R–(RRŽRvt auth_headerR§RwRut request_urlt protected_urlRŽR¨R©RÁtuserpasstauth_hdr_value((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRs­s.  
(R(R)RóR RR#R(R,R1REROR[R^RcRfRgRoRxRzR}RR‹Rs(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRÛ^s*    :    ]    >                    H                                                 /t    MiscTestscBseZd„Zd„ZRS(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((R(R)(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR—Ôst
FooHandlercBseZd„ZRS(cSsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytfoo_openÖs(R(R)R™(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR˜Õst
BarHandlercBseZd„ZRS(cSsdS(N((R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytbar_openØs(R(R)R›(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRš×stMyOtherHTTPHandlercBseZRS((R(R)(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRœós(R    t HTTPHandlert BaseHandlert build_openertopener_has_handler(RR—R˜RšRŸR»Rœ((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_build_openerÓs,         cCs8x1|jD]}|j|kr
Pq
q
W|jtƒdS(N(RRtRÓR](RRŽt handler_classR"((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR øs(R(R)R¡R (((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR–Ñs    %t RequestTestscBs}eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „ZRS( cCs8tjdƒ|_tjdddidd6ƒ|_dS(Nshttp://www.python.org/~jeremy/R0REttestsX-Test(R    RRðtpost(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pytsetUps    cCs6|jd|jjƒƒ|jd|jjƒƒdS(NR R (R#R¥R<Rð(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_methodscCss|j|jjƒ ƒ|jd|jjƒƒ|jjdƒ|j|jjƒƒ|jd|jjƒƒdS(NR R3R (RÓRðR>R#R<tadd_data(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_add_data s
cCs|jd|jjƒƒdS(Nshttp://www.python.org/~jeremy/(R#RðRŸ(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_selectorscCs|jd|jjƒƒdS(NRx(R#Rðtget_type(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_get_typescCs|jd|jjƒƒdS(Nswww.python.org(R#RðR$(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt test_get_hostscCs)tjdƒ}|jd|jƒƒdS(Nshttp://www.%70ython.org/swww.python.org(R    RR#R$(RR/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_get_host_unquote!scCsv|j|jjƒ ƒ|jjddƒ|j|jjƒƒ|jd|jjƒƒ|jd|jjƒƒdS(Ns www.perl.orgRxswww.python.org(RÓRðt    has_proxyRR#R.R$(R((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyRc%s
cCs&tdƒ}|jd|jƒƒdS(Ns<URL:http://www.python.org>swww.python.org(RR#R$(RR/((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/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/RF((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_url_fragment0s   cCsdS(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((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_HTTPError_interface;sc CsÈtjdddd dd dddd ƒ}|jt|dƒƒt|dƒsUt‚t|d    ƒsjt‚t|jƒst‚y|jƒWntk
r­|j    d
ƒnX|j
|jƒdƒd S( s]
        Issue 15701= - HTTPError interface has info method available from URLError.
        RDssomething bad happenedRFRCRsContent-Length:42RWRYRGserr.info() failedN( R    R;R7RÓRˆR‚tcallableRGR=tfailR#(Rterr((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyttest_HTTPError_interface_callFs (R(R)R¦R§R©RªR«R­R®R¯RcR±R²R³R·(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyR£ÿs                                                 cCsVddlm}tj||ƒtjt|ƒttttt    f}tj
|ŒdS(Niÿÿÿÿ(t test_urllib2( R¤R¸Rt run_doctestR    RR°RÛR–R£t run_unittest(tverboseR¸R%((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt    test_mainVs    t__main__R»()tunittestR¤RR R8RAR    RRtTestCaseRR*R+R,R-R.R:R`R=R@RIRQRVR[RoR’R”RžR•R¢R¡R¦R°RÚRÛR–R£R7R¼R(R‰(((sY/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_urllib2.pyt<module>sF     #        !    A    /        ),          ™    ÿÿu.W