KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21572/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21572/root/usr/lib64/python2.4/urllib2.pyo
m
=5Dc@scdZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	dk
Z
dkZdkZdk
Z
dkZdkZdkZdkZdkZdkZydklZWn ej
odklZnXdklZlZlZlZlZlZlZlZl Z l!Z!l"Z"l#Z#l$Z$l%Z%dkl&Z&l'Z'l(Z(l)Z)dZ*da,ddZ-dZ.de/fd	YZ0d
e0efdYZ1de0fd
YZ2dfdYZ3dfdYZ4dZ5dfdYZ6de6fdYZ7de6fdYZ8de6fdYZ9dZ:de6fdYZ;dfdYZ<d e6fd!YZ=d"fd#YZ>d$e>fd%YZ?d&fd'YZ@d(e@e6fd)YZAd*e@e6fd+YZBd,ZCd-fd.YZDd/e6eDfd0YZEd1e6eDfd2YZFd3fd4YZGd5e6fd6YZHd7eHfd8YZIeJed9od:eHfd;YZKnd<e6fd=YZLd>e6fd?YZMd@ZNdAZOdBe6fdCYZPdDe6fdEYZQdFeQfdGYZRdHe6fdIYZSdJfdKYZTdS(Ls
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 that 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 --

Request -- an object that encapsulates the state of a request.  the
state can be a 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', 'host', 'username', 'password')

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/')


