/usr/lib/python2.7/site-packages/urllib3/util
Edit: /usr/lib/python2.7/site-packages/urllib3/util/connection.pyc (3838B)
ó
nf·\c @@ s‹ d d l m Z d d l Z d d l m Z m Z d d l m Z d „ Z e j d d d „ Z d „ Z d
„ Z
d „ Z e d ƒ Z d S(
i ( t absolute_importNi ( t NoWayToWaitForSocketErrort
wait_for_readi ( t _appengine_environc C@ s_ t | d t ƒ } | t k r" t S| d k r2 t Sy t | d d ƒSWn t k
rZ t SXd S( 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.
t sockt timeoutg N( t getattrt Falset Nonet TrueR R ( t connR ( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyt is_connection_dropped s
c C@ sO | \ } } | j d ƒ r- | j d ƒ } n d } t ƒ } xè t j | | | t j ƒ D]Ë } | \ } }
} } }
d } yl t j | |
| ƒ } t | | ƒ | t j k r½ | j | ƒ n | rÓ | j
| ƒ n | j |
ƒ | SWqX t j k
r"} | } | d k r#| j
ƒ d } q#qX XqX W| d k r<| ‚ n t j d ƒ ‚ d S( sd Connect 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
startswitht stripR t allowed_gai_familyt sockett getaddrinfot SOCK_STREAMt _set_socket_optionst _GLOBAL_DEFAULT_TIMEOUTt
settimeoutt bindt connectt errort close( t addressR t source_addresst socket_optionst hostt portt errt familyt rest aft socktypet protot canonnamet saR t e( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyt create_connection! s2 "
c C@ s2 | d k r d Sx | D] } | j | Œ q Wd S( N( R t
setsockopt( R t optionst opt( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyR U s
c C@ s t j } t r t j } n | S( s³ This 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.( R t AF_INETt HAS_IPV6t AF_UNSPEC( R ( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyR ] s c C@ s‚ d } t } t j ƒ r t St j rk y/ t j t j ƒ } | j | d f ƒ t } Wqk t k
rg qk Xn | r~ | j
ƒ n | S( s6 Returns True if the system can bind an IPv6 address. i N( R R R t is_appengine_sandboxR t has_ipv6t AF_INET6R R t ExceptionR ( R R R0 ( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyt _has_ipv6h s
s ::1( t
__future__R R t waitR R t contribR R R R R( R R R3 R- ( ( ( s; /usr/lib/python2.7/site-packages/urllib3/util/connection.pyt
s 3