File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/urllib3/util/__pycache__/connection.cpython-310.pyc
Back
o ;j\ � @ s� d dl mZ d dlZd dlZddlmZ ddlmZmZ e e eeejee f f Zejr3ddlmZ d&dd �Zeddfd'dd�Zd(dd�Zd)dd �Zd*d#d$�Zed%�ZdS )+� )�annotationsN� )�LocationParseError� )�_DEFAULT_TIMEOUT� _TYPE_TIMEOUT)�BaseHTTPConnection�connr �return�boolc C s | j S )z� Returns True if the connection is dropped and should be closed. :param conn: :class:`urllib3.connection.HTTPConnection` object. )Zis_connected)r � r �K/opt/saltstack/salt/lib/python3.10/site-packages/urllib3/util/connection.py�is_connection_dropped s r �address�tuple[str, int]�timeoutr �source_address�tuple[str, int] | None�socket_options�_TYPE_SOCKET_OPTIONS | None� socket.socketc C s$ | \}}|� d�r|�d�}d}t� }z|�d� W n ty* td|� d��d�w t�|||tj�D ]O}|\} } }}} d}z(t�| | |�}t ||� |t urU|�|� |r\|�|� |� | � d}|W S ty� } z|}|dury|�� W Y d}~q4d}~ww |dur�z|�d}w td��)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[]N�idna�'z', label empty or too longz!getaddrinfo returns an empty list)� startswith�strip�allowed_gai_family�encode�UnicodeErrorr �socket�getaddrinfo�SOCK_STREAM�_set_socket_optionsr � settimeout�bind�connect�OSError�close)r r r r �host�port�err�family�res�af�socktype�proto� canonname�sa�sock�_r r r �create_connection sD � ��r4 r2 �options�Nonec C s$ |d u rd S |D ]}| j |� qd S )N)� setsockopt)r2 r5 �optr r r r"