N(sStringIO(sunwrapsunquotes	splittypes	splithosts
addinfourls	splitportssplitgophertypes
splitquerys	splitattrs
ftpwrappers	noheaderss	splituserssplitpasswds
splitvalue(s	localhostsurl2pathnames
getproxiessproxy_bypasss2.4cCs*tdjo
tanti||S(N(t_openertNonetbuild_openertopenturltdata(RR((t/usr/lib64/python2.4/urllib2.pyturlopen~s

cCs
|adS(N(topenerR(R((Rtinstall_openerstURLErrorcBstZdZdZRS(NcCs|f|_||_dS(N(treasontselftargs(RR((Rt__init__scCsd|iS(Ns<urlopen error %s>(RR(R((Rt__str__s(t__name__t
__module__RR(((RR
s	t	HTTPErrorcBs)tZdZeiZdZdZRS(sBRaised when HTTP error occurs, but also acts like non-error returncCsU||_||_||_||_||_|dj	o|i|||ndS(N(	tcodeRtmsgthdrstfpRtfilenameRt_HTTPError__super_init(RRRRRR((RRs					
cCsd|i|ifS(NsHTTP Error %s: %s(RRR(R((RRs(RRt__doc__t
addinfourlRRR(((RRs		
tGopherErrorcBstZRS(N(RR(((RRstRequestcBstZdhdedZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZddZdZRS(NcCst||_d|_d|_d|_||_h|_	x*|i
D]\}}|i
||qIWh|_|djoti|}n||_||_dS(N(tunwrapRRt_Request__originalRttypethosttportRtheaderstitemstkeytvaluet
add_headertunredirected_hdrstorigin_req_hostt	cookielibtrequest_hosttunverifiable(RRRR"R(R+R%R$((RRs					
	
	cCse|d djoG|d}ttd|o%t|d|t||SqXnt|dS(Nit_Request__r_tget_(tattrtnamethasattrRtgetattrRtAttributeError(RR.R/((Rt__getattr__s
cCs|iodSndSdS(NtPOSTtGET(Rthas_data(R((Rt
get_methods
cCs
||_dS(N(RR(RR((Rtadd_datascCs
|idj	S(N(RRR(R((RR6scCs|iS(N(RR(R((Rtget_datascCs|iS(N(RR(R((Rtget_full_urlscCsZ|idjoCt|i\|_|_|idjotd|iqSn|iS(Nsunknown url type: %s(RRRt	splittypeRt_Request__r_typet
ValueError(R((Rtget_types
cCsV|idjo?t|i\|_|_|iot|i|_qOn|iS(N(RR Rt	splithostR<t_Request__r_hosttunquote(R((Rtget_hosts

cCs|iS(N(RR@(R((Rtget_selectorscCs#|||_|_|i|_dS(N(R RRRR@(RR R((Rt	set_proxyscCs|iS(N(RR((R((Rtget_origin_req_hostscCs|iS(N(RR+(R((Rtis_unverifiablescCs||i|i<dS(N(tvalRR"R$t
capitalize(RR$RG((RR&scCs||i|i<dS(N(RGRR'R$RH(RR$RG((Rtadd_unredirected_headerscCs||ijp
||ijS(N(theader_nameRR"R'(RRJ((Rt
has_headerscCs"|ii||ii||S(N(RR"tgetRJR'tdefault(RRJRM((Rt
get_headerscCs)|ii}|i|i|iS(N(RR'tcopyRtupdateR"R#(RR((Rtheader_itemss(RRRtFalseRR3R7R8R6R9R:R>RBRCRDRERFR&RIRKRNRQ(((RRs$															tOpenerDirectorcBsMtZdZdZdZdZddZddZdZ	RS(NcCsMdt}d|fg|_g|_h|_h|_h|_h|_dS(NsPython-urllib/%ss
User-agent(	t__version__tserver_versionRt
addheadersthandlersthandle_openthandle_errortprocess_responsetprocess_request(RRU((RRs
				cCst}xYt|D]K}
|
id}|
| }	|
|d}|i	doq|id|d}|
|d}yt|}Wnt
j
onX|ii|	h}||i|	<n^|djo|	}t|d|}n4|ddgjo|	}t|d|}nq|i|g}|oti||n|i|t}qW|o$ti|i||i|ndS(	Nt_iterrorRthandle_tresponsetrequesttprocess_(RRtaddedtdirthandlertmethtfindtitprotocolt	conditiont
startswithtjtkindtintR=RRYRLtlookupR1t
setdefaultRWtbisecttinsorttappendtTruet
add_parent(RRdRlRbRWRgRkRnRiRhRe((Rtadd_handler!s<




cCsdS(N((R((RtcloseFsc	GsW|i|f}x>|D]6}t||}||}|dj	o|SqqWdS(N(tchainRLRlRWRdR1t	meth_nametfuncR
tresultR(	RRwRlRxR
RWRdRzRy((Rt_call_chainJs
c	Cst|tot||}n%|}|dj	o|i|n|i}|d}x8|ii
|gD]!}t||}||}qsW|i||}|d}x;|ii
|gD]$}t||}|||}qW|S(Nt_requestt	_response(t
isinstancetfullurlt
basestringRRtreqRR8R>RhRxRR[RLt	processorR1Ret_openR_RZ(	RRRRRhRRxR_Re((RRUs$


cCs}|i|idd|}|o|Sn|i}|i|i||d|}|o|Sn|i|idd|S(NRMtdefault_openRtunknowntunknown_open(RR{RXRRzR>Rh(RRRRhRz((RRps	cGs|ddgjo1|id}|d}d|}d}|}n|i}|d}d}|||f|}|i|}|o|Sn|o$|dd	f|}|i|SndS(
Nthttpthttpsis
http_error_%sit_erroriRMthttp_error_default(
tprotoRRYtdictR
Rxthttp_errt	orig_argsR{Rz(RRR
RRxRRzR((RR]s 



	
(
RRRRuRvR{RRRR](((RRSs	
	%		cGsDt}tttttttt	g}ttdo|i
tng}xu|D]m}xd|D]\}ti|o%t||o|i
|qqbt||o|i
|qbqbWqUWx|D]}|i|qWx|D]}|i|qWx8|D]0}ti|o
|}n|i|qW|S(sCreate an opener object from a list of handlers.

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

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    tHTTPSN(RSRtProxyHandlertUnknownHandlertHTTPHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlert
FTPHandlertFileHandlertHTTPErrorProcessortdefault_classesR0thttplibRrtHTTPSHandlertskiptklassRWtchecktinspecttisclasst
issubclassR~tremoveRuth(RWRRRRRR((RRs6	
tBaseHandlercBs)tZdZdZdZdZRS(NicCs
||_dS(N(tparentR(RR((RRtscCsdS(N((R((RRvscCs(t|dptSn|i|ijS(Nt
handler_order(R0totherRsRR(RR((Rt__lt__s(RRRRtRvR(((RRs		RcBs#tZdZdZdZeZRS(sProcess HTTP error responses.icCsV|i|i|i}}}|djo%|iid|||||}n|S(NiiR(ii(	R_RRtinfoRRRR]R`(RR`R_RRR((Rt
http_responses 
%(RRRRRthttps_response(((RRs		RcBstZdZRS(NcCs"t|i||||dS(N(RRR:RRRR(RRRRRR((RRs(RRR(((RRsRcBs:tZdZdZdZdZeZZZdZ	RS(Nii
cCs|i}|djo
|d
jp|djo6|djo)t|d|id	|id
tSnt	|i
||||dS(sReturn 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/i3R5tHEADR4R"R(R+N(i-i.i/i3(sGETR(i-i.i/(
RR7tmRRtnewurlR"RERsRR:RR(RRRRRR"RR((Rtredirect_requests	4	c
Csd|jo|idd}n)d|jo|idd}ndSti|i|}|i}	|	i	dp|	i	dp
|	i	dp$t
|||d|||n|i||||||}|djodSnt|doo|i}|_|i|d|ijpt||ijo)t
|i||i|||qnh}|_|_|i|dd	||<|i|i|ii|S(
Ntlocationiturishttp://shttps://sftp://s) - Redirection to url '%s' is not allowedt
redirect_dicti(R"t
getheadersRturlparseturljoinRR:tlowertnewurl_lowerRjRRRRRRtnewRR0RtvisitedRLtmax_repeatstlentmax_redirectionstinf_msgtreadRvRR(
RRRRRR"RRRR((Rthttp_error_302s0

0	
2

soThe HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
(
RRRRRRthttp_error_301thttp_error_303thttp_error_307R(((RRs		0c
Csdkl}t|\}}|idpd}|}n[|idpt	d|n|i
dd}|djo
d}n|d|!}t|\}	}|	dj	ot|	\}}nd}}||||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:password@proxy.example.com')
    (None, 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('joe:password@proxy.example.com: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:password@proxy.example.com/')
    ('http', 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
    ('http', 'joe', 'password', 'proxy.example.com:3128')

    Everything after the authority is ignored:

    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
    ('ftp', 'joe', 'password', 'proxy.example.com')

    Test for no trailing '/' case:

    >>> _parse_proxy('http://joe:password@proxy.example.com')
    ('http', 'joe', 'password', 'proxy.example.com')

    (s_splitnetloct/s//sproxy URL with no authority: %riiN(Rt_splitnetlocR;tproxytschemetr_schemeRjRt	authorityR=Rftendt	splitusertuserinfothostporttsplitpasswdtusertpassword(
RRRRRRRRRR((Rt_parse_proxy>s"1






RcBs#tZdZddZdZRS(NidcCsg|djo
t}n||_x=|iD]/\}}t|d||||idq0WdS(Ns%s_opencCs||||S(N(RetrRR(RRRRe((Rt<lambda>s(	tproxiesRt
getproxiesRR#RRtsetattrt
proxy_open(RRRR((RRs

	

cCs|i}t|\}}
}}|djo
|}n|i
|iot|iodSn|
oP|oIdt
|
t
|f}ti|i}	|idd|	nt
|}|i||||jodSn|ii|SdS(Ns%s:%ssProxy-authorizationsBasic (RR>t	orig_typeRRt
proxy_typeRRRRRBR tproxy_bypassRAt	user_passtbase64tencodestringtstriptcredsR&RDRRR(RRRRRRRRRRR((RRs 



(RRRRRR(((RRs
tCustomProxycBs)tZdddZdZdZRS(NcCs||_||_||_dS(N(RRRyt
proxy_addrtaddr(RRRyR((RRs		cCs&|io|i|odSndS(Ni(RRyR(RR((RthandlescCs|iS(N(RR(R((Rt	get_proxys(RRRRRR(((RRs	tCustomProxyHandlercBs2tZdZdZdZdZdZRS(NidcGs
h|_dS(N(RR(RR((RRscCs|i}y|i|}Wntj
odSnXxE|D]=}|i|o'|i	|i
|ii|Sq>q>WdS(N(
RR>RRRtKeyErrorRtpRRDRRR(RRRRR((RRs	cCs|ii|S(N(RRRR(RRR((Rtdo_proxyscCsE|i|ijo|i|ii|n|g|i|i<dS(N(tcpoRRRRr(RR((Rt	add_proxys(RRRRRRR(((RRs
			tHTTPPasswordMgrcBs5tZdZdZdZdZdZRS(NcCs
h|_dS(N(Rtpasswd(R((RRscCsqt|to
|g}ntt|i|}||ijoh|i|<n||f|i||<dS(N(
R~RRttupletmapRt
reduce_uritrealmRR(RRRRR((Rtadd_passwords
cCsq|ii|h}|i|}xF|iD]8\}}x)|D]!}|i||o|SqDqDWq1WdS(N(NN(
RRRLRtdomainsRtauthurit	iteritemsturistauthinfoRt	is_suburiR(RRRRRRR((Rtfind_user_passwords
cCsIti|}|do|d|dpdfSn|ddfSdS(s9Accept netloc or URI and extract only the netloc and pathiiRN(RRtparts(RRR((RRs
cCsx||jotSn|d|djotSnti|d|df}t|t|djotSntS(scCheck if test is below base in a URI tree

        Both args must be URIs in reduced form.
        iiN(tbasettestRsRRt	posixpathtcommonprefixtcommonR(RRRR((RRs
(RRRRRRR(((RRs
						tHTTPPasswordMgrWithDefaultRealmcBstZdZRS(NcCsIti|||\}}|dj	o||fSnti|d|S(N(RRRRRRRR(RRRRR((RRs

(RRR(((RRstAbstractBasicAuthHandlercBs;tZeideiZddZdZdZ	RS(Ns![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"cCs6|djo
t}n||_|ii|_dS(N(tpassword_mgrRRRRR(RR((RRs

	cCsz|i|d}|o]tii|}|o@|i\}}|idjo|i
|||SqrqvndS(Ntbasic(R"RLtauthreqRRtrxtsearchtmotgroupsRRRRtretry_http_basic_authR R(RRR RR"RRR((Rthttp_error_auth_reqedscCs|ii||i\}}|dj	owd||f}dt
i|i}|ii|id|jodSn|i|i||ii|SndSdS(Ns%s:%ssBasic %s(RRRRRR:RtpwRtrawRRRtauthR"RLtauth_headerR&RR(RR RRRR
R	R((RR(s!
(
RRtretcompiletIRRRRR(((RRs	
tHTTPBasicAuthHandlercBstZdZdZRS(Nt
AuthorizationcCs/ti|id}|id|||S(Niswww-authenticate(RRR:R RRR"(RRRRRR"R ((Rthttp_error_4018s	(RRRR(((RR4stProxyBasicAuthHandlercBstZdZdZRS(NsProxy-authorizationcCs"|i}|id|||S(Nsproxy-authenticate(RRBR RRR"(RRRRRR"R ((Rthttp_error_407Bs	(RRRR(((RR>scCstiido-td}|i|}|i|SnGg}t
|D]}|tt
iddqQ~}di|SdS(sReturn n random bytes.s/dev/urandomiitN(tostpathtexistsRtfRtntsRvt_[1]trangeRgtchrtrandomt	randrangetLtjoin(RRRgR RR((RtrandombytesHs
9tAbstractDigestAuthHandlercBsStZddZdZdZdZdZdZdZ	dZ
RS(	NcCsH|djo
t}n||_|ii|_d|_d|_dS(Ni(RRRRRtretriedtnonce_count(RR((RRas

		cCs
d|_dS(Ni(RR$(R((Rtreset_retry_countiscCs|i|d}|idjo"t|i	dd|dn|id7_|oK|i
d}|idjo|i
||Sqtd|ndS(Niisdigest auth failediitdigests/AbstractDigestAuthHandler doesn't know about %s(R"RLRRRRR$RRR:tsplitRRtretry_http_digest_authR=(RRR RR"RR((RRlscCs|idd\}}tt|}|i||}|o^d|}|ii|i
d|jodSn|i|i
||ii|}|SndS(Nt is	Digest %s(R
R(ttokent	challengetparse_keqv_listtparse_http_listtchalRtget_authorizationRtauth_valR"RLRRR&RRtresp(RRR
R,R2R/R+R1((RR)s
cCs<tid|i|titdfi}|d S(Ns%s:%s:%s:%sii(
tshaRRR%tnoncettimetctimeR"t	hexdigesttdig(RR4R8((Rt
get_cnonces4cCs\yK|d}|d}|id}|idd}|idd}Wntj
odSnX|i
|\}
}|
djodSn|i
i||i\}}|djodSn|io|i|i|}nd}d|||f}	d|i|if}
|d	joc|id
7_d|i}|i|}d|||||
|
f}||
|	|}n7|djo)||
|	d||
|
f}nd
||||i|f}|o|d|}n|o|d|}n|djo|d|}n|o|d||f}n|S(NRR4tqopt	algorithmtMD5topaques%s:%s:%ss%s:%sR
is%08xs%s:%s:%s:%s:%ss>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"("R/RR4RLR:R;RR=RRtget_algorithm_implstHtKDRRRR:RRR6tget_entity_digestR9tentdigtA1R7RCtA2R%tncvalueR9tcnoncetnoncebittrespdigR(RRR/R:RBRRR=RHRCRDRGR4R?RFRERRR;R@((RR0sL

	
!




)
csJ|djo
dn|djo
dnd}|fS(NR<cCsti|iS(N(tmd5RtxR7(RJ((RRstSHAcCsti|iS(N(R3RRJR7(RJ((RRscsd||fS(Ns%s:%s(R?Rtd(RRL(R?(RRs(R;R?R@(RR;R?R@((R?RR>s



cCsdS(N(R(RRR/((RRAs(RRRRR&RR)R9R0R>RA(((RR#Vs				
	9	
tHTTPDigestAuthHandlercBstZdZdZdZRS(sAn authentication protocol defined by RFC 2069

    Digest authentication improves on basic authentication because it
    does not transmit passwords in the clear.
    RcCs?ti|id}|id|||}|i|S(Niswww-authenticate(	RRR:R RRR"tretryR&(RRRRRR"R RN((RRs
	
(RRRRR(((RRMstProxyDigestAuthHandlercBstZdZdZRS(NsProxy-AuthorizationcCs2|i}|id|||}|i|S(Nsproxy-authenticate(RRBR RRR"RNR&(RRRRRR"R RN((RRs
	
(RRRR(((RROst_WrapForRecvcBs tZdZdZdZRS(se Simple wrapper for urllib2 so we don't have to do r.read = r.recv and
        create circular refs. cCs
||_dS(N(tobjRt_WrapForRecv__obj(RRQ((RRscCs'|djo
d}nt|i|S(NtrecvR(R/R1RRR(RR/((RR3s

(RRRRR3(((RRPs	tAbstractHTTPHandlercBs/tZddZdZdZdZRS(NicCs
||_dS(N(t
debuglevelRt_debuglevel(RRU((RRscCs
||_dS(N(tlevelRRV(RRW((Rtset_http_debuglevel	sc
Cs8|i}|ptdn|iob|i}|idp|iddn|idp|iddt	|qnt
|i\}}t|\}	}|idp|id|	p|nxJ|iiD]<\}}|i}|i|p|i||qqW|S(Ns
no host givensContent-types!application/x-www-form-urlencodedsContent-lengths%dtHost(R`RBR R
R6R9RRKRIRR;RCRtselR?tsel_hosttsel_pathRRRVR/R%RH(
RR`RZR/R R%R\RRR[((Rtdo_request_s(
	"
c
Cs|i}|ptdn||}|i|it	|i
}|i|id|d<y5|i
|i|i|i||i}Wn$tij
o}t|nXt|}ti|}t||i|i}	|i|	_|i|	_|	S(sReturn 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 givenRvt
ConnectionN( RRBR R
t
http_classRtset_debuglevelRRVRR"RPR'R`R7RCRtgetresponseRtsocketR]terrRPt_fileobjectRRRR:R2tstatusRR(
RR_RRRcRR"R RR2((Rtdo_open&s(	
%(RRRRXR]Rf(((RRTs		RcBstZdZeiZRS(NcCs|iti|S(N(RRfRtHTTPConnectionR(RR((Rt	http_open]s(RRRhRTR]thttp_request(((RR[s	RRcBstZdZeiZRS(NcCs|iti|S(N(RRfRtHTTPSConnectionR(RR((Rt
https_openes(RRRkRTR]t
https_request(((RRcs	tHTTPCookieProcessorcBs2tZddZdZdZeZeZRS(NcCs*|djoti}n||_dS(N(t	cookiejarRR)t	CookieJarR(RRn((RRks
cCs|ii||S(N(RRntadd_cookie_headerR`(RR`((RRipscCs|ii|||S(N(RRntextract_cookiesR_R`(RR`R_((RRts(RRRRRiRRlR(((RRmjs
		RcBstZdZRS(NcCs |i}td|dS(Nsunknown url type: %s(RR>RR
(RRR((RR|s(RRR(((RR{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"iN(tparsedtlteltR(tktv(RuRwRxRvRt((RR-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.
    Rs\Rst,N(trestpartRRtescapetquoteRtcurRsRrRR(RR~RzR|RR{R}((RR.s8









RcBs)tZdZdZdZdZRS(NcCs_|i}|d djo1|dd!djod|_|ii|Sn|i|SdS(Nis//iRtftp(RRCRRRRRtopen_local_file(RRR((Rt	file_opens
%	cCsBtidjo+tidtitift_ntiS(Nt	localhost(RtnamesRRbt
gethostbynametgethostname(R((Rt	get_namess+cCsdk}|i}	|i}t|}t	i
|}|i}|ii|idt}
ti|d}titd|pd||
f}|	ot|	\}	}n|	p$|o=ti|	|ijo!t t!|d|d|Snt"ddS(Ntusegmtis6Content-type: %s
Content-length: %d
Last-modified: %s
s
text/plaintrbsfile:sfile not on local host(#temail.UtilstemailRRBR RCtfileturl2pathnamet	localfileRtstattstatstst_sizetsizetUtilst
formatdatetst_mtimeRstmodifiedt	mimetypest
guess_typetmtypet	mimetoolstMessagetStringIOR"t	splitportR!RbRRRRRR
(RRRRR!RRRRR RR"((RRs		),(RRRRRRR(((RRs			RcBstZdZdZRS(NcCs|i}|p
tdnt|\}}|djo
ti}n
t	|}t
|\}
}|
ot|
\}
}
nd}
t|}t|
pd}
t|
pd}
yti|}Wn$tij
o}t|nXt|i\}}|id}tt|}|d |d}}|o|do|d}ny3|i|
|
|||}	|odpd	}xP|D]H}t!|\}}|i#d
jo|djo|i$}qqW|	i%||\}}d}t)i*|i+d}|o|d|7}n|dj	o|djo|d|7}nt-|}t/i0|}t1|||i+SWn4ti2j
o%}td|ft3i4dnXdS(Ns	ftp errors
no host givenRRiiiRtDRtatARgRLsContent-type: %s
sContent-length: %d
i(s	ftp errors
no host given(RRRgRRLR(5RRBR tIOErrorRR!RtftplibtFTP_PORTRmRRRRRARbRR]RR
t	splitattrRCRtattrsR(tdirsRRRtconnect_ftptfwRR.t
splitvalueR%RtuppertretrfileRtretrlenR"RRR:RRtsfRRRt
all_errorstsystexc_info(RRRRRRR!RRRRRR RRRR.R%R"R((Rtftp_opensX


 cCst|||||}|S(N(t
ftpwrapperRRR R!RR(RRRR R!RR((RRs(RRRR(((RRs	3tCacheFTPHandlercBs5tZdZdZdZdZdZRS(NcCs1h|_h|_d|_d|_d|_dS(Nii<i(Rtcachettimeouttsoonesttdelayt	max_conns(R((RRs
				cCs
||_dS(N(ttRR(RR((Rt
setTimeoutscCs
||_dS(N(RRR(RR((RtsetMaxConns"scCs|||di|f}||ijoti|i	|i
|<n:t||||||i|<ti|i	|i
|<|i
|i|S(NR(RR R!R!RR$RRR5RRRRtcheck_cache(RRRR R!RR$((RR%s
cCsti}|i|joZxW|iiD]B\}}||jo)|i|i	|i|=|i|=q,q,Wnt
|ii|_t|i|i
joexF|iiD]5\}}||ijo|i|=|i|=PqqWt
|ii|_ndS(N(R5RRRRR#RwRxRRvtmintvaluesRR(RRwRRx((RR/s"



	(RRRRRRR(((RRs
				
t
GopherHandlercBstZdZRS(NcCs|i}|ptdnt|}|i}t|\}}t	|\}}t|}|o%t|}ti|||}nti||}t|t|iS(Ns
no host given(RRBR RRARCtselectortsplitgophertypeRt
splitquerytqueryt	gopherlibt
send_queryRt
send_selectorRt	noheadersR:(RRRRRR R((Rtgopher_openDs(RRR(((RRCst
OpenerFactorycBsGtZeeeeeegZgZ	gZ
dZdZdZ
RS(NcCs|i|g|_dS(N(RRWR(RR((RRu]scCsdS(N((RR((Rtreplace_handler`scCsKt}x;|iD]0}ti|o
|}n|i|qWdS(N(RSRRtdefault_handlerstphRRRu(RRR((RRcs	

(RRRRRRRRRRWtreplacement_handlersRuRR(((RRUs		(URRRRRRRIRRRRRRR3RbRR5RRpR)t	cStringIORtImportErrorturllibRRAR;R?RRRRRRRRRRRRRRRTRRRR	RR
RRRRSRRRRRRRRRRRRRRR"R#RMRORPRTRR0RRmRR-R.RRRRR(MRRARR-RRRRR?RRRRMRRRR	RRRRR;RRRRRRmRRRRRRRRRPRR
RRRORRR#RRR.R"RRRSRRRRR)RIRRRTRRbRRRpRRRR3RRRR5RTRR((Rt?Gs																			[	
e	$\	I(-
$

	
W	
	+'9.

Anon7 - 2021