usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyo000064400000025150147205661450021120 0ustar00 abc@@s\ddlmZddlZddlZddlZddlZddlZddlmZm Z ddl Z ddl m Z ddlmZddlmZyddlZejZWn3eefk rdZdefd 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/Z0idd6dd6Z1ej2dddZ3de4fdYZ5dee4fdYZdefdYZ6de6fdYZ7dZ8erRe6Z9e7Z6ne5Z6dS(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(tHTTPHeaderDictiPthttpithttpsitDummyConnectioncB@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 dZ dZ dZ dZdddZRS( 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|jddn|jd|_tjdkrP|jddn|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@si}|jr|j|dsN          "(  &l  usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pyo000064400000007437147206115160022076 0ustar00 abc@@sddlmZddlZddlmZddlmZmZdZej dddZ dZ d Z d Zed ZdS( i(tabsolute_importNi(t wait_for_read(t HAS_SELECTt SelectorErrorcC@sot|dt}|tkr"tS|dkr2tSts<tSytt|ddSWntk rjtSXdS(s  Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycling transparently for us. tsockttimeoutgN(tgetattrtFalsetNonetTrueRtboolRR(tconnR((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pytis_connection_droppeds    cC@sO|\}}|jdr-|jd}nd}t}xtj|||tjD]}|\} } } } } d}yltj| | | }t|||tjk r|j |n|r|j |n|j | |SWqXtj k r"}|}|dk r#|j d}q#qXXqXW|dk r<|ntj ddS(sdConnect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. t[s[]s!getaddrinfo returns an empty listN(t startswithtstripRtallowed_gai_familytsockett getaddrinfot SOCK_STREAMt_set_socket_optionst_GLOBAL_DEFAULT_TIMEOUTt settimeouttbindtconnectterrortclose(taddressRtsource_addresstsocket_optionsthosttportterrtfamilytrestaftsocktypetprotot canonnametsaRte((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pytcreate_connection$s2  "      cC@s2|dkrdSx|D]}|j|qWdS(N(Rt setsockopt(Rtoptionstopt((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pyRXs  cC@stj}trtj}n|S(sThis function is designed to work in the context of getaddrinfo, where family=socket.AF_UNSPEC is the default and will perform a DNS search for both IPv6 and IPv4 records.(RtAF_INETtHAS_IPV6t AF_UNSPEC(R!((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pyR`s  cC@srd}t}tjr[y/tjtj}|j|dft}Wq[tk rWq[Xn|rn|jn|S(s6 Returns True if the system can bind an IPv6 address. iN( RRRthas_ipv6tAF_INET6RR t ExceptionR(RRR0((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pyt _has_ipv6ks    s::1(t __future__RRtwaitRt selectorsRRR RRR)RRR3R.(((sG/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/connection.pyts  3