+
    Bi7                     j   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIt^ RI	t	^ RI
t^ RIt^ RIt]P                  ! R4       R tR t]! ]P"                  P$                  ]P&                  P(                  4      t ! R	 R
]4      t]! ]] P2                  R7      t]! ]] P6                  R7      t]! ]] P6                  R7      t ! R R]P<                  4      t ! R R]P<                  4      t  ! R R]P<                  4      t! ! R R]P<                  4      t"]#R8X  d   ]PH                  ! 4        R# R# )    N)support)	os_helper)socket_helper)ResourceDeniednetworkc                 j    \        ^4       F  p V ! V/ VB u # 	  Xh  T d   pTp Rp?K!  Rp?ii ; i)   N)range)funcexcargskwargsielast_excs   &&*,   +/usr/lib/python3.14/test/test_urllib2net.py_retry_thricer      sF    1X	(((  N  	H	s   2-2c                    a a VV 3R  lpV# )c                  $   < \        SS.V O5/ VB # N)r   )r   r   r   r   s   *,r   wrapped(_wrap_with_retry_thrice.<locals>.wrapped   s    T38888     )r   r   r   s   ff r   _wrap_with_retry_thricer      s    9Nr   c                   :   a  ] tR t^%t o RtR tR tRR ltRtV t	R# )TransientResourcezRaise ResourceDenied if an exception is raised while the context manager
is in effect that matches the specified exception and attributes.c                    Wn         W n        R # r   )r   attrs)selfr   r   s   &&,r   __init__TransientResource.__init__*   s    
r   c                    V # r   r   r    s   &r   	__enter__TransientResource.__enter__.   s    r   Nc                    Vet   \        V P                  V4      '       dV   V P                  P                  4        F,  w  rE\	        W$4      '       g    R# \        W$4      V8w  g   K+   R# 	  \        R4      hR# R# )zIf type_ is a subclass of self.exc and value has attributes matching
self.attrs, raise ResourceDenied.  Otherwise let the exception
propagate (if any).Nz%an optional resource is not available)
issubclassr   r   itemshasattrgetattrr   )r    type_value	tracebackattr
attr_values   &&&&  r   __exit__TransientResource.__exit__1   sh     DHHe!<!<$(JJ$4$4$6 u++5':5	 %7 %%LMM "=r   )r   r   )NNN)
__name__
__module____qualname____firstlineno____doc__r!   r%   r1   __static_attributes____classdictcell____classdict__s   @r   r   r   %   s!     IN Nr   r   )errnoc                       ] tR t^FtRtRtR# )	AuthTestsz&Tests urllib2 authentication features.r   N)r3   r4   r5   r6   r7   r8   r   r   r   r>   r>   F   s    0r   r>   c                   &   a  ] tR t^mt o R tRtV tR# )CloseSocketTestc                   V P                  \        P                  P                  4       \        P
                  p\        P                  ! V4      ;_uu_ 4        \        V4      pVP                  pV P                  VP                  4       VP                  4        V P                  VP                  4       R R R 4       R #   + '       g   i     R # ; ir   )
addCleanupurllibrequest
urlcleanupr   TEST_HTTP_URLr   transient_internet_urlopen_with_retryfpassertFalseclosedclose
assertTrue)r    urlresponsesocks   &   r   
test_closeCloseSocketTest.test_closeo   s    112 ##--c22*3/H;;DT[[)NNOODKK( 3222s   AC  C	r   N)r3   r4   r5   r6   rQ   r8   r9   r:   s   @r   r@   r@   m   s     ) )r   r@   c                      a  ] tR t^}t o R t]P                  ! R4      R 4       tR tR t	]P                  ! R4      R 4       t
R t]P                  ! R4      R	 4       tRR
 ltR tRtV tR# )OtherNetworkTestsc                    R# )r   N)logging	getLogger
