R`i% d dl mZ d dlZddlmZ ddlmZ ddlmZ ddl m
Z
mZ d Zej ddfd
Zd Zd Zd
Z ed Zy) )absolute_importN )_appengine_environ)LocationParseError)six )NoWayToWaitForSocketError
wait_for_readc f t | dd }|du ry|y t |d S # t $ r Y yw xY w)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.
sockFTg )timeout)getattrr
r )connr s /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_vendor/urllib3/util/connection.pyis_connection_droppedr sH 4'Du}|T3//$ s $ 00c | \ }}|j d r|j d }d}t } |j d t j |||t j D ]z }|\ } }
}}}
d} t j | |
| }t || |t j ur|j | |r|j | |j |
|c S ||t j d # t $ r% t j t d|z d cY S w xY w# t j $ r }|}||j# d}Y d}~d}~ww xY w)ak 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:`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_familyencodeUnicodeErrorr
raise_fromr socketgetaddrinfoSOCK_STREAM_set_socket_options_GLOBAL_DEFAULT_TIMEOUT
settimeoutbindconnecterrorclose)addressr
source_addresssocket_optionshostporterrfamilyresafsocktypeproto canonnamesar es r create_connectionr3 % sZ $ JD$szz$
C
!F
F !!$ff6H6HI-0*HeY ==Xu5D
n5f<<<( .)LLK J,
,,:
;;=
~~?$FG
* || C
s* D :A+D3+D0/D03E&E!!E&c 6 |y |D ] } | j | y )N)
setsockopt)r optionsopts r r r d s" c R t j } t rt j } | 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 r r r l s
^^F!!Mr8 c d}d}t j ryt j r9 t j t j }|j | df d}|r|j |S # t $ r Y w xY w)z4Returns True if the system can bind an IPv6 address.NFr T)r is_appengine_sandboxr has_ipv6AF_INET6r! Exceptionr$ )r( r r? s r _has_ipv6rB w sw DH ..0
==1DIItQi H
O s 8A7 7 BBz::1)
__future__r r contribr
exceptionsr packagesr waitr r
r r r3 r r rB r; r8 r