/usr/lib/python3.9/site-packages/urllib3/util/__pycache__
Edit: /usr/lib/python3.9/site-packages/urllib3/util/__pycache__/connection.cpython-39.pyc (3401B)
a
t~®`, ã @ s† d dl mZ d dlZd dlmZ ddlmZ ddlmZ ddl m
Z
mZ d d
„ Zej
ddfdd„Zd
d„ Zdd„ Zdd„ ZedƒZdS )é )Úabsolute_importN)ÚLocationParseErroré )Ú_appengine_environ)Úsixé )ÚNoWayToWaitForSocketErrorÚ
wait_for_readc C sL t | ddƒ}|du rdS |du r$dS zt|dd�W S tyF Y dS 0 dS )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 )Zconnr
© r
ú;/usr/lib/python3.9/site-packages/urllib3/util/connection.pyÚis_connection_dropped s
r c C s4 | \}}| d¡r| d¡}d}tƒ }z| d¡ W n& tyZ t td| ƒd¡ Y S 0 t |||tj
¡D ]¨}|\} }
}}}
d}zNt | |
|¡}t||ƒ |tjur²|
|¡ |rÀ| |¡ | |
¡ |W S tj�y } z&|}|du�r | ¡ d}W Y d}~qnd}~0 0 qn|du�r&|‚t d¡‚dS )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[]NZidnaz'%s', label empty or too longz!getaddrinfo returns an empty list)Ú
startswithÚstripÚallowed_gai_familyÚencodeÚUnicodeErrorr Z
raise_fromr ÚsocketZgetaddrinfoZSOCK_STREAMÚ_set_socket_optionsÚ_GLOBAL_DEFAULT_TIMEOUTZ
settimeoutÚbindZconnectÚerrorÚclose)Úaddressr Zsource_addressZsocket_optionsÚhostÚportÚerrÚfamilyÚresÚafZsocktypeÚprotoZ canonnameZsar
Úer
r
r Úcreate_connection&