addHandlerStreamHandler)r    rV   loggers   &  r   setUpOtherNetworkTests.setUp~   s    r   walltimec                    R R RR\         P                  P                  3.pV P                  WP	                  4       4       R# )zftp://www.pythontest.net/READMEz*ftp://www.pythontest.net/non-existent-fileN)rC   errorURLError
_test_urls_extra_handlers)r    urlss   & r   test_ftpOtherNetworkTests.test_ftp   s?     .-96<<((* 	2245r   c                :   \         P                  p\        VR 4      p VP                  R4       VP	                  4        \
        P                  P                  \        P                  P                  V4      RR7      RR\
        P                  P                  3.pV P                  W0P                  4       RR7       \        P                  ! V4       V P!                  \"        \
        P                  P$                  R4       R#   \        P                  ! T4       i ; i)wz	hi there
T)
add_schemezfile:///nonsensename/etc/passwdN)retryz./relative_path/to/file)r   TESTFNopenwriterL   rC   rD   pathname2urlospathabspathr_   r`   ra   rb   removeassertRaises
ValueErrorurlopen)r    rj   frc   s   &   r   	test_fileOtherNetworkTests.test_file   s    !!
	GGL!GGI++BGGOOF,CPT+U2D&&(D
 OOD"6"6"8OEIIf*fnn&<&<=VW IIfs   BD Dc                <   R p\         P                  ! V4      ;_uu_ 4        \        P                  P	                  V4      p\        P                  P                  V4      pV P                  VP                  4       R 4       RRR4       R#   + '       g   i     R# ; i)z)http://www.pythontest.net/index.html#fragNr   rG   rC   rD   Requestrt   assertEqualgeturl)r    urlwith_fragreqress   &   r   test_urlwithfrag"OtherNetworkTests.test_urlwithfrag   si    B--l;;..((6C..((-CSZZ\?A <;;;   AB

B	c                <   R p\         P                  ! V4      ;_uu_ 4        \        P                  P	                  V4      p\        P                  P                  V4      pV P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)z*http://www.pythontest.net/redir/with_frag/z)http://www.pythontest.net/elsewhere/#fragNry   )r    redirect_url_with_fragr~   r   s   &   r   test_redirect_url_withfrag,OtherNetworkTests.test_redirect_url_withfrag   sm    !M--.DEE..(()?@C..((-CSZZ\?A FEEEr   c                |   \         P                  p\        P                  ! V4      ;_uu_ 4        \        P
                  P                  4       p\        P
                  P                  V4      pV P                  VP                  4       4       VP                  V4       V P                  VP                  4       4       V P                  VP                  R 4      4       VP                  RR4       VP                  V4       V P                  VP                  R 4      R4       RRR4       R#   + '       g   i     R# ; i)z
User-agentz
User-Agentz
Test-AgentN)r   rF   r   rG   rC   rD   build_openerrz   rJ   header_itemsrk   rM   
has_header
add_headerr{   
get_header)r    rN   openerrD   s   &   r   test_custom_headers%OtherNetworkTests.test_custom_headers   s    ##--c22^^002Fnn,,S1GW1134KK OOG0023OOG..|<=|L9KK W//=lK 3222s   C1D**D;	z XXX: http://www.imdb.com is gonec           	        R p\         P                  ! V4      ;_uu_ 4         \        P                  P	                  V4      ;_uu_ 4       p RRR4       V P                  X4       \        P                  P	                  V4      pVP                  4       pV P                  V4       RRR4       R#   + '       g   i     Lk; i  \         d    T P                  R4        L{i ; i  + '       g   i     R# ; i)zhttp://www.imdb.comNzOurlopen failed for site not sending                            Connection:close)	r   rG   rC   rD   rt   rM   rs   failread)r    URLr   r~   s   &   r   test_sites_no_connection_close0OtherNetworkTests.test_sites_no_connection_close   s    
 $--c22%^^++C00C 1 $..((-C((*COOC  3200 .		 - ..	 322sG   C$'C
B/	CAC$/B?:CC!C$ C!!C$$C5	c                   ^ RI p^ RIpVP                  R4      P                  p\        P
                  P                  ! V!  P                  pV'       d%   \        V\        P                  P                  4      pV EF  pV P                  VR7      ;_uu_ 4        \        V\        4      '       d   Vw  rp
MR;r\        P                  ! V4      ;_uu_ 4         V! W\         P"                  4      p \$        ;_uu_ 4        \&        ;_uu_ 4        \(        ;_uu_ 4        VP+                  4       pV! R\-        V4      ,          4       RRR4       RRR4       RRR4       TP7                  4        RRR4       TP?                  R4       RRR4       EK  	  R#   + '       g   i     LX; i  + '       g   i     Lc; i  + '       g   i     Ln; i  \.         d&    \1        RT,          \2        P4                  R7        Li ; i  \8         dE   pT
'       d7   RT
: RT: R	T	: R
\;        T4      : RT: 2
pT P=                  YT4        Rp?Lh Rp?ii ; i  + '       g   i     L; i  + '       g   i     EK  ; i)r   Ntest_urllib2)rN   zread %d bytesz<timeout: %s>)filezDidn't get expected error(s) z for  z, got z: g?) timerV   rW   debugrC   rD   r   rk   r   r_   r`   subTest
isinstancetupler   rG   r   INTERNET_TIMEOUTtime_outsocket_peer_resetioerror_peer_resetr   lenTimeoutErrorprintsysstderrrL   OSErrortypeassertIsInstancesleep)r    rc   handlersri   r   rV   r   rt   rN   r~   expected_errru   buferrmsgs   &&&&           r   ra   OtherNetworkTests._test_urls   s   !!.177..--x8==-gv||7L7LMGC#&&c5))-0*Cl)--C"55c::"#Cg.F.FGJ!)!2!2!3!3&'ffh %oC&@ A "4 "3 "* 	) ;* 

37 '& , "4!3 "3!2 "*
  , J!/C"7cjjIJ # "'<$0#sDIs$LC 11#SII!"	 ;: '&&s   >I&IH
0G
>F;F()FF(F;G
I-I&F% F((F83F;;GG

IG
-G>;I=G>>II9II
IIII#I&&I8c                    . p\         P                  P                  4       pV P                  VP                  4       VP                  ^4       VP                  V4       V# )   )rC   rD   CacheFTPHandlerrB   clear_cache
setTimeoutappend)r    r   cfhs   &  r   rb   !OtherNetworkTests._extra_handlers  sF    nn,,.(qr   r   N)T)r3   r4   r5   r6   r[   r   requires_resourcerd   rv   r   r   r   unittestskipr   ra   rb   r8   r9   r:   s   @r   rT   rT   }   s     7 z*6 +6XZA z*A +AL ]]56! 7!(% N r   rT   c                      a  ] tR tRt o R tR tR tR tR tRt	]
P                  ! R4      R	 4       tR
 t]
