-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/transport/http/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyc


sQQc
@@sdZddlmZdZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZmZmZmZmZmZmZmZejedddd	d
ddgZd
ZdZdZdZej ddededdddZ!ej ddededdddZ"e#a$e%a&de	j'fdYZ'de(fdYZ)de(fd YZ*d!ej+fd"YZ,d#fd$YZ-d%e-ej.fd&YZ.d'd(Z/d)Z0d*e-ej1fd+YZ1d,e	j2fd-YZ2d.e2fd/YZ3d0e	j4fd1YZ5d2e	j6fd3YZ6d4e6fd5YZ7d6e6fd7YZ8d8e	j9fd9YZ9d:e	j:fd;YZ:d<e	j4fd=YZ;d>e;fd?YZ<d@e;fdAYZ=dBZ>dCZ?dDe;fdEYZ@dFe;fdGYZAdHe;fdIYZBdJe=eAfdKYZCdLe=eBfdMYZDdNe@eAfdOYZEdPe@eBfdQYZFdRe<eAfdSYZGdTe<eBfdUYZHdVe	jIfdWYZIdXe	jJfdYYZJdZe(fd[YZKdS(\sImplementation of urllib2 tailored to bzr needs

This file complements the urllib2 class hierarchy with custom classes.

For instance, we create a new HTTPConnection and HTTPSConnection that inherit
from the original urllib2.HTTP(s)Connection objects, but also have a new base
which implements a custom getresponse and cleanup_pipe handlers.

And then we implement custom HTTPHandler and HTTPSHandler classes, that use
the custom HTTPConnection classes.

We have a custom Response class, which lets us maintain a keep-alive
connection even for requests that urllib2 doesn't expect to contain body data.

And a custom Request class that lets us track redirections, and
handle authentication schemes.

For coherency with python libraries, we use capitalized header names throughout
the code, even if the header names will be titled just before sending the
request (see AbstractHTTPHandler.do_open).
i(tabsolute_importN(t__version__(	tconfigtdebugterrorstlazy_importtosutilsttracet	transporttuiturlutilss
import ssl
u"/etc/ssl/certs/ca-certificates.crtu /etc/pki/tls/certs/ca-bundle.crtu/etc/ssl/ca-bundle.pemu/etc/ssl/cert.pemu&/usr/local/share/certs/ca-root-nss.crtu&/etc/openssl/certs/ca-certificates.crtcC@srtjdkr1tjjtjjtjdStjdkrCn'x$tD]}tjj|rJ|SqJWtdS(Ntwin32u
cacert.pemtdarwini(	tsystplatformtostpathtjointdirnamet
executablet_ssl_ca_certs_known_locationstexists(R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytdefault_ca_certsZs"
cC@s)tjj|s%td|n|S(Nsca certs path %s does not exist(RRRt
ValueError(R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytca_certs_from_storemscC@sTddl}y i|jd6|jd6|SWn!tk
rOtd|nXdS(Nitrequiredtnonesinvalid value %s(tsslt
CERT_REQUIREDt	CERT_NONEtKeyErrorR(tunicode_strR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytcert_reqs_from_storess

	
cC@stjdkrdSdSdS(NRRunoneurequired(swin32sdarwin(R
R(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytdefault_ca_reqs}ssssl.ca_certstfrom_unicodetdefaulttinvalidtwarningthelpsPath to certification authority certificates to trust.

This should be a valid path to a bundle containing all root Certificate
Authorities used to verify an https server certificate.

Use ssl.cert_reqs=none to disable certificate verification.
s
ssl.cert_reqsterrorsWhether to require a certificate from the remote side. (default:required)

Possible values:
 * none: Certificates ignored
 * required: Certificates required and validated
t
addinfourlcB@s#eZdZddZdZRS(s^Replacement addinfourl class compatible with python-2.7's xmlrpclib

    In python-2.7, xmlrpclib expects that the response object that it receives
    has a getheader method.  httplib.HTTPResponse provides this but
    urllib2.addinfourl does not.  Add the necessary functions here, ported to
    use the internal data structures of addinfourl.
    cC@s1|jdkrtjn|jj||S(N(theaderstNonethttplibtResponseNotReadyt	getheader(tselftnameR#((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR-scC@s+|jdkrtjn|jjS(N(R)R*R+R,titems(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
getheaderssN(t__name__t
__module__t__doc__R*R-R1(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR(st_ReportingFileSocketcB@s>eZddZdZddZddZdZRS(cC@s||_||_dS(N(tfilesockt_report_activity(R.R6treport_activity((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt__init__s	cC@s |jr|j||ndS(N(R7(R.tsizet	direction((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR8s	icC@s,|jj|}|jt|d|S(Ntread(R6R<R8tlen(R.R:ts((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR<sicC@s,|jj|}|jt|d|S(NR<(R6treadlineR8R=(R.R:R>((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR?scC@st|j|S(N(tgetattrR6(R.R/((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt__getattr__sN(R2R3R*R9R8R<R?RA(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR5s
	t_ReportingSocketcB@sGeZddZdZdZdZdddZdZRS(	cC@s||_||_dS(N(tsockR7(R.RCR8((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9s	cC@s |jr|j||ndS(N(R7(R.R:R;((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR8s	cG@s-|jj|||jt|ddS(Ntwrite(RCtsendallR8R=(R.R>targs((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyREscG@s,|jj|}|jt|d|S(NR<(RCtrecvR8R=(R.RFR>((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRGstricC@s%|jj|d}t||jS(Ni(RCtmakefileR5R7(R.tmodetbufsizetfsock((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRIscC@st|j|S(N(R@RC(R.R/((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRAsN(	R2R3R*R9R8RERGRIRA(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRBs				tResponsec	B@sGeZdZddddddddd	g	Zd
ZdZdZRS(
sCustom HTTPResponse, to avoid the need to decorate.

    httplib prefers to decorate the returned objects, rather
    than using a custom object.
    i-i.i/i3iiiiii cC@stjj||j|jkr|jdkrKd|jGd|jGHn|jdkp`|js|j	|j}|jdkrd|GHqn|j
n|jdkrt|_ndS(sBegin to read the response from the server.

        httplib assumes that some responses get no content and do
        not even attempt to read the body in that case, leaving
        the body in the socket, blocking the next request. Let's
        try to workaround that.
        isFor status: [%s],swill ready body, length: %si	sConsumed body: [%s]iN(R+tHTTPResponsetbegintstatust_body_ignored_responsest
debugleveltlengthR*t
will_closeR<tclosetFalse(R.tbody((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyROs
cC@sd}|jsd}t}xA|ra|jra|jt|j|j}|t|7}q!W|r{tj	d|n|j
n|S(sFinish reading the body.

        In some cases, the client may have left some bytes to read in the
        body. That will block the next request to succeed if we use a
        persistent connection. If we don't use a persistent connection, well,
        nothing will block the next request since a new connection will be
        issued anyway.

        :return: the number of bytes left on the socket (may be None)
        is %s bytes left on the HTTP socketN(R*tisclosedtTrueRSR<tmint_discarded_buf_sizeR=RtmutterRU(R.tpendingtdata((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytfinish%s
(R2R3R4RQR[ROR_(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRMs
!	&tAbstractHTTPConnectioncB@sJeZdZeZdZddZdZdZ	dZ
dZRS(	sEA custom HTTP(S) Connection, which can reset itself on a bad responseicC@sd|_||_d|_dS(N(R*t	_responseR7t_ranges_received_whole_file(R.R8((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9Is		cC@sNd|j|jf}|jdk	r9|d|j7}ntjd|dS(Ns%s:%ss(proxy for %s)s* About to connect() to %s(thosttporttproxied_hostR*RR\(R.tnetloc((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_mutter_connectNscC@stjj||_|jS(s*Capture the response to be able to cleanup(R+tHTTPConnectiontgetresponseRa(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRiTscC@s|jdk	ryn|jj}|jdkr||jjdkr||r|||jkr|t|_tjd|j	|j
nWnZtjk
r}t
|jdks|jdtjtjfkrn|jnXd|_n|j}d|_|j||_dS(s5Read the remaining bytes of the last response if any.iseGot a 200 response when asking for multiple ranges, does your server at %s:%s support range requests?iN(RaR*R_RbRPt_range_warning_thresoldRYRR%RcRdtsocketR'R=RFterrnot
ECONNRESETtECONNABORTEDRURC(R.R]teRC((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytcleanup_pipeYs(			
cC@st||j|_dS(s&Wrap the socket before anybody use it.N(RBR7RC(R.RC((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_wrap_socket_for_reportingzsiN(R2R3R4RMtresponse_classRjR*R9RgRiRpRq(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR`@s			!RhcB@s&eZdddddZdZRS(cC@s<tj|d|tjj|||dt||_dS(NR8tstrict(R`R9R+RhRYRe(R.RcRdReR8tca_certs((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9scC@s@dtjkr|jntjj||j|jdS(Nthttp(Rtdebug_flagsRgR+RhtconnectRqRC(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRws
N(R2R3R*R9Rw(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRhsicC@sg}x|jdD]x}|jd|krJtdt|n|dkrf|jdqtj|}|j|jddqWtjddj	|d	tj
S(
Nt.t*s,too many wildcards in certificate DNS name: s[^.]+s\*s[^.]*s\As\.s\Z(tsplittcountRtreprtappendtretescapetreplacetcompileRt
IGNORECASE(tdnt
max_wildcardstpatstfrag((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_dnsname_to_patscC@sp|stdng}|jdd
}xI|D]A\}}|dkr4t|j|redS|j|q4q4W|sxi|jddD]R}xI|D]A\}}|dkrt|j|rdS|j|qqWqWnt|dkr+tjd|d	jt	t
|fnAt|dkr]tjd
||dfntjddS(s#Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 rules
    are mostly followed, but IP addresses are not accepted for *hostname*.

    CertificateError is raised on failure. On success, the function
    returns nothing.
    sempty or no certificatetsubjectAltNametDNSNtsubjectt
commonNameis&hostname %r doesn't match either of %ss, shostname %r doesn't match %ris=no appropriate commonName or subjectAltName fields were found(((RtgetRtmatchR}R=RtCertificateErrorRtmapR|(tcertthostnametdnsnamestsantkeytvaluetsub((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytmatch_hostnames0%	tHTTPSConnectioncB@s5eZdddddddZdZdZRS(cC@sKtj|d|tjj|||||dt||_||_dS(NR8Rs(R`R9R+RRYReRt(R.RcRdtkey_filet	cert_fileReR8Rt((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9s
	cC@s\dtjkr|jntjj||j|j|jdkrX|j
ndS(NRu(RRvRgR+RhRwRqRCReR*tconnect_to_origin(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRws
cC@sitj}|jd}|jdk	rF|jjddd}n	|j}|tjkrt	j
jdd|t	j
jj
dd}nF|jdkr|jd}n	|j}|dkrtjdny.tj|j|j|jd	|d
|}Wn&tjk
r,}tjdnX|tjkrX|j}t||n|j|dS(Ns
ssl.cert_reqst:iitnot_checking_ssl_certRcsssl.ca_certsswNo valid trusted SSL CA certificates file set. See 'bzr help ssl.ca_certs' for more information on setting trusted CAs.t	cert_reqsRts
See `bzr help ssl.ca_certs` for how to specify trusted CAcertificates.
Pass -Ossl.cert_reqs=none to disable certificate verification entirely.
(RtGlobalStackRReR*RzRcRRR	t
ui_factorytshow_user_warningtsuppressed_warningstaddRtRR%twrap_socketRCRRtSSLErrortnoteRtgetpeercertRRq(R.tconfig_stackRRcRttssl_sockRot	peer_cert((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs4			
N(R2R3R*R9RwR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs
		tRequestcB@s>eZdZdideddddZdZdZRS(sA custom Request object.

    urllib2 determines the request method heuristically (based on
    the presence or absence of data). We set the method
    statically.

    The Request object tracks:
    - the connection the request will be made on.
    - the authentication parameters needed to preventively set
      the authentication header once a first authentication have
       been made.
    c

C@sttjj||||||||_||_|	|_||_d|_t	|_
i|_i|_d|_
dS(N(turllib2RR9tmethodt
connectiontaccepted_errorstparentR*t
redirected_toRVtfollow_redirectionstautht
proxy_authRe(
R.RturlR^R)torigin_req_hosttunverifiableRRR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9s
								cC@s|jS(N(R(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
get_method0scC@stj|j\}}|dkrQ|jdkr?t}nt}|j}nd||f|_t	j
j||||jd|jdS(s,Set the proxy and remember the proxied host.thttpss%s:%stHostN(
turllibt	splitporttget_hostR*ttypeRRhtdefault_portReRRt	set_proxytadd_unredirected_header(R.tproxyRRcRdt
conn_class((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR3s	N(R2R3R4R*RVR9RR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs	t_ConnectRequestcB@s#eZdZdZdZRS(cC@sMtj|d|jd|j|jdkr=tn|j|_dS(sConstructor

        :param request: the first request sent to the proxied host, already
            processed by the opener (i.e. proxied_host is already set).
        tCONNECTRN(RR9tget_full_urlRReR*tAssertionError(R.trequest((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9Is

cC@s|jS(N(Re(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytget_selectorWscC@stjj|||dS(sSet the proxy without remembering the proxied host.

        We already know the proxied host by definition, the CONNECT request
        occurs only when the connection goes through a proxy. The usual
        processing (masquerade the request so that the connection is done to
        the proxy while the request is targeted at another host) does not apply
        here. In fact, the connection is already established with proxy and we
        just want to enable the SSL tunneling.
        N(RRR(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRZs
(R2R3R9RR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRGs		tConnectionHandlercB@sGeZdZdZdddZdZdZdZdZ	RS(sdProvides connection-sharing by pre-processing requests.

    urllib2 provides no way to access the HTTPConnection object
    internally used. But we need it in order to achieve
    connection sharing. So, we add it to the request just before
    it is processed, and then we override the do_open method for
    http[s] requests in AbstractHTTPHandler.
    icC@s||_||_dS(N(R7Rt(R.R8Rt((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9ss	cC@s|j}|s-tj|jdny+||d|jd|jd|j}Wn1tjk
r}tj|jddnX|S(Nsno host given.ReR8Rttextrasnonnumeric port(RRt
InvalidURLRReR7RtR+(R.Rthttp_connection_classRcRt	exception((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytcreate_connectionws	
cC@sD|j}|dkr3|j||}||_n|jt|S(sCapture or inject the request connection.

        Two cases:
        - the request have no connection: create a new one,

        - the request have a connection: this one have been used
          already, let's capture it, so that we can give it to
          another transport to be reused. We don't do that
          ourselves: the Transport object get the connection from
          a first request and then propagate it, from request to
          request or to cloned transports.
        N(RR*Rtset_debugleveltDEBUG(R.RRR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytcapture_connections
	
cC@s|j|tS(N(RRh(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pythttp_requestscC@s|j|tS(N(RR(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
https_requestsN(
R2R3R4t
handler_orderR*R9RRRR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRgs			tAbstractHTTPHandlercB@sheZdZdZidd6dd6dd6ded	6d
d6ZdZd
ZdZe	dZ
RS(sA custom handler for HTTP(S) requests.

    We overrive urllib2.AbstractHTTPHandler to get a better
    control of the connection, the ability to implement new
    request types and return a response able to cope with
    persistent connections.
    isno-cachetPragmas	max-age=0s
Cache-controls
Keep-Alivet
Connectionsbzr/%s (urllib)s
User-agents*/*tAcceptcC@stjj|dtdS(NRR(RRR9R(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9scC@s|jj|jj|S(sCommon headers setting(R)tupdatet_default_headerstcopy(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRscC@stj\}}}|tjkrFtjd|jd|nt|tj	rg|||n|r|j
dkrd|GHd|jGH|j}|j
}d||fGHn|jj|j||t}	n:|j
dkrd|GHd|jGHn|tjtjfkr@tj|j
dd|}
nt|tjrt|jr|jd	tjd
dfkrtjdn.tjd
d|j|jfd|}
|j
dkrd|jGH|j}|j
}d||fGHd|
GHn|
d||	S(sRetry the request (once) or raise the exception.

        urllib2 raises exception of application level kind, we
        just have to translate them.

        httplib can raise exceptions of transport level (badly
        formatted dialog, loss of connexion or socket level
        problems). In that case we should issue the request again
        (httplib will close and reopen a new connection if
        needed).
        sCouldn't resolve host '%s't
orig_errorisReceived exception: [%r]s  On connection: [%r]s  Will retry, %s %rsReceived second exception: [%r]sBad status line receivediiE'iF's&Connection lost while sending request.tmsgswhile sending %s %s:sOn connection: [%r]s  Failed again, %s %rs  Will raise: [%r]N(R
texc_infoRktgaierrorRtConnectionErrortget_origin_req_hostt
isinstanceR+tImproperConnectionStatet_debuglevelRRRRUtdo_openRVt
BadStatusLinetUnknownProtocoltInvalidHttpResponseR'R=RFRlRmtConnectionResetRR*(R.t
http_classRt	first_trytexc_typetexc_valtexc_tbRRtresponsetmy_exception((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytretry_or_raisesP	
	
		!			c	C@s|j}|dkr$tdni}|j|j|j|jtd|jD}y
|j}|j	}|j
|||j|dtj
kr6tjd||fg}xF|jD]8\}	}
|	dkrd}
n|jd|	|
fqWtjd	d
j|dn|jdkrcd
||jjjfGHn|j}t}Wnitjtjfk
rnJtjtjtjtj tj!fk
r|j"|||}t#}nX|jdkrd|GHd|j|j$fGHn|r}|}
|}|j%|_&tj'|dd}t(||j)|
j$}|j*|_+|j,|_)|j-|_-|jdkrd|GHd|j|j$fGHndtj
krd}y"||j-d|j-df}Wnd|j-}nXtjd||j+|j)fg|j.j/D]}|j0d^q>}tjddj|dqn|}|S(s}See urllib2.AbstractHTTPHandler.do_open for the general idea.

        The request will be retried once if it fails.
        s-Cannot process a request without a connectioncs@s'|]\}}|j|fVqdS(N(ttitle(t.0R/tval((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pys	<genexpr>+sRus> %s %st
AuthorizationsProxy-Authorizations<masked>s%s: %ss> s
> s
isRequest sent: [%r] from (%s)isReceives response: %rs
  For: %r(%r)RKisCreate addinfourl: %rs
HTTP/%d.%di
sHTTP/%rs
< %s %s %ss
s< s
< N(RsProxy-Authorization(1RR*RRtheader_itemstunredirected_hdrstdictt	iteritemsRRt
_send_requesttget_dataRRvRR\R}RRRCtgetsocknameRiRYRRRRRkRR+RRR't
HTTPExceptionRRVRR<RGt_fileobjectR(RRPtcodetreasontversiontinfoR)trstrip(R.RRRRR)RRthdrstktvRtconvert_to_addinfourltreqRHtfptrespRth((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs~			!

		
+$(R2R3R4Rtbzrlib_versionRR9RRRYR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs

			MtHTTPHandlercB@seZdZdZRS(s5A custom handler that just thunks into HTTPConnectioncC@s|jt|S(N(RRh(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt	http_opens(R2R3R4R(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR~stHTTPSHandlercB@s eZdZejZdZRS(s6A custom handler that just thunks into HTTPSConnectioncC@s|j}|jdkr|jdk	r|jdkrt|}|jj|}|jdkrt	j
d|j|jfn|j|j
||_n|jt|S(NRis Can't connect to %s via proxy %s(RRCR*ReRRRtopenRRRRcRpRRR(R.RRRwR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
https_opens		

(R2R3R4RRRR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs	tHTTPRedirectHandlercB@s4eZdZeZdZdZeZZZ	RS(sHandles redirect requests.

    We have to implement our own scheme because we use a specific
    Request object and because we want to implement a specific
    policy.
    c
C@sk|dkrFt|j|d|jd|jdtdd
d	|Stj|j||||d
S(s0See urllib2.HTTPRedirectHandler.redirect_requesti-i.i/i3R)RRRRN(i-i.i/i3(	RRR)RRYR*Rt	HTTPErrorR(R.R	R
RRR)tnewurl((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytredirect_requests	c	C@sd|kr"|jdd}n&d|krD|jdd}ndS|jdkrld||jfGHn|jtkr||_|Stj|j|}|j||||||}t	|dr;|j
}|_
|j|d|jks
t
||jkrOtj|j||j|||qOni}|_
|_
|j|dd||<|j|jj|jj|S(sRequests the redirected to URI.

        Copied from urllib2 to be able to clean the pipe of the associated
        connection, *before* issuing the redirected request but *after* having
        eventually raised an error.
        tlocationituriNis Redirected to: %s (followed: %r)t
redirect_dict(R1RRRVRturlparseturljoinRRthasattrRRtmax_repeatsR=tmax_redirectionsRRtinf_msgRURRpRR(	R.R	R
RRR)Rtredirected_reqtvisited((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pythttp_error_302s2
		

(
R2R3R4RRRR"thttp_error_301thttp_error_303thttp_error_307(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs
		-	6tProxyHandlercB@sMeZdZdZeZddZddZdZ	dZ
dZRS(	sHandles proxy setting.

    Copied and modified from urllib2 to be able to modify the request during
    the request pre-processing instead of modifying it at _open time. As we
    capture (or create) the connection object during request processing, _open
    time was too late.

    The main task is to modify the request so that the connection is done to
    the proxy while the request still refers to the destination host.

    Note: the proxy handling *may* modify the protocol used; the request may be
    against an https server proxied through an http proxy. So, https_request
    will be called, but later it's really http_open that will be called. This
    explains why we don't have to call self.parent.open as the urllib2 did.
    idc@stjj|xOjjD]>\}}jdkrPd||fGHntd|q#Wfd}jd}||djd}||ddS(NisWill unbind %s_open for %rs%s_openc@s[|dkrdSd}jdkr;d||fGHnt|fddS(Nt_requestisWill bind %s for %rc@sj|S(N(R(R(tschemeR.(sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt<lambda>Ds(R*Rtsetattr(RR(tscheme_request(R.(R(sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytbind_scheme_request=s
	RuR(RR&R9tproxiesR0Rtdelattrtget_proxy_env_var(R.R-RRR,t
http_proxythttps_proxy((R.sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR95s	
tallcC@s_y|j|jSWnCtk
rZ|dk	r[y|j|SWqWtk
rSqWXq[nXdS(sGet a proxy env var.

        Note that we indirectly rely on
        urllib.getproxies_environment taking into account the
        uppercased values for proxy variables.
        N(R-tlowerRR*(R.R/t
default_to((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR/Ks

cC@sH|jddd}|j||}|dkr@tj|S|SdS(slCheck if host should be proxied or not.

        :returns: True to skip the proxy, False otherwise.
        tnoR4N(R/R*tevaluate_proxy_bypassRtproxy_bypass(R.Rctno_proxytbypass((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR7]s

cC@s|dkrtStj|\}}x|jdD]}|j}|dkrYq5ntj|\}}||ks|dkr5|jdd}|jdd}|jdd}tj||tj	rt
Sq5q5WdS(	s0Check the host against a comma-separated no_proxy list as a string.

        :param host: ``host:port`` being requested

        :param no_proxy: comma-separated list of hosts to access directly.

        :returns: True to skip the proxy, False not to, or None to
            leave it to urllib.
        t,tRxs\.Rys.*t?N(R*RVRRRztstripRR~RRRY(R.RcR8thhostthporttdomaintdhosttdport((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR6ks
cC@s1|j|jr|S|j|}|jdkrId||fGHntjj|}|jsytj	|dn|j
ikri|jd6|jd6|jd6|j
d6|jd6dd	6|_
n|jdkr|j}n|jd
|j}|j|||jdkr-d||fGHn|S(Nisset_proxy %s_request for %rsNo host componentRcRdtusertpasswordtprotocolRs:%dsset_proxy: proxy set to %s://%s(R7RR/RRtConnectedTransportt
_split_urlRcRRRRdRCRDR(R*R(R.RRRt
parsed_urltphost((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs.	




N(R2R3R4RRRR*R9R/R7R6R(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR& s		!tAbstractAuthHandlercB@seZdZdZdZeZdZdZ	dZ
dZdZdZ
dZd	Zd
ZdZdZd
ZeZRS(sA custom abstract authentication handler for all http authentications.

    Provides the meat to handle authentication errors and
    preventively set authentication headers after the first
    successful authentication.

    This can be used for http and proxy, as well as for basic, negotiate and
    digest authentications.

    This provides an unified interface for all authentication handlers
    (urllib2 provides far too many with different policies).

    The interaction between this handler and the urllib2
    framework is not obvious, it works as follow:

    opener.open(request) is called:

    - that may trigger http_request which will add an authentication header
      (self.build_header) if enough info is available.

    - the request is sent to the server,

    - if an authentication error is received self.auth_required is called,
      we acquire the authentication info in the error headers and call
      self.auth_match to check that we are able to try the
      authentication and complete the authentication parameters,

    - we call parent.open(request), that may trigger http_request
      and will add a header (self.build_header), but here we have
      all the required info (keep in mind that the request and
      authentication used in the recursive calls are really (and must be)
      the *same* objects).

    - if the call returns a response, the authentication have been
      successful and the request authentication parameters have been updated.
    icC@s
d|_dS(N(R*t_retry_count(R.((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9scC@sLy|jdd\}}Wntk
r;|}d}nX|j|fS(s5Parse the authentication header.

        :param server_header: The value of the header sent by the server
            describing the authenticaion request.

        :return: A tuple (scheme, remainder) scheme being the first word in the
            given header (lower cased), remainder may be None.
        iN(RzR*RR3(R.t
server_headerR(t	remainder((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_parse_auth_headers	

cC@s9|j|d}||kr5|||<t|d<ndS(s=Update a value in auth marking the auth as modified if neededtmodifiedN(RR*RY(R.RRRt	old_value((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytupdate_auths
c
C@s|jd
krd|_n.|jd7_|j|jkrId
|_d
S|j|j}|swtd|jn|j|}t|d<|jdd
d
krt	j
j|j}|j
|d|j|j
|d|j|j
|d|j|j
|d|jnx|D]}|j||}|r"|j|jd
d
k	rj|drjd
S|jdd
}|d
kr|j}|d<n||jkrq"n|jr|jd	d
d
krd
S|jj|jj|}	|	r|j||	n|	Sq"Wd
S(sRetry the request if the auth scheme is ours.

        :param request: The request needing authentication.
        :param headers: The headers for the authentication error response.
        :return: None or the response for the authenticated request.
        is%s not foundRORRERcRdtbest_schemeRCN(RKR*t
_max_retryR1tauth_required_headerRtget_authRVRR
tURLtfrom_stringRRQR(RcRdRt
auth_matcht
get_headertauth_headertrequires_usernameRRpRRtauth_successful(
R.RR)tserver_headersRRHRLtmatching_handlerRRR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
auth_requiredsH	

!
cC@s|j|j|dS(s,Add the authentication header to the requestN(RRZ(R.Rtheader((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytadd_auth_headerSscC@st|jdS(s4Check that we are able to handle that authentication scheme.

        The request authentication parameters may need to be
        updated with info from the server. Some of these
        parameters, when combined, are considered to be the
        authentication key, if one of them change the
        authentication result may change. 'user' and 'password'
        are exampls, but some auth schemes may have others
        (digest's nonce is an example, digest's nonce_count is a
        *counter-example*). Such parameters must be updated by
        using the update_auth() method.

        :param header: The authentication header sent by the server.
        :param auth: The auth parameters already known. They may be
             updated.
        :returns: True if we can try to handle the authentication.
        N(tNotImplementedErrorRX(R.R`R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRXWscC@st|jdS(sBuild the value of the header used to authenticate.

        :param auth: The auth parameters needed to build the header.
        :param request: The request needing authentication.

        :return: None or header.
        N(Rbtbuild_auth_header(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRckscC@s
d|_dS(sThe authentification was successful for the request.

        Additional infos may be available in the response.

        :param request: The succesfully authenticated request.
        :param response: The server response (may contain auth info).
        N(R*RK(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR\us	cC@stj}|jdd
}|jdd
}|d}|jdd
}|d
kr|j|d|dd|d|dd|dtd	|j|}n|d
k	r|d
kr|j|d|d|d|d|dd|d	|j|}n||fS(sAsk user for a password if none is already available.

        :param auth: authentication info gathered so far (from the initial url
            and then during dialog with the server).
        RCRDtrealmRdRERcRtasktpromptN(	RtAuthenticationConfigRR*tget_userRYtbuild_username_prompttget_passwordtbuild_password_prompt(R.Rt	auth_confRCRDRdRd((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytget_user_passwords"
cC@sVd|djd}|d}|dk	rH|d|jd7}n|d7}|S(	sBuild a prompt taking the protocol used into account.

        The AuthHandler is used by http and https, we want that information in
        the prompt, so we build the prompt from the authentication dict which
        contains all the needed parts.

        Also, http and proxy AuthHandlers present different prompts to the
        user. The daughter classes should implements a public
        build_password_prompt using this method.
        u%sREu %(user)s@%(host)sRdu
, Realm: '%s'tutf8u	 passwordN(tupperR*tdecode(R.RRfRd((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_build_password_prompts

cC@sVd|djd}|d}|dk	rH|d|jd7}n|d7}|S(	sBuild a prompt taking the protocol used into account.

        The AuthHandler is used by http and https, we want that information in
        the prompt, so we build the prompt from the authentication dict which
        contains all the needed parts.

        Also, http and proxy AuthHandlers present different prompts to the
        user. The daughter classes should implements a public
        build_username_prompt using this method.
        u%sREu	 %(host)sRdu
, Realm: '%s'Rnu	 usernameN(RoR*Rp(R.RRfRd((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt_build_username_prompts

cC@sA|j|}|j|r=|j||j||n|S(s;Insert an authentication header if information is available(RUtauth_params_reusableRaRc(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRsN(R2R3R4R*R(RSRYR[R9RNRQR_RaRXRcR\RmRqRrRR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRJs"$				Q			
					tNegotiateAuthHandlercB@sDeZdZdZdZeZdZdZdZ	dZ
RS(sA authentication handler that handles WWW-Authenticate: Negotiate.

    At the moment this handler supports just Kerberos. In the future,
    NTLM support may also be added.
    t	negotiateicC@sq|j|\}}||jkr(tS|j|d||j|}|dkrZtS|j|d|tS(NR(tnegotiate_response(RNR(RVRQt_auth_match_kerberosR*RY(R.R`RR(traw_authR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRXscC@stdkrFtrFyddlaWntk
r<danXtantdkrVdStjd|\}}|dkrtjd|d|dStj|d}|dkrtj	d|dStj
|S(	sBTry to create a GSSAPI response for authenticating against a host.iNs
HTTP@%(host)sis*Unable to create GSSAPI context for %s: %dRcR;sauthGSSClientStep failed: %d(tkerberosR*tchecked_kerberostImportErrorRYtauthGSSClientInitRR%tauthGSSClientStepR\tauthGSSClientResponse(R.Rtrettvc((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRws$

		cC@sd|dS(NsNegotiate %sRv((R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRcscC@s.|jdddko-|jdddk	S(NR(RuRv(RR*(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRss(R2R3R4R(RRVR[RXRwRcRs(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRts			tBasicAuthHandlercB@sSeZdZdZdZejdejZdZ	dZ
dZdZRS(s&A custom basic authentication handler.tbasicisrealm="([^"]*)"cC@s5d|d|df}d|jdj}|S(Ns%s:%sRCRDsBasic tbase64(tencodeR=(R.RRtrawRZ((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRcscC@s:|jj|}d}|r0|jd}n||fS(Ni(tauth_regexptsearchR*tgroup(R.theader_valueRRd((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
extract_realms
c	C@s|j|\}}||jkr(tS|j|\}}|r|j|d||j|d||jdddks|jdddkr|j|\}}|j|d||j|d|qn|dk	S(NR(RdRCRD(RNR(RVRRQRR*Rm(	R.R`RR(RxRRdRCRD((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRXscC@s|jdddkS(NR(R(RR*(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs$s(
R2R3R4R(RR~RtIRRcRRXRs(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs			c@sddd}|dkr$dn|dkr<tjndk	rZfd}n|fS(NtMD5cS@stj|jS(N(Rtmd5t	hexdigest(tx((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR)/stSHAc@sd||fS(Ns%s:%s((tsecretR^(tH(sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR)3s(R*Rt
sha_string(t	algorithmtKD((RsK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytget_digest_algorithm_impls+scC@s6d||tjtjdf}tj|d S(Ns%s:%d:%s:%sii(ttimetctimeRtrandombytesRR(tnoncetnonce_countR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytget_new_cnonce7stDigestAuthHandlercB@s5eZdZdZdZdZdZdZRS(s'A custom digest authentication handler.tdigesticC@s|jdddkS(NR(R(RR*(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRsDsc
C@s|j|\}}||jkr(tStjtj|}|jdd}|dkrbtSt|jdd\}}|dkrtS|jdd}	|j	|d||j	|d|	|jdddks|jdddkr6|j
|\}
}|j	|d|
|j	|d|ny|jdddk	rp|j	|d|jdn|d	}|jd	d|kr|j	|d
dn|j	|d	||j	|d||jdd|d<Wntk
rtSXtS(
NtqopRRRRdR(RCRDRRitopaque(
RNR(RVRtparse_keqv_listtparse_http_listRR*RRQRmRRY(
R.R`RR(Rxtreq_authRRRRdRCRDR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRXJs:0

cC@stj|j\}}tj|\}}d|d|d|df}d|j|f}|d}	|d}
|dd	}d
|}t|	|}
t|jdd\}}d
|	||
|
||f}||||}d}|d|d|d|	f7}|d|7}|d|
|f7}|d|
7}|d|7}|jdd}|r~|d|7}n|jddr|d|jd7}n||d<|S(Ns%s:%s:%sRCRdRDs%s:%sRRRis%08xRRs%s:%s:%s:%s:%ssDigest s%username="%s", realm="%s", nonce="%s"s
, uri="%s"s, cnonce="%s", nc=%ss
, qop="%s"s, response="%s"Rs
, opaque="%s"s, algorithm="%s"(	Rt	splittypeRt	splithostRRRRR*(R.RRt
url_schemeturl_selectortsel_hostRtA1tA2RRRtncvaluetcnonceRRt
nonce_datatrequest_digestR`R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRcts6




(R2R3R4R(RRsRXRc(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR=s		*tHTTPAuthHandlercB@sGeZdZdZdZdZdZdZdZdZ	RS(sCustom http authentication handler.

    Send the authentication preventively to avoid the roundtrip
    associated with the 401 error and keep the revelant info in
    the auth request attribute.
    swww-authenticateRcC@s|jS(s$Get the auth params from the request(R(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRUscC@s
||_dS(s#Set the auth params for the requestN(R(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pytset_authscC@s
|j|S(N(Rq(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRkscC@s
|j|S(N(Rr(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRiscC@s|j||S(N(R_(R.R	R
RRR)((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pythttp_error_401s(
R2R3R4RTRZRURRkRiR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs				tProxyAuthHandlercB@sGeZdZdZdZdZdZdZdZdZ	RS(sCustom proxy authentication handler.

    Send the authentication preventively to avoid the roundtrip
    associated with the 407 error and keep the revelant info in
    the proxy_auth request attribute..
    sproxy-authenticatesProxy-authorizationcC@s|jS(s$Get the auth params from the request(R(R.R((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRUscC@s
||_dS(s#Set the auth params for the requestN(R(R.RR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRscC@s|j|}d|}|S(NuProxy (Rq(R.RRf((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRks
cC@s|j|}d|}|S(NuProxy (Rr(R.RRf((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRis
cC@s|j||S(N(R_(R.R	R
RRR)((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pythttp_error_407s(
R2R3R4RTRZRURRkRiR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs				tHTTPBasicAuthHandlercB@seZdZRS(s(Custom http basic authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstProxyBasicAuthHandlercB@seZdZRS(s)Custom proxy basic authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstHTTPDigestAuthHandlercB@seZdZRS(s(Custom http basic authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstProxyDigestAuthHandlercB@seZdZRS(s)Custom proxy basic authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstHTTPNegotiateAuthHandlercB@seZdZRS(s,Custom http negotiate authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstProxyNegotiateAuthHandlercB@seZdZRS(s-Custom proxy negotiate authentication handler(R2R3R4(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstHTTPErrorProcessorcB@s,eZdZdddgZdZeZRS(sProcess HTTP error responses.

    We don't really process the errors, quite the contrary
    instead, we leave our Transport handle them.
    iiicC@su|j|j|j}}}|j}|dkrA|j}n||krq|jjd|||||}n|S(NRu(RRRRR*RR'(R.RRRRRR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt
http_responses 	(R2R3R4RRthttps_response(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRs		tHTTPDefaultErrorHandlercB@seZdZdZRS(s+Translate common errors into bzr ExceptionscC@sN|dkr(tjd|jn"tj|jd||fdS(Nis<Server refuses to fulfill the request (403 Forbidden) for %ss!Unable to handle http code %d: %s(RtTransportErrorRR(R.R	R
RRR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pythttp_error_defaults(R2R3R4R(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyRstOpenercB@s&eZdZeeedddZRS(spA wrapper around urllib2.build_opener

    Daughter classes can override to build their own specific opener
    cC@stj|d|d|||tttttttt	t
t
|_|jj
|_
tdkrddl}|j|jjndS(NR8Rti	i(Rtbuild_openerR&RRRRRRRRRt_openerRRtpprintt__dict__(R.RtredirectR'R8RtR((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR9)s"N(R2R3R4RRRR*R9(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyR"s(LR4t
__future__RRRlR+RRkRRRR~R
RtbzrlibRR
RRRRRRRR	R
tglobalsRRRR R!tOptiontopt_ssl_ca_certstopt_ssl_cert_reqsRVRzR*RyR(tobjectR5RBRNRMR`RhRRRRRtBaseHandlerRRRRRR&RJRtRRRRRRRRRRRRRRR(((sK/usr/lib/python2.7/dist-packages/bzrlib/transport/http/_urllib2_wrappers.pyt<module>%s
@				
			!Q?	'=; C%v8+		^$ 

Copyright © 2017 || Recoded By Mr.Bumblebee