mf,ddlmZddlZddlmZddlmZddlmZddl m Z m Z d Z ej ddfd Zd Zd Zd ZedZdS))absolute_importN)LocationParseError)_appengine_environ)six)NoWayToWaitForSocketError wait_for_readc~t|dd}|durdS|dS t|dS#t$rYdSwxYw)a$ 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. sockFNTg)timeout)getattrr r )connr s N/opt/imunify360/venv/lib64/python3.11/site-packages/urllib3/util/connection.pyis_connection_droppedr sg 4 ' 'D u}}u |tT3//// $uus . <<c|\}}|dr|d}d}t} |dn5#t$r(t jtd|zdcYSwxYwtj |||tj D]}|\} } } } } d} tj| | | }t|||tj ur| ||r|||| |cS#tj$r$}|}||d}Yd}~d}~wwxYw||tjd)akConnect 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. [z[]Nidnaz'%s', label empty or too longz!getaddrinfo returns an empty list) startswithstripallowed_gai_familyencode UnicodeErrorr raise_fromrsocket getaddrinfo SOCK_STREAM_set_socket_options_GLOBAL_DEFAULT_TIMEOUT settimeoutbindconnecterrorclose)addressr source_addresssocket_optionshostporterrfamilyresafsocktypeproto canonnamesar es rcreate_connectionr3&s$JD$ s zz$ C  ! !F  F    ~ ?$F G G      !$ff6HII-0*HeY =Xu55D n 5 5 5f<<<((( * .))) LL   KKK|   C      ,: ; ;;s+A/B B :A6D33E&E!!E&c,|dS|D] }|j| dS)N) setsockopt)r optionsopts rrres7cDtj}tr tj}|S)zThis 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.)rAF_INETHAS_IPV6 AF_UNSPEC)r+s rrrms ^F"! Mr8cd}d}tjrdStjrI tjtj}||dfd}n#t $rYnwxYw|r||S)z4Returns True if the system can bind an IPv6 address.NFrT)ris_appengine_sandboxrhas_ipv6AF_INET6r! Exceptionr$)r(r r?s r _has_ipv6rBxs DH .00u    =11D IItQi HH    D   Os7A A,+A,z::1) __future__rrurllib3.exceptionsrcontribrpackagesrwaitr r rrr3rrrBr;r8rrIs&&&&&& 111111((((((::::::::8  * <<<<<<<<~< 9U  r8