ó Eu\dc@@s«ddlmZddlZddlmZddlmZddlmZddl m Z m Z d „Z ej ddd „Zd „Zd „Zd „ZedƒZdS(i(tabsolute_importNi(t_appengine_environ(tLocationParseError(tsixi(tNoWayToWaitForSocketErrort wait_for_readcC@s_t|dtƒ}|tkr"tS|dkr2tSyt|ddƒSWntk rZtSXdS(s$ Returns True if the connection is dropped and should be closed. :param conn: :class:`http.client.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycling transparently for us. tsockttimeoutgN(tgetattrtFalsetNonetTrueRR(tconnR((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pytis_connection_dropped s    cC@s‹|\}}|jdƒr-|jdƒ}nd}tƒ}y|jdƒWn(tk rwtjtd|ƒdƒSXxèt j |||t j ƒD]Ë}|\} } } } } d}ylt j | | | ƒ}t ||ƒ|t j k rù|j|ƒn|r|j|ƒn|j| ƒ|SWq”t jk r^}|}|dk r_|jƒd}q_q”Xq”W|dk rx|‚nt jdƒ‚dS(skConnect 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:`socket.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[]tidnau'%s', label empty or too longs!getaddrinfo returns an empty listN(t startswithtstripR tallowed_gai_familytencodet UnicodeErrorRt raise_fromRtsockett getaddrinfot SOCK_STREAMt_set_socket_optionst_GLOBAL_DEFAULT_TIMEOUTt settimeouttbindtconnectterrortclose(taddressRtsource_addresstsocket_optionsthosttportterrtfamilytrestaftsocktypetprotot canonnametsaRte((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pytcreate_connection%s<   "      cC@s2|dkrdSx|D]}|j|ŒqWdS(N(R t setsockopt(Rtoptionstopt((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pyRds  cC@stj}trtj}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.(RtAF_INETtHAS_IPV6t AF_UNSPEC(R&((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pyRls  cC@s‚d}t}tjƒrtStjrky/tjtjƒ}|j|dfƒt}Wqkt k rgqkXn|r~|j ƒn|S(s4Returns True if the system can bind an IPv6 address.iN( R R Rtis_appengine_sandboxRthas_ipv6tAF_INET6RR t ExceptionR(R#RR6((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pyt _has_ipv6ws     s::1(t __future__RRtcontribRt exceptionsRtpackagesRtwaitRRR RR R.RRR9R3(((sp/private/var/folders/49/mc35vj0j30g7w0ryjvyy2vz80000gs/T/pip-target-MP7kiJ/lib/python/urllib3/util/connection.pyts   ;