P                  ! R4      R 4       t]
P                  ! R4      R 4       tRtV tR# )TimeoutTesti$  c                X    V P                  \        P                  P                  4       R # r   )rB   rC   rD   rE   r$   s   &r   r[   TimeoutTest.setUp%  s    112r   c                   V P                  \        P                  ! 4       4       \        P                  p\
        P                  ! VR R7      ;_uu_ 4        \        V4      pV P                  VP                  4       V P                  VP                  P                  P                  P                  4       4       R R R 4       R #   + '       g   i     R # ; iNtimeout)assertIsNonesocketgetdefaulttimeoutr   rF   r   rG   rH   rB   rL   rI   raw_sock
gettimeoutr    rN   us   &  r   test_http_basicTimeoutTest.test_http_basic)  s    &2245##--c4@@#C(AOOAGG$addhhnn779: A@@@s   A$CC	c                <   V P                  \        P                  ! 4       4       \        P                  p\
        P                  ! V4      ;_uu_ 4        \        P                  ! ^<4        \        V4      pV P                  VP                  4       \        P                  ! R4       V P                  VP                  P                  P                  P                  4       ^<4       RRR4       R#   \        P                  ! R4       i ; i  + '       g   i     R# ; i<   N)r   r   r   r   rF   r   rG   setdefaulttimeoutrH   rB   rL   r{   rI   r   r   r   r   s   &  r   test_http_default_timeout%TimeoutTest.test_http_default_timeout1  s    &2245##--c22$$R(/',(((.QTTXX^^668"= 32 ((. 322s%   D
+&C/AD
/DD

