????

Your IP : 216.73.216.152


Current Path : /proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_vendor/urllib3/
Upload File :
Current File : //proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyc

�
}�\]c@@sPddlmZddlZddlZddlZddlZddlmZmZ	ddl
Z
ddlmZddl
mZddl
mZyddlZejZWn3eefk
r�dZdefd	��YZnXy
eZWn'ek
rd
efd��YZnXddlmZmZmZmZdd
l m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ej-e.�Z/idd6dd6Z0ej1ddd�Z2de3fd��YZ4dee3fd��YZdefd��YZ5de5fd��YZ6d �Z7erFe5Z8e6Z5ne4Z5dS(!i(tabsolute_importN(terrorttimeouti(tsix(tHTTPConnection(t
HTTPExceptiontBaseSSLErrorcB@seZRS((t__name__t
__module__(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyRstConnectionErrorcB@seZRS((RR(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR	s(tNewConnectionErrortConnectTimeoutErrortSubjectAltNameWarningtSystemTimeWarning(tmatch_hostnametCertificateError(tresolve_cert_reqstresolve_ssl_versiontassert_fingerprinttcreate_urllib3_contexttssl_wrap_socket(t
connection(tHTTPHeaderDictiPthttpi�thttpsi�iitDummyConnectioncB@seZdZRS(s-Used to detect a failed ConnectionCls import.(RRt__doc__(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyRBsRcB@s�eZdZedZejejdfgZe	Z
d�Zed��Z
e
jd��Z
d�Zd�Zd�Zd
d
d	�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]tjr|jdd�n|jd�|_|jd|j�|_tj	|||�dS(Ntstricttsource_addresstsocket_options(
RtPY3tpoptNonetgetRtdefault_socket_optionsRt_HTTPConnectiont__init__(tselftargstkw((s=/tmp/pip-install-ewDPok/pip/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%((s=/tmp/pip-install-ewDPok/pip/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((s=/tmp/pip-install-ewDPok/pip/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((s=/tmp/pip-install-ewDPok/pip/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((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyt
_prepare_conn�s	
cC@s|j�}|j|�dS(N(R4R:(R%R2((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pytconnect�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 t
putrequesttitemst	putheadert
endheadersRtstring_typestbytest
isinstancetencodethextlentsend(R%tmethodturltbodytheadersR<R=theaderR,tstringish_typestchunktlen_str((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pytrequest_chunked�s8



N(RRRtport_by_schemetdefault_porttsockettIPPROTO_TCPtTCP_NODELAYR"tFalsetis_verifiedR$tpropertyR+tsetterR4R:R;R RS(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyRGs
	

				tHTTPSConnectionc	B@sEeZedZdZdddddejddd�Zd�Z	RS(Rc
	K@s\tj|||d|d||
�||_||_||_||_|	|_d|_dS(NRRR(RR$tkey_filet	cert_filetkey_passwordtssl_contexttserver_hostnamet	_protocol(R%R+R.R^R_R`RRRaRbR'((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR$�s
					cC@s�|j�}|j|�t}|jdkrat}tdt|j�dt	|j
��|_n|j}|jr�|jr�|r�t
|d�r�|j�ntd|d|jd|jd|jd|jd	|j�|_dS(
Ntssl_versiont	cert_reqstload_default_certsR6tkeyfiletcertfileR`RaRb(R4R:RYRaR tTrueRRRdRRetca_certstca_cert_dirthasattrRfRR^R_R`RbR6(R%R2tdefault_ssl_contexttcontext((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR;�s&
	
				N(
RRRTRUR RdRVt_GLOBAL_DEFAULT_TIMEOUTR$R;(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR]�s
	tVerifiedHTTPSConnectionc	B@sVeZdZdZdZdZdZdZddddddddd�Z	d�Z
RS(s[
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    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 Ratverify_modeRR^R_ReR`tassert_hostnameRtostpatht
expanduserRjRk(	R%R^R_ReR`RjRrRRk((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pytset_cert"s							cC@sh|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r@|jr@|r@t|d�r@|j�ntd|d|jd	|j d
|j!d|jd|jd
|d|�|_|j"r�t"|jj#dt�|j"�n�|jt$j%kr@t|dt�r@|j&tk	r@|jj#�}|j'dd�s't
jdj|�t(�nt)||j&p9|�n|jt$j*kp^|j"dk	|_+dS(NR5isWSystem time is way off (before {0}). This will probably lead to SSL verification errorsRdReRfR6RgRhR`RjRkRbRatbinary_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/shazow/urllib3/issues/497 for details.)((,R4R+R7R R6R8R9R5RbtdatetimetdatettodaytRECENT_DATEtwarningstwarntformatR
RYRaRiRRRdRReRqRjRkRlRfRR^R_R`Rtgetpeercerttsslt	CERT_NONERrR!Rt_match_hostnamet
CERT_REQUIREDRZ(R%R2thostnameRbtis_time_offRmRntcert((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR;:sf		
	
	
						

N(RRRR ReRjRkRdRRvR;(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyRps	cC@sJyt||�Wn2tk
rE}tjd||�||_�nXdS(Ns@Certificate did not match expected hostname: %s. Certificate: %s(RRtlogRt
_peer_cert(R�tasserted_hostnameR3((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyR��s
	(9t
__future__RRztloggingRsRVRR0RR/R~tpackagesRtpackages.six.moves.http_clientRR#RR�tSSLErrorRtImportErrortAttributeErrorR t
BaseExceptionR	t	NameErrort	Exceptiont
exceptionsR
RRR
tpackages.ssl_match_hostnameRRt	util.ssl_RRRRRtutilRt_collectionsRt	getLoggerRR�RTR{R}tobjectRR]RpR�tUnverifiedHTTPSConnection(((s=/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/connection.pyt<module>sL


"(	
�6w