b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/urllib2.pyc
Size44.74 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:30
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@sþdZddkZddkZddkZddkZddkZddkZddkZddkZddk Z ddk
Z
ddk Z ddk Z ddk
Z
yddklZWn#ej
oddklZnXddklZlZlZlZlZlZlZlZlZlZlZlZddklZlZl Z l!Z!e
i"d Z#da%de i&d�Z'd�Z(d e)fd
��YZ*d e*efd ��YZ+ei,d
�Z-d�Z.ddCd��YZ/ddDd��YZ0d�Z1ddEd��YZ2de2fd��YZ3de2fd��YZ4de2fd��YZ5d�Z6de2fd��YZ7ddFd ��YZ8d!e8fd"��YZ9d#dGd$��YZ:d%e:e2fd&��YZ;d'e:e2fd(��YZ<d)�Z=d*dHd+��YZ>d,e2e>fd-��YZ?d.e2e>fd/��YZ@d0e2fd1��YZAd2eAfd3��YZBeCed4�od5eAfd6��YZDnd7e2fd8��YZEd9e2fd:��YZFd;�ZGd<�ZHd=e2fd>��YZId?e2fd@��YZJdAeJfdB��YZKdS(Is! An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below). It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirector manages a collection of Handler objects that do
all the actual work. Each Handler implements a particular protocol or
option. The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL. For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns. The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
urllib. pass the url and optionally data to post to an HTTP URL, and
get a file-like object back. One difference is that you can also pass
a Request instance instead of URL. Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers. Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate. If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- Installs a new opener as the default opener.

objects of interest:

OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request. The
state can be as simple as the URL. It can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

exceptions:
URLError -- A subclass of IOError, individual protocols have their own
specific subclass.

HTTPError -- Also a valid HTTP response, so you can treat an HTTP error
as an exceptional event or valid response.

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib2

# set up authentication info
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
uri='https://mahler:8092/site-updates.py',
user='klem',
passwd='geheim$parole')

proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler)

# install it
urllib2.install_opener(opener)

f = urllib2.urlopen('http://www.python.org/')