D	c                >   V P                  \        P                  ! 4       4       \        P                  p\
        P                  ! V4      ;_uu_ 4        \        P                  ! ^<4        \        VRR7      pV P                  VP                  4       \        P                  ! R4       V P                  VP                  P                  P                  P                  4       4       RRR4       R#   \        P                  ! R4       i ; i  + '       g   i     R# ; ir   Nr   )r   r   r   r   rF   r   rG   r   rH   rB   rL   rI   r   r   r   r   s   &  r   test_http_no_timeout TimeoutTest.test_http_no_timeout=  s    &2245##--c22$$R(/'T:(((.addhhnn779: 32 ((. 322s%   D+(C0AD0DDD	c                h   \         P                  p\        P                  ! V4      ;_uu_ 4        \	        V^xR7      pV P                  VP                  4       V P                  VP                  P                  P                  P                  4       ^x4       RRR4       R#   + '       g   i     R# ; i)x   r   N)r   rF   r   rG   rH   rB   rL   r{   rI   r   r   r   r   s   &  r   test_http_timeoutTimeoutTest.test_http_timeoutI  sn    ##--c22#C5AOOAGG$QTTXX^^668#> 3222s   A'B  B1	zftp://www.pythontest.net/r]   c                   V P                  \        P                  ! 4       4       \        P                  ! V P
                  R R7      ;_uu_ 4        \        V P
                  4      pV P                  VP                  4       V P                  VP                  P                  P                  P                  P                  4       4       R R R 4       R #   + '       g   i     R # ; ir   )r   r   r   r   rG   FTP_HOSTrH   rB   rL   rI   r   r   r   r    r   s   & r   test_ftp_basicTimeoutTest.test_ftp_basicR  s    &2245--dmmTJJ#DMM2AOOAGG$addggkk//::<= KJJJs   A8CC"	c                X   V P                  \        P                  ! 4       4       \        P                  ! V P
                  4      ;_uu_ 4        \        P                  ! ^<4        \        V P
                  4      pV P                  VP                  4       \        P                  ! R4       V P                  VP                  P                  P                  P                  P                  4       ^<4       RRR4       R#   \        P                  ! R4       i ; i  + '       g   i     R# ; ir   )r   r   r   r   rG   r   r   rH   rB   rL   r{   rI   r   r   r   r   s   & r   test_ftp_default_timeout$TimeoutTest.test_ftp_default_timeoutZ  s    &2245--dmm<<$$R(/'6(((.QTTWW[[..99;R@ =< ((. =<<s%   D%0C=AD=DDD)	c                Z   V P                  \        P                  ! 4       4       \        P                  ! V P
                  4      ;_uu_ 4        \        P                  ! ^<4        \        V P
                  RR7      pV P                  VP                  4       \        P                  ! R4       V P                  VP                  P                  P                  P                  P                  4       4       RRR4       R#   \        P                  ! R4       i ; i  + '       g   i     R# ; ir   )r   r   r   r   rG   r   r   rH   rB   rL   rI   r   r   r   r   s   & r   test_ftp_no_timeoutTimeoutTest.test_ftp_no_timeoute  s    &2245--dmm<<$$R(/'tD(((.addggkk//::<= =< ((. =<<s%   D%2C>AD>DDD*	c                   \         P                  ! V P                  4      ;_uu_ 4        \        V P                  ^<R7      pV P	                  VP
                  4       V P                  VP                  P                  P                  P                  P                  4       ^<4       RRR4       R#   + '       g   i     R# ; i)r   r   N)r   rG   r   rH   rB   rL   r{   rI   r   r   r   r   s   & r   test_ftp_timeoutTimeoutTest.test_ftp_timeoutq  sq    --dmm<<#DMM2>AOOAGG$QTTWW[[..99;R@ =<<<s   A;B..B?	r   N)r3   r4   r5   r6   r[   r   r   r   r   r   r   r   r   r   r   r   r8   r9   r:   s   @r   r   r   $  s     3;
>
;? +Hz*> +>	A z*	> +	> z*A +Ar   r   __main__)%r<   r   testr   test.supportr   r   r   rn   r   urllib.errorrC   urllib.requestr   requiresr   r   rD   rt   r_   r`   rH   objectr   r   	ETIMEDOUTr   
ECONNRESETr   r   TestCaser>   r@   rT   r   r3   mainr   r   r   <module>r      s      " & ' 	    
     .fnn.D.D.4ll.C.CE N N8 WEOO<%gU5E5EF &we6F6FG 1!! 1N)h'' ) d)) dNRA(## RAj zMMO r   