igddlmZddlZddlZddlmZddlmZmZej ej e e ej e e ffZejrddlmZd!d Zeddfd"dZd#dZd$dZd%dZed ZdS)&) annotationsN)LocationParseError)_DEFAULT_TIMEOUT _TYPE_TIMEOUT)BaseHTTPConnectionconnr returnboolc|j S)z Returns True if the connection is dropped and should be closed. :param conn: :class:`urllib3.connection.HTTPConnection` object. ) is_connected)r s /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/urllib3/util/connection.pyis_connection_droppedrs   addresstuple[str, int]timeoutrsource_addresstuple[str, int] | Nonesocket_options_TYPE_SOCKET_OPTIONS | None socket.socketc|\}}|dr|d}d}t} |dn"#t$rt d|ddwxYwt j|||t jD]}|\} } } } } d} t j| | | }t|||tur| ||r| || | d}|cS#t$r"}|}||Yd}~d}~wwxYw| |#d}wxYwtd)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[]Nidna'z', label empty or too longz!getaddrinfo returns an empty list) startswithstripallowed_gai_familyencode UnicodeErrorrsocket getaddrinfo SOCK_STREAM_set_socket_optionsr settimeoutbindconnectOSErrorclose)rrrrhostporterrfamilyresafsocktypeproto canonnamesasock_s rcreate_connectionr8s$JD$ s zz$ C  ! !FQ F QQQ !ET!E!E!EFFDPQ!$ff6HII-0*HeY =Xu55D n 5 5 5...((( * .))) LL   CKKK   C     ICJJJJ9:::s1AA6'A3D E 'EE EEr6optionsNonec,|dS|D] }|j| dS)N) setsockopt)r6r9opts rr&r&]s9rsocket.AddressFamilycDtj}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.)r#AF_INETHAS_IPV6 AF_UNSPEC)r/s rr r gs ^F"! Mrr,strcd}d}tjrI tjtj}||dfd}n#t$rYnwxYw|r||S)z4Returns True if the system can bind an IPv6 address.NFrT)r#has_ipv6AF_INET6r( Exceptionr+)r,r6rEs r _has_ipv6rHrs DH    =11D IItQi HH    D   Os7A AAz::1)r r r r ) rrrrrrrrr r)r6rr9rr r:)r r>)r,rCr r ) __future__rr#typing exceptionsrrrrSequenceTupleintUnionbytes_TYPE_SOCKET_OPTIONS TYPE_CHECKING_base_connectionr rr8r&r rHrArrrUs!"""""" ++++++44444444v|Cfl3PU:>V4V'WX 6555555!!!!.-126 ?;?;?;?;?;D. 9U  r