iÿÿÿÿN(tStringIO( tunwraptunquotet splittypet splithosttquotet
addinfourlt splitportt splitattrt
ftpwrappert splitusert splitpasswdt
splitvalue(t localhostt url2pathnamet
getproxiest proxy_bypassicCs-tdjo
t�anti|||�S(N(t_openertNonet build_openertopen(turltdatattimeout((s/usr/lib64/python2.6/urllib2.pyturlopenzs

cCs
|adS(N(R(topener((s/usr/lib64/python2.6/urllib2.pytinstall_opener�stURLErrorcBseZd�Zd�ZRS(cCs|f|_||_dS(N(targstreason(tselfR((s/usr/lib64/python2.6/urllib2.pyt__init__�s cCs d|iS(Ns<urlopen error %s>(R(R((s/usr/lib64/python2.6/urllib2.pyt__str__�s(t__name__t
__module__RR (((s/usr/lib64/python2.6/urllib2.pyR�s t HTTPErrorcBs)eZdZeiZd�Zd�ZRS(sBRaised when HTTP error occurs, but also acts like non-error returncCsX||_||_||_||_||_|dj o|i||||�ndS(N(tcodetmsgthdrstfptfilenameRt_HTTPError__super_init(RRR$R%R&R'((s/usr/lib64/python2.6/urllib2.pyR�s     
cCsd|i|ifS(NsHTTP Error %s: %s(R$R%(R((s/usr/lib64/python2.6/urllib2.pyR ¦s(R!R"t__doc__RRR)R (((s/usr/lib64/python2.6/urllib2.pyR#�s 
s:\d+$cCsa|i�}ti|�d}|djo|idd�}ntid|d�}|i�S(s�Return request-host, as defined by RFC 2965.

Variation from RFC: returned value is lowercased, for convenient
comparison.

ittHost(t get_full_urlturlparset
get_headert _cut_port_retsubtlower(trequestRthost((s/usr/lib64/python2.6/urllib2.pyt request_host«s  
tRequestcBsÂeZdhded�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Z d�Z d �Z
d
�Zd �Zd �Zd
�Zd�Zd�Zd�Zdd�Zd�ZRS(cCs®t|�|_d|_d|_d|_d|_||_h|_x*|i �D]\}}|i
||�qRWh|_ |djot |�}n||_
||_dS(N(Rt_Request__originalRttypeR4tportt _tunnel_hostRtheaderstitemst
add_headertunredirected_hdrsR5torigin_req_hostt unverifiable(RRRR;R?R@tkeytvalue((s/usr/lib64/python2.6/urllib2.pyR½s      
 
 cCsb|d djoD|d}ttd|�o"t|d|��t||�Snt|�dS(Ni t _Request__r_tget_(thasattrR6tgetattrtAttributeError(Rtattrtname((s/usr/lib64/python2.6/urllib2.pyt __getattr__Ðs 
cCs|i�odSdSdS(NtPOSTtGET(thas_data(R((s/usr/lib64/python2.6/urllib2.pyt
get_methodÜs
cCs
||_dS(N(R(RR((s/usr/lib64/python2.6/urllib2.pytadd_dataäscCs
|idj S(N(RR(R((s/usr/lib64/python2.6/urllib2.pyRMçscCs|iS(N(R(R((s/usr/lib64/python2.6/urllib2.pytget_dataêscCs|iS(N(R7(R((s/usr/lib64/python2.6/urllib2.pyR-íscCsZ|idjoCt|i�\|_|_|idjotd|i�qSn|iS(Nsunknown url type: %s(R8RRR7t_Request__r_typet
ValueError(R((s/usr/lib64/python2.6/urllib2.pytget_typeðs
cCsV|idjo?t|i�\|_|_|iot|i�|_qOn|iS(N(R4RRRQt_Request__r_hostR(R((s/usr/lib64/python2.6/urllib2.pytget_host÷s

cCs|iS(N(RT(R((s/usr/lib64/python2.6/urllib2.pyt get_selectorþscCsM|idjo|i o|i|_n||_|i|_||_dS(Nthttps(R8R:R4R7RT(RR4R8((s/usr/lib64/python2.6/urllib2.pyt set_proxys
  cCs|i|ijS(N(RTR7(R((s/usr/lib64/python2.6/urllib2.pyt has_proxy
scCs|iS(N(R?(R((s/usr/lib64/python2.6/urllib2.pytget_origin_req_host
scCs|iS(N(R@(R((s/usr/lib64/python2.6/urllib2.pytis_unverifiablescCs||i|i�<dS(N(R;t
capitalize(RRAtval((s/usr/lib64/python2.6/urllib2.pyR=scCs||i|i�<dS(N(R>R\(RRAR]((s/usr/lib64/python2.6/urllib2.pytadd_unredirected_headerscCs||ijp
||ijS(N(R;R>(Rt header_name((s/usr/lib64/python2.6/urllib2.pyt
has_headerscCs"|ii||ii||��S(N(R;tgetR>(RR_tdefault((s/usr/lib64/python2.6/urllib2.pyR/s cCs)|ii�}|i|i�|i�S(N(R>tcopytupdateR;R<(RR&((s/usr/lib64/python2.6/urllib2.pyt header_items$sN(R!R"RtFalseRRJRNRORMRPR-RSRURVRXRYRZR[R=R^R`R/Re(((s/usr/lib64/python2.6/urllib2.pyR6»s(               tOpenerDirectorcBsSeZd�Zd�Zd�Zd�Zdeid�Z dd�Z
d�Z RS(cCsMdt}d|fg|_g|_h|_h|_h|_h|_dS(NsPython-urllib/%ss
User-agent(t __version__t
addheadersthandlerst handle_opent handle_errortprocess_responsetprocess_request(Rtclient_version((s/usr/lib64/python2.6/urllib2.pyR*s
    c
CsÕt|d�ptdt|���nt}xst|�D]e}|d joq=n|id�}|| }||d}|id�oq|id�|d}||d}yt|�}Wntj
onX|i i
|h�} | |i |<nd|d jo|}|i } nD|d
jo|}|i } n$|d jo|}|i
} nq=| i|g�}
|
oti|
|�n|
i|�t}q=W|o$ti|i|�|i|�ndS(
Nt
add_parents%expected BaseHandler instance, got %rtredirect_requesttdo_opent
proxy_opent_iterrorRtresponseR3(sredirect_requestsdo_opens
proxy_open(REt TypeErrorR8Rftdirtfindt
startswithtintRRRlRaRkRmRnt
setdefaulttbisecttinsorttappendtTrueRjRp( Rthandlertaddedtmethtitprotocolt conditiontjtkindtlookupRj((s/usr/lib64/python2.6/urllib2.pyt add_handler4sL










cCsdS(N((R((s/usr/lib64/python2.6/urllib2.pytcloseesc GsT|i|d�}x;|D]3}t||�}||�}|dj o|SqWdS(N((RaRFR( RtchainR�t meth_nameRRjR�tfunctresult((s/usr/lib64/python2.6/urllib2.pyt _call_chainis 
c
Csÿt|t�ot||�}n%|}|dj o|i|�n||_|i�}|d}x8|ii|g�D]!}t ||�}||�}q|W|i
||�} |d}x;|i i|g�D]$}t ||�}||| �} qÓW| S(Nt_requestt _response( t
isinstancet
basestringR6RRORRSRnRaRFt_openRm(
RtfullurlRRtreqR�R�t processorR�Rv((s/usr/lib64/python2.6/urllib2.pyRus&
  

cCsw|i|idd|�}|o|S|i�}|i|i||d|�}|o|S|i|idd|�S(NRbt default_openR�tunknownt unknown_open(R�RkRS(RR�RR�R�((s/usr/lib64/python2.6/urllib2.pyR��s  
cGs±|d
jo1|id}|d}d|}d}|}n|i}|d}d}|||f|}|i|�}|o|S|o!|dd f|}|i|�SdS( NthttpRWis
http_error_%sit_erroriRbthttp_error_default(R�shttps(RlR�(RtprotoRtdictR�thttp_errt orig_argsR�((s/usr/lib64/python2.6/urllib2.pyRu s 




 
N( R!R"RR�R�R�Rtsockett_GLOBAL_DEFAULT_TIMEOUTRR�Ru(((s/usr/lib64/python2.6/urllib2.pyRg)s
1   c s\ddk��fd�}t�}tttttttt g}t
t d�o|i t
�nt�}xr|D]j}xa|D]Y}||�o%t||�o|i|�qÙq�t||�o|i|�q�q�WqsWx|D]}|i|�qèWx|D]}|i|��qWx5|D]-}||�o
|�}n|i|�q'W|S(s+Create an opener object from a list of handlers.

The opener will use several default handlers, including support
for HTTP, FTP and when applicable, HTTPS.

If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used.
iÿÿÿÿNcs t|�i�p
t|d�S(Nt __bases__(R�t ClassTypeRE(tobj(ttypes(s/usr/lib64/python2.6/urllib2.pytisclassÃstHTTPS(R¨Rgt ProxyHandlertUnknownHandlert HTTPHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlert
FTPHandlert FileHandlertHTTPErrorProcessorREthttplibRt HTTPSHandlertsett
issubclasstaddR�tremoveR�(RjR©Rtdefault_classestskiptklasstcheckth((R¨s/usr/lib64/python2.6/urllib2.pyR¹s<    


t BaseHandlercBs)eZdZd�Zd�Zd�ZRS(iôcCs
||_dS(N(tparent(RR¿((s/usr/lib64/python2.6/urllib2.pyRpãscCsdS(N((R((s/usr/lib64/python2.6/urllib2.pyR�æscCs%t|d�ptS|i|ijS(Nt
handler_order(RER�RÀ(Rtother((s/usr/lib64/python2.6/urllib2.pyt__lt__ês(R!R"RÀRpR�RÂ(((s/usr/lib64/python2.6/urllib2.pyR¾às  R²cBs#eZdZdZd�ZeZRS(sProcess HTTP error responses.iècCsg|i|i|i�}}}d|jo
djnp%|iid|||||�}n|S(NiÈi,R�(R$R%tinfoR¿Ru(RR3RvR$R%R&((s/usr/lib64/python2.6/urllib2.pyt
http_response÷s
  (R!R"R*RÀRÄthttps_response(((s/usr/lib64/python2.6/urllib2.pyR²ós R®cBseZd�ZRS(cCs"t|i�||||��dS(N(R#R-(RR�R'R$R%R&((s/usr/lib64/python2.6/urllib2.pyR�s(R!R"R�(((s/usr/lib64/python2.6/urllib2.pyR®sR¯cBs:eZdZdZd�Zd�ZeZZZdZ RS(ii
c Cs¶|i�}|djo
|djp|djoa|djoT|idd �}td
�|ii�D��}t|d |d |i�d
t�St|i �||||��dS(s­Return a Request or None in response to a redirect.

This is called by the http_error_30x methods when a
redirection response is received. If a redirection should
take place, return a new Request to allow http_error_30x to
perform the redirect. Otherwise, raise HTTPError if no-one
else should try to handle this url. Return None if you can't
but another Handler might.
i-i.i/i3RLtHEADRKt s%20css<x5|].\}}|i�djo||fVqqWdS(scontent-lengths content-typeN(scontent-lengths content-type(R2(t.0tktv((s/usr/lib64/python2.6/urllib2.pys <genexpr>$s R;R?R@N(i-i.i/i3(sGETRÆ(i-i.i/(
RNtreplaceR R;R<R6RZR�R#R-( RR�R'R$R%R;tnewurltmt
newheaders((s/usr/lib64/python2.6/urllib2.pyRqs
  c Csd|jo|id�d}n)d|jo|id�d}ndSti|�}|ipt|�}d|d<nti|�}ti|i�|�}|i�}|id�p|id�p
|id�p$t |||d |||��n|i
||||||�} | djodSt |d
�oo|i
}
| _
|
i|d�|ijpt|
�|ijo)t |i�||i|||��qÉnh}
| _
|_
|
i|d�d |
|<|i�|i�|ii| d |i�S(
Ntlocationiturit/ishttp://shttps://sftp://s) - Redirection to url '%s' is not allowedt
redirect_dictiR(t
getheadersR.tpathtlistt
urlunparseturljoinR-R2RzR#RqRRERÒRat max_repeatstlentmax_redirectionstinf_msgtreadR�R¿RR( RR�R'R$R%R;RÌturlpartst newurl_lowertnewtvisited((s/usr/lib64/python2.6/urllib2.pythttp_error_3022sB


   


soThe HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
(
R!R"RØRÚRqRáthttp_error_301thttp_error_303thttp_error_307RÛ(((s/usr/lib64/python2.6/urllib2.pyR¯s  " 8c CsÛt|�\}}|id�pd}|}n[|id�ptd|��n|idd�}|djo
d}n|d|!}t|�\}}|dj ot|�\}}n d}}||||fS(s3Return (scheme, user, password, host/port) given a URL or an authority.

If a URL is supplied, it must have an authority (host:port) component.
According to RFC 3986, having an authority component means the URL must
have two slashes after the scheme:

>>> _parse_proxy('file:/ftp.example.com/')
Traceback (most recent call last):
ValueError: proxy URL with no authority: 'file:/ftp.example.com/'

The first three items of the returned tuple may be None.

Examples of authority parsing:

>>> _parse_proxy('proxy.example.com')
(None, None, None, 'proxy.example.com')
>>> _parse_proxy('proxy.example.com:3128')
(None, None, None, 'proxy.example.com:3128')

The authority component may optionally include userinfo (assumed to be
username:password):

>>> _parse_proxy('joe:[email protected]')
(None, 'joe', 'password', 'proxy.example.com')
>>> _parse_proxy('joe:[email protected]:3128')
(None, 'joe', 'password', 'proxy.example.com:3128')

Same examples, but with URLs instead:

>>> _parse_proxy('http://proxy.example.com/')
('http', None, None, 'proxy.example.com')
>>> _parse_proxy('http://proxy.example.com:3128/')
('http', None, None, 'proxy.example.com:3128')
>>> _parse_proxy('http://joe:[email protected]/')
('http', 'joe', 'password', 'proxy.example.com')
>>> _parse_proxy('http://joe:[email protected]:3128')
('http', 'joe', 'password', 'proxy.example.com:3128')

Everything after the authority is ignored:

>>> _parse_proxy('ftp://joe:[email protected]/rubbish:3128')
('ftp', 'joe', 'password', 'proxy.example.com')

Test for no trailing '/' case:

>>> _parse_proxy('http://joe:[email protected]')
('http', 'joe', 'password', 'proxy.example.com')

RÑs//sproxy URL with no authority: %riiÿÿÿÿN(RRzRRRRyR
R ( tproxytschemetr_schemet authoritytendtuserinfothostporttusertpassword((s/usr/lib64/python2.6/urllib2.pyt _parse_proxyqs2





R«cBs#eZdZdd�Zd�ZRS(idcCs�|djo
t�}nt|d�p
td�||_x=|i�D]/\}}t|d||||id��qJWdS(Nthas_keysproxies must be a mappings%s_opencSs||||�S(((trRåR8R�((s/usr/lib64/python2.6/urllib2.pyt<lambda>Äs(RRREtAssertionErrortproxiesR<tsetattrRs(RRóR8R((s/usr/lib64/python2.6/urllib2.pyR½s

 

c Cs|i�}t|�\}}}}|djo
|}n|i�|iot|i�odS|oP|oIdt|�t|�f} ti| �i �}
|i
dd|
�nt|�}|i ||�||jp
|djodS|i i
|d|i�SdS(Ns%s:%ssProxy-authorizationsBasic RWR(RSRîRRUR4RRtbase64t b64encodetstripR=RXR¿RR( RR�RåR8t orig_typet
proxy_typeRìRíRët user_passtcreds((s/usr/lib64/python2.6/urllib2.pyRsÇs  


 N(R!R"RÀRRRs(((s/usr/lib64/python2.6/urllib2.pyR«¹s
tHTTPPasswordMgrcBs8eZd�Zd�Zd�Zed�Zd�ZRS(cCs
h|_dS(N(tpasswd(R((s/usr/lib64/python2.6/urllib2.pyRèsc Cs£t|t�o
|g}n||ijoh|i|<nx^ttfD]P}tg}|D]}||i||�q_~�}||f|i||<qKWdS(N(R�R�RýR�Rfttuplet
reduce_uri( RtrealmRÐRìRýt default_portt_[1]tut reduced_uri((s/usr/lib64/python2.6/urllib2.pyt add_passwordës

0c Cs�|ii|h�}xlttfD]^}|i||�}xC|i�D]5\}}x&|D]}|i||�o|SqZWqGWq"WdS(N(NN(RýRaR�RfRÿt iteritemst is_suburiR( RRtauthuritdomainsRtreduced_authurituristauthinfoRÐ((s/usr/lib64/python2.6/urllib2.pytfind_user_passwordös

c
CsÔti|�}|do)|d}|d}|dpd}nd
}|}d}t|�\}}|o\|d
joO|d
j oBhdd6dd6i|�} | d
j od || f}qÊn||fS( s@Accept authority or URI and extract only the authority and path.iiiRÑiPR�i»RWs%s:%dN(R.turlsplitRRRa(
RRÐRtpartsRæRèRÔR4R9tdport((s/usr/lib64/python2.6/urllib2.pyRÿs  

!

 
cCso||jotS|d|djotSti|d|df�}t|�t|d�jotStS(scCheck if test is below base in a URI tree

Both args must be URIs in reduced form.
ii(R�Rft posixpatht commonprefixRÙ(Rtbasettesttcommon((s/usr/lib64/python2.6/urllib2.pyRs
(R!R"RRR
R�RÿR(((s/usr/lib64/python2.6/urllib2.pyRüæs
 
tHTTPPasswordMgrWithDefaultRealmcBseZd�ZRS(cCsFti|||�\}}|dj o ||fSti|d|�S(N(RüR
R(RRRRìRí((s/usr/lib64/python2.6/urllib2.pyR
(s
 
 (R!R"R
(((s/usr/lib64/python2.6/urllib2.pyR&stAbstractBasicAuthHandlercBsDeZeidei�Zdd�Zd�Zd�Z d�Z
RS(s-(?:.*,)*[ ]*([^ ]+)[ ]+realm=(["'])(.*?)\2cCs?|djo
t�}n||_|ii|_d|_dS(Ni(RRüRýRtretried(Rt password_mgr((s/usr/lib64/python2.6/urllib2.pyR>s


 cCs
d|_dS(Ni(R(R((s/usr/lib64/python2.6/urllib2.pytreset_retry_countEsc Cs»|i|d�}|idjo"t|i�dd|d��n|id7_|o]tii|�}|o@|i�\}}}|i �djo|i
|||�Sq·ndS(Nii�sbasic auth faileditbasic( RaRRR#R-RtrxtsearchtgroupsR2tretry_http_basic_auth( RtauthreqR4R�R;tmoRæRR((s/usr/lib64/python2.6/urllib2.pythttp_error_auth_reqedHscCsª|ii||�\}}|dj ozd||f}dti|�i�}|ii|id�|jodS|i |i|�|i
i |d|i �SdSdS(Ns%s:%ssBasic %sR(
RýR
RRõRöR÷R;Rat auth_headerR^R¿RR(RR4R�RRìtpwtrawtauth((s/usr/lib64/python2.6/urllib2.pyR\s
N( R!R"tretcompiletIRRRRR"R(((s/usr/lib64/python2.6/urllib2.pyR0s      tHTTPBasicAuthHandlercBseZdZd�ZRS(t
AuthorizationcCs2|i�}|id|||�}|i�|S(Nswww-authenticate(R-R"R(RR�R'R$R%R;RRv((s/usr/lib64/python2.6/urllib2.pythttp_error_401ms
  
(R!R"R#R,(((s/usr/lib64/python2.6/urllib2.pyR*istProxyBasicAuthHandlercBseZdZd�ZRS(sProxy-authorizationcCs2|i�}|id|||�}|i�|S(Nsproxy-authenticate(RUR"R(RR�R'R$R%R;RèRv((s/usr/lib64/python2.6/urllib2.pythttp_error_407ys
  
(R!R"R#R.(((s/usr/lib64/python2.6/urllib2.pyR-uscCs�tiid�o*td�}|i|�}|i�|Sg}t|�D]}|tti dd��qN~}di
|�SdS(sReturn n random bytes.s /dev/urandomiiR+N( tosRÔtexistsRRÜR�trangetchrtrandomt randrangetjoin(tntftsRR�tL((s/usr/lib64/python2.6/urllib2.pyt randombytes�s 
9tAbstractDigestAuthHandlercBsSeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
RS( cCsQ|djo
t�}n||_|ii|_d|_d|_d|_dS(Ni(RRüRýRRt nonce_countt
last_nonce(RRý((s/usr/lib64/python2.6/urllib2.pyR�s

   cCs
d|_dS(Ni(R(R((s/usr/lib64/python2.6/urllib2.pyR§scCs�|i|d�}|idjo"t|i�dd|d��n|id7_|o8|i�d}|i�djo|i||�SndS(Nii�sdigest auth failediitdigest(RaRRR#R-tsplitR2tretry_http_digest_auth(RR#R4R�R;R Ræ((s/usr/lib64/python2.6/urllib2.pyR"ªscCs¨|idd�\}}tt|��}|i||�}|oad|}|ii|id�|jodS|i|i|�|i i
|d|i �}|SdS(NRÇis Digest %sR( R?tparse_keqv_listtparse_http_listtget_authorizationR;RaR#RR^R¿RR(RR�R&ttokent challengetchaltauth_valtresp((s/usr/lib64/python2.6/urllib2.pyR@»s
cCs<tid|i|ti�td�f�i�}|d S(Ns %s:%s:%s:%sii(thashlibtsha1R<ttimetctimeR:t hexdigest(Rtnoncetdig((s/usr/lib64/python2.6/urllib2.pyt
get_cnonceÇsc
CsxyK|d}|d}|id�}|idd�}|idd�}Wntj
odSX|i|�\}} |djodS|ii||i��\}
} |
djodS|i�o|i|i �|�} nd} d|
|| f}
d|i
�|i �f}|d jo�||i jo|i
d
7_
nd
|_
||_ d |i
}|i|�}d ||||||�f}| ||
�|�}nG|djo)| ||
�d|||�f�}ntd
|��d|
|||i �|f}|o|d|7}n| o|d| 7}n|d|7}|o|d||f7}n|S(NRRNtqopt algorithmtMD5topaques%s:%s:%ss%s:%sR&is%08xs%s:%s:%s:%s:%ssqop '%s' is not supported.s>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s
, opaque="%s"s
, digest="%s"s, algorithm="%s"s, qop=auth, nc=%s, cnonce="%s"(RaRtKeyErrortget_algorithm_implsRýR
R-RMtget_entity_digestRPRNRVR=R<RPR(RR�RFRRNRQRRRTtHtKDRìR$tentdigtA1tA2tncvaluetcnoncetnoncebittrespdigR((s/usr/lib64/python2.6/urllib2.pyRCÑsV


!

 
  

)
csY|i�}|djo
d��n|djo
d��n�fd�}�|fS(NRScSsti|�i�S((RItmd5RM(tx((s/usr/lib64/python2.6/urllib2.pyRñstSHAcSsti|�i�S((RIRJRM(Rb((s/usr/lib64/python2.6/urllib2.pyRñscs�d||f�S(s%s:%s((R8td(RX(s/usr/lib64/python2.6/urllib2.pyRñs(tupper(RRRRY((RXs/usr/lib64/python2.6/urllib2.pyRVs 



cCsdS(N(R(RRRF((s/usr/lib64/python2.6/urllib2.pyRWsN( R!R"RRRR"R@RPRCRVRW(((s/usr/lib64/python2.6/urllib2.pyR;�s  
= tHTTPDigestAuthHandlercBs#eZdZdZdZd�ZRS(s¨An authentication protocol defined by RFC 2069

Digest authentication improves on basic authentication because it
does not transmit passwords in the clear.
R+iêcCs?ti|i��d}|id|||�}|i�|S(Niswww-authenticate(R.R-R"R(RR�R'R$R%R;R4tretry((s/usr/lib64/python2.6/urllib2.pyR,)s
 
(R!R"R*R#RÀR,(((s/usr/lib64/python2.6/urllib2.pyRfstProxyDigestAuthHandlercBseZdZdZd�ZRS(sProxy-AuthorizationiêcCs2|i�}|id|||�}|i�|S(Nsproxy-authenticate(RUR"R(RR�R'R$R%R;R4Rg((s/usr/lib64/python2.6/urllib2.pyR.6s
  
(R!R"R#RÀR.(((s/usr/lib64/python2.6/urllib2.pyRh1stAbstractHTTPHandlercBs/eZdd�Zd�Zd�Zd�ZRS(icCs
||_dS(N(t _debuglevel(Rt
debuglevel((s/usr/lib64/python2.6/urllib2.pyR?scCs
||_dS(N(Rj(Rtlevel((s/usr/lib64/python2.6/urllib2.pytset_http_debuglevelBsc
CsH|i�}|ptd��n|i�ob|i�}|id�p|idd�n|id�p|iddt|��q�n|}|i�o.t|i ��\}}t
|�\}}n|id�p|id|�nxJ|i i D]<\}} |i
�}|i|�p|i|| �qqW|S(Ns
no host givens Content-types!application/x-www-form-urlencodedsContent-lengths%dR,(RURRMRPR`R^RÙRYRRVRR¿RiR\(
RR3R4Rtsel_hostRætseltsel_pathRIRB((s/usr/lib64/python2.6/urllib2.pyt do_request_Es0 
  

 c Cs�|i�}|ptd��n||d|i�}|i|i�t|i�}|i|i�d|d<td�|i �D��}|i
oLh}d}||jo||||<||=n|i |i
d|�ny5|i |i
�|i�|i|�|i�}Wn$tij
o} t| ��nX|i|_ti|dt�}
t|
|i|i��} |i| _|i| _| S(s¦Return an addinfourl object for the request, using http_class.

http_class must implement the HTTPConnection API from httplib.
The addinfourl return value is a file-like object. It also
has methods and attributes including:
- info(): return a mimetools.Message object for the headers
- geturl(): return the original request URL
- code: HTTP status code
s
no host givenRR�t
Connectioncss+x$|]\}}|i�|fVqWdS(N(ttitle(RÈRIR]((s/usr/lib64/python2.6/urllib2.pys <genexpr>}s sProxy-AuthorizationR;(RURRtset_debuglevelRjR R;RdR>R<R:t _set_tunnelR3RNRVRt getresponseR£RuRÜtrecvt _fileobjectR�RR%R-tstatusR$R( Rt
http_classR�R4R½R;ttunnel_headerstproxy_auth_hdrRðterrR'RH((s/usr/lib64/python2.6/urllib2.pyRrbs8



 %
  (R!R"RRmRqRr(((s/usr/lib64/python2.6/urllib2.pyRi=s   R­cBseZd�ZeiZRS(cCs|iti|�S(N(RrR³tHTTPConnection(RR�((s/usr/lib64/python2.6/urllib2.pyt http_open¥s(R!R"RRiRqt http_request(((s/usr/lib64/python2.6/urllib2.pyR­£s RªR´cBseZd�ZeiZRS(cCs|iti|�S(N(RrR³tHTTPSConnection(RR�((s/usr/lib64/python2.6/urllib2.pyt
https_open­s(R!R"R�RiRqt
https_request(((s/usr/lib64/python2.6/urllib2.pyR´«s tHTTPCookieProcessorcBs2eZdd�Zd�Zd�ZeZeZRS(cCs6ddk}|djo|i�}n||_dS(Niÿÿÿÿ(t cookielibRt CookieJart cookiejar(RR�R�((s/usr/lib64/python2.6/urllib2.pyR³s 
cCs|ii|�|S(N(R�tadd_cookie_header(RR3((s/usr/lib64/python2.6/urllib2.pyR�¹scCs|ii||�|S(N(R�textract_cookies(RR3Rv((s/usr/lib64/python2.6/urllib2.pyRĽsN(R!R"RRR�RÄR�RÅ(((s/usr/lib64/python2.6/urllib2.pyR�²s
   R¬cBseZd�ZRS(cCs |i�}td|��dS(Nsunknown url type: %s(RSR(RR�R8((s/usr/lib64/python2.6/urllib2.pyR�Ås (R!R"R�(((s/usr/lib64/python2.6/urllib2.pyR¬ÄscCsph}xc|D][}|idd�\}}|ddjo"|ddjo|dd!}n|||<q
W|S(s>Parse list of key=value strings where keys are not duplicated.t=iit"iÿÿÿÿ(R?(tltparsedteltRÉRÊ((s/usr/lib64/python2.6/urllib2.pyRAÉs"cCsg}d}t}}x½|D]µ}|o||7}t}qn|oB|djo
t}qn|djo
t}n||7}qn|djo|i|�d}qn|djo
t}n||7}qW|o|i|�ng}|D]}||i�qù~S(spParse lists as described by RFC 2068 Section 2.

In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Neither commas nor quotes count if they are escaped.
Only double-quotes count, not single-quotes.
R+s\R�t,(RfR�RR÷(R8trestparttescapeRtcurR((s/usr/lib64/python2.6/urllib2.pyRBÓs6 









R±cBs)eZd�ZdZd�Zd�ZRS(cCsv|i�}|d djoH|dd!djo4|io*|idjod|_|ii|�S|i|�SdS(Nis//iRÑR
tftp(RVR4R8R¿Rtopen_local_file(RR�R((s/usr/lib64/python2.6/urllib2.pyt file_opens  / cCs�tidjoiy7ttid�dtiti��d�t_Wqytij
otid�ft_qyXntiS(NR
i( R±tnamesRRþR£tgethostbyname_ext gethostnametgaierrort
gethostbyname(R((s/usr/lib64/python2.6/urllib2.pyt get_names s$c Csiddk}ddk}|i�}|i�}t|�}yùti|�}|i}|ii |i
dt �} |i |�d}
t
itd|
pd|| f��} |ot|�\}} n| p$| oYti|�|i�jo=|od||}
n d|}
tt|d�| |
�SWn!tj
o}t|��nXtd��dS( Niÿÿÿÿtusegmtis6Content-type: %s
Content-length: %d
Last-modified: %s
s
text/plainsfile://trbsfile not on local host(t email.utilst mimetypesRURVRR/tstattst_sizetutilst
formatdatetst_mtimeR�t
guess_typet mimetoolstMessageRRR£R�R�RRtOSErrorR(RR�temailR R4R(t localfiletstatstsizetmodifiedtmtypeR;R9torigurlR%((s/usr/lib64/python2.6/urllib2.pyR�s0       $
N(R!R"R�RR�R�R�(((s/usr/lib64/python2.6/urllib2.pyR±þs
 R°cBseZd�Zd�ZRS(cCsòddk}ddk}|i�}|ptd��nt|�\}}|djo
|i}n
t|�}t|�\}}|ot |�\}}nd}t
|�}t
|pd�}t
|pd�}yt i |�}Wn$t i
j
o}t|��nXt|i��\} }
| id�} tt
| �} | d | d} } | o| d o| d} ny9|i||||| |i�}
| odpd}xP|
D]H}t|�\}}|i�d jo|djo|i�}q¿q¿W|
i| |�\}}d}|i|i��d}|o|d|7}n|dj o|djo|d|7}nt|�}ti|�}t|||i��SWn2|ij
o#}td|ti �d�nXdS(Niÿÿÿÿsftp error: no host givenR+RÑiiR)tDR8tatAR�RdsContent-type: %s
sContent-length: %d
s
ftp error: %si(R²R³R�R)RdR±(!tftplibR RURRRtFTP_PORTR{R
R RR£R�RuRRVR?tmapt connect_ftpRR R2RetretrfileR¦R-RR§R¨Rt
all_errorstsystexc_info(RR�R´R R4R9RìRýR%RÔtattrstdirstfiletfwR8RHRBR'tretrlenR;R¯tsf((s/usr/lib64/python2.6/urllib2.pytftp_open3s^   

  !
 cCst||||||�}|S(N(R (RRìRýR4R9R½RR¿((s/usr/lib64/python2.6/urllib2.pyR·hs(R!R"RÂR·(((s/usr/lib64/python2.6/urllib2.pyR°2s 5tCacheFTPHandlercBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs1h|_h|_d|_d|_d|_dS(Nii<i(tcacheRtsoonesttdelayt max_conns(R((s/usr/lib64/python2.6/urllib2.pyRps
    cCs
||_dS(N(RÆ(Rtt((s/usr/lib64/python2.6/urllib2.pyt
setTimeoutwscCs
||_dS(N(RÇ(RRÍ((s/usr/lib64/python2.6/urllib2.pyt setMaxConnszscCs�|||di|�|f}||ijoti�|i|i|<n=t||||||�|i|<ti�|i|i|<|i�|i|S(NRÑ(R5RÄRKRÆRR t check_cache(RRìRýR4R9R½RRA((s/usr/lib64/python2.6/urllib2.pyR·}s"
cCsti�}|i|joZxW|ii�D]B\}}||jo)|i|i�|i|=|i|=q,q,Wnt|ii��|_t|i�|i joexF|ii�D]5\}}||ijo|i|=|i|=Pq·q·Wt|ii��|_ndS(N(
RKRÅRR<RÄR�tmintvaluesRÙRÇ(RRÈRÉRÊ((s/usr/lib64/python2.6/urllib2.pyRË�s"  

 

 (R!R"RRÉRÊR·RË(((s/usr/lib64/python2.6/urllib2.pyRÃms
   
(((((((LR*RõRIR³R§R/RR3R'R£RºRKR.R}t cStringIORt ImportErrorturllibRRRRRRRRR R
R R R
RRRtversionRhRRR¤RRtIOErrorRR#R(R0R5R6RgRR¾R²R®R¯RîR«RüRRR*R-R:R;RfRhRiR­RER´R�R¬RARBR±R°RÃ(((s/usr/lib64/python2.6/urllib2.pyt<module>Lsp             R"
 
 n� 'i H-@
9  � f
+4;