ok

Mini Shell

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

�
��abc@@s\ddlmZddlZddlZddlZddlZddlZddlmZm	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�Z3de4fd��YZ5dee4fd��YZdefd��YZ6de6fd��YZ7d�Z8erRe6Z9e7Z6ne5Z6dS(i(tabsolute_importN(terrorttimeouti(tsix(tHTTPConnection(t
HTTPExceptiontBaseSSLErrorcB@seZRS((t__name__t
__module__(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRstConnectionErrorcB@seZRS((RR(((sB/usr/lib/python2.7/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�tDummyConnectioncB@seZdZRS(s-Used to detect a failed ConnectionCls import.(RRt__doc__(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRAsRcB@sieZdZedZejejdfgZe	Z
d�Zd�Zd�Z
d�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.

        .. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x

      - ``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@stjr|jdd�n|jd�|_tjdkrP|jdd�n|jd|j�|_	t
j|||�dS(Ntstricttsource_addressiitsocket_options(ii(RtPY3tpoptNonetgetRtsystversion_infotdefault_socket_optionsRt_HTTPConnectiont__init__(tselftargstkw((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR&js	cC@s�i}|jr|j|d<n|jr8|j|d<ny(tj|j|jf|j|�}WnWtk
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_connectionthosttportRt
SocketTimeoutRtSocketErrorR
(R'textra_kwtconnte((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt	_new_conns 		"cC@s5||_t|dd�r1|j�d|_ndS(Nt_tunnel_hosti(tsocktgetattrR t_tunnelt	auto_open(R'R0((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt
_prepare_conn�s	
cC@s|j�}|j|�dS(N(R2R8(R'R0((sB/usr/lib/python2.7/site-packages/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	rytjtjf}	t	||	�r�|f}nx�|D]�}
|
s�q�nt	|
tj�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_typestbinary_typet
isinstancetencodethextlentsend(R'tmethodturltbodytheadersR:R;theadertvaluetstringish_typestchunktlen_str((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pytrequest_chunked�s8



N(RRRtport_by_schemetdefault_porttsockettIPPROTO_TCPtTCP_NODELAYR$tFalsetis_verifiedR&R2R8R9R RR(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRFs
				tHTTPSConnectioncB@s?eZedZdZddddejdd�Zd�Z	RS(Rc		K@sJtj|||d|d||�||_||_||_d|_dS(NRRR(RR&tkey_filet	cert_filetssl_contextt	_protocol(	R'R+R,R[R\RRR]R)((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR&�s
			c	C@s�|j�}|j|�|jdkrOtdtd�dtd��|_ntd|d|jd|j	d|j�|_
dS(Ntssl_versiont	cert_reqsR4tkeyfiletcertfileR](R2R8R]R RRRRR[R\R4(R'R0((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR9�s
		N(
RRRSRTR R_RUt_GLOBAL_DEFAULT_TIMEOUTR&R9(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRZ�s
		
tVerifiedHTTPSConnectioncB@sSeZdZdZdZdZdZdZdddddddd�Z	d�Z
RS(s[
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    cC@s�|dkrB|s|r!d}qB|jdk	rB|jj}qBn||_||_||_||_||_|o�tj	j
|�|_|o�tj	j
|�|_dS(sX
        This method should only be called once, before the connection is used.
        t
CERT_REQUIREDN(
R R]tverify_modeR[R\R`tassert_hostnameRtostpatht
expandusertca_certstca_cert_dir(R'R[R\R`RkRgRRl((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pytset_certs						cC@s�|j�}|j}t|dd�rO||_|j�d|_|j}ntj	j
�tk}|r�tj
djt�t�n|jdkr�tdt|j�dt|j��|_n|j}t|j�|_td|d|jd|jd	|jd
|jd|d|�|_|jrJt|jjd
t�|j�n�|jtj kr�t|dt!�r�|j"t!k	r�|jj�}|j#dd�s�tj
dj|�t$�nt%||j"p�|�n|jtj&kp�|jdk	|_'dS(NR3isWSystem time is way off (before {0}). This will probably lead to SSL verification errorsR_R`R4RaRbRkRltserver_hostnameR]tbinary_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.)(((R2R+R5R R4R6R7R3tdatetimetdatettodaytRECENT_DATEtwarningstwarntformatR
R]RRR_RR`RfRR[R\RkRlRtgetpeercerttTruetsslt	CERT_NONERXRgR!Rt_match_hostnameReRY(R'R0thostnametis_time_offtcontexttcert((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR9sT		
	
						

N(RRRR R`RkRlR_RRmR9(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRd�scC@sJyt||�Wn2tk
rE}tjd||�||_�nXdS(Ns@Certificate did not match expected hostname: %s. Certificate: %s(RRtlogRt
_peer_cert(R�tasserted_hostnameR1((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR}bs
	(:t
__future__RRrtloggingRhR"RURR.RR-RvtpackagesRtpackages.six.moves.http_clientRR%RR{tSSLErrorRtImportErrortAttributeErrorR t
BaseExceptionR	t	NameErrort	Exceptiont
exceptionsR
RRR
tpackages.ssl_match_hostnameRRt	util.ssl_RRRRRtutilRt_collectionsRt	getLoggerRR�RSRsRutobjectRRZRdR}tUnverifiedHTTPSConnection(((sB/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt<module>sN


"(	
�&l		

Zerion Mini Shell 1.0