Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyc

σ
“tΖ_c@@sOddlmZddlZddlZddlZddlZddlZddlmZm	Z
ddlZddlm
Z
ddlmZddlmZyddlZejZWn3eefk
rμdZdefd	„ƒYZnXy
eZWn'ek
r d
efd„ƒYZnXddlmZmZmZm Z dd
l!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ej.e/ƒZ0idd6dd6Z1ej2dddƒZ3ej4dƒZ5de6fd„ƒYZ7dee6fd„ƒYZdefd„ƒYZ8d„Z9esEe7Z8ne8Z:dS(i(tabsolute_importN(terrorttimeouti(tsix(tHTTPConnection(t
HTTPExceptiontBaseSSLErrorcB@seZRS((t__name__t
__module__(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyRstConnectionErrorcB@seZRS((RR(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR	s(tNewConnectionErrortConnectTimeoutErrortSubjectAltNameWarningtSystemTimeWarning(tmatch_hostnametCertificateError(tresolve_cert_reqstresolve_ssl_versiontassert_fingerprinttcreate_urllib3_contexttssl_wrap_socket(t
connection(tHTTPHeaderDictiPthttpi»thttpsiγs[^-!#$%&'*+.^_`|~0-9a-zA-Z]tDummyConnectioncB@seZdZRS(s-Used to detect a failed ConnectionCls import.(RRt__doc__(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyRAsRcB@s“eZdZedZejejdfgZe	Z
d„Zed„ƒZ
e
jd„ƒZ
d„Zd„Zd„Zd	„Zddd
„ZRS(s$
    Based on httplib.HTTPConnection but provides an extra constructor
    backwards-compatibility layer between older and newer Pythons.

    Additional keyword parameters are used to configure attributes of the connection.
    Accepted parameters include:

      - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
      - ``source_address``: Set the source address for the current connection.
      - ``socket_options``: Set specific options on the underlying socket. If not specified, then
        defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
        Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.

        For example, if you wish to enable TCP Keep Alive in addition to the defaults,
        you might pass::

            HTTPConnection.default_socket_options + [
                (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
            ]

        Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).
    RicO@s]tjs|jddƒn|jdƒ|_|jd|jƒ|_tj	|||ŽdS(Ntstricttsource_addresstsocket_options(
RtPY2tpoptNonetgetRtdefault_socket_optionsRt_HTTPConnectiont__init__(tselftargstkw((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR$hs
	cC@s|jjdƒS(sŸ
        Getter method to remove any trailing dots that indicate the hostname is an FQDN.

        In general, SSL certificates don't include the trailing dot indicating a
        fully-qualified domain name, and thus, they don't validate properly when
        checked against a domain name that includes the dot. In addition, some
        servers may not expect to receive the trailing dot when provided.

        However, the hostname with trailing dot is critical to DNS resolution; doing a
        lookup with the trailing dot will properly only resolve the appropriate FQDN,
        whereas a lookup without a trailing dot will search the system's search domain
        list. Thus, it's important to keep the original host around for use only in
        those cases where it's appropriate (i.e., when doing DNS lookup to establish the
        actual TCP connection across which we're going to send HTTP requests).
        t.(t	_dns_hosttrstrip(R%((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pythostuscC@s
||_dS(sΧ
        Setter for the `host` property.

        We assume that only urllib3 uses the _dns_host attribute; httplib itself
        only uses `host`, and it seems reasonable that other libraries follow suit.
        N(R)(R%tvalue((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR+ˆscC@sΌi}|jr|j|d<n|jr8|j|d<ny(tj|j|jf|j|}WnUtk
r’t|d|j	|jfƒ‚n&t
k
r·}t|d|ƒ‚nX|S(sp Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        RRs0Connection to %s timed out. (connect timeout=%s)s(Failed to establish a new connection: %s(RRRtcreate_connectionR)tportRt
SocketTimeoutRR+tSocketErrorR
(R%textra_kwtconnte((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyt	_new_conn’s"		"
cC@s5||_t|ddƒr1|jƒd|_ndS(Nt_tunnel_hosti(tsocktgetattrR t_tunnelt	auto_open(R%R2((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyt
_prepare_conn±s	
cC@s|jƒ}|j|ƒdS(N(R4R:(R%R2((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pytconnectΊscO@sMtj|ƒ}|r4td||jƒfƒ‚ntj|||||ŽS(sSend a request to the serversAMethod cannot contain non-token characters %r (found at least %r)(t_CONTAINS_CONTROL_CHAR_REtsearcht
ValueErrortgroupR#t
putrequest(R%tmethodturlR&tkwargstmatch((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR@ΎscC@s„t|d
k	r|niƒ}d|k}d|k}|j||d|d|ƒx*|jƒD]\}}|j||ƒq_Wd|krž|jddƒn|jƒ|d
k	rstjtf}	t	||	ƒrί|f}nx‘|D]†}
|
sψqζnt	|
tƒs|
j
dƒ}
ntt|
ƒƒd	}|j
|j
d
ƒƒ|j
dƒ|j
|
ƒ|j
dƒqζWn|j
dƒd
S(sƒ
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        saccept-encodingR+tskip_accept_encodingt	skip_hoststransfer-encodingsTransfer-Encodingtchunkedtutf8isutf-8s
s0

N(RR R@titemst	putheadert
endheadersRtstring_typestbytest
isinstancetencodethextlentsend(R%RARBtbodytheadersRERFtheaderR,tstringish_typestchunktlen_str((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pytrequest_chunkedΙs2



N(RRRtport_by_schemetdefault_porttsockettIPPROTO_TCPtTCP_NODELAYR"tFalsetis_verifiedR$tpropertyR+tsetterR4R:R;R@R RY(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyRGs
	

					tHTTPSConnectionc
B@s‡eZedZdZdZdZdZdZ	dZ
dddddejddd„Z
dddddddddd„	Zd„ZRS(Rc
	K@s\tj|||d|d||
||_||_||_||_|	|_d|_dS(NRRR(RR$tkey_filet	cert_filetkey_passwordtssl_contexttserver_hostnamet	_protocol(R%R+R.RdReRfRRRgRhR'((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR$χs"					c

C@s²|dkr9|jdk	r*|jj}q9tdƒ}n||_||_||_||_||_||_	|o„t
jj|ƒ|_
|oŸt
jj|ƒ|_|	|_dS(sX
        This method should only be called once, before the connection is used.
        N(R Rgtverify_modeRRdRet	cert_reqsRftassert_hostnameRtostpatht
expandusertca_certstca_cert_dirtca_cert_data(
R%RdReRkRfRpRlRRqRr((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pytset_certs						cC@s{|jƒ}|j}t|ddƒrO||_|jƒd|_|j}n|}|jdk	rp|j}nt	j
jƒtk}|r§t
jdjtƒtƒnt}|jdkrοt}tdt|jƒdt|jƒƒ|_n|j}t|jƒ|_|jrJ|jrJ|jrJ|rJt|dƒrJ|jƒntd|d|j d	|j!d
|j"d|jd|jd
|jd|d|ƒ	|_|j#rΙt#|jj$dtƒ|j#ƒnŠ|jt%j&krSt|dtƒrS|j'tk	rS|jj$ƒ}|j(ddƒs:t
jdj|ƒt)ƒnt*||j'pL|ƒn|jt%j+kpq|j#dk	|_,dS(NR5isWSystem time is way off (before {0}). This will probably lead to SSL verification errorstssl_versionRktload_default_certsR6tkeyfiletcertfileRfRpRqRrRhRgtbinary_formtcheck_hostnametsubjectAltNamesλCertificate for {0} has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)((-R4R+R7R R6R8R9R5RhtdatetimetdatettodaytRECENT_DATEtwarningstwarntformatR
R_RgtTrueRRRtRRkRjRpRqRrthasattrRuRRdReRfRtgetpeercerttsslt	CERT_NONERlR!Rt_match_hostnamet
CERT_REQUIREDR`(R%R2thostnameRhtis_time_offtdefault_ssl_contexttcontexttcert((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR;2sn		
	
	



							
N(RRRZR[R RkRpRqRrRtRR\t_GLOBAL_DEFAULT_TIMEOUTR$RsR;(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyRcνs2
cC@sJyt||ƒWn2tk
rE}tjd||ƒ||_‚nXdS(Ns@Certificate did not match expected hostname: %s. Certificate: %s(RRtlogtwarningt
_peer_cert(Rtasserted_hostnameR3((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyR‡”s	(;t
__future__RtreR{tloggingRmR\RR0RR/RtpackagesRtpackages.six.moves.http_clientRR#RR…tSSLErrorRtImportErrortAttributeErrorR t
BaseExceptionR	t	NameErrort	Exceptiont
exceptionsR
RRR
tpackages.ssl_match_hostnameRRt	util.ssl_RRRRRtutilRt_collectionsRt	getLoggerRRRZR|R~tcompileR<tobjectRRcR‡tVerifiedHTTPSConnection(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/connection.pyt<module>sH


"(	¦§		
Back to Directory File Manager