관리-도구
편집 파일: connection.cpython-311.pyc
� �܋fn � �� � d dl mZ d dlZd dlZddlmZ ddlmZmZ ej ej eeej ee f f Zej rddlmZ d!d�Zeddfd"d�Zd#d�Zd$d�Zd%d�Z ed � � ZdS )&� )�annotationsN� )�LocationParseError� )�_DEFAULT_TIMEOUT� _TYPE_TIMEOUT)�BaseHTTPConnection�connr �return�boolc � � | 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 �N/opt/cloudlinux/venv/lib64/python3.11/site-packages/urllib3/util/connection.py�is_connection_droppedr s � � � � � � �address�tuple[str, int]�timeoutr �source_address�tuple[str, int] | None�socket_options�_TYPE_SOCKET_OPTIONS | None� socket.socketc �� � | \ }}|� d� � r|� d� � }d}t � � } |� d� � n"# t $ r t d|� d�� � d�w xY wt j |||t j � � D ]�}|\ } } }}} d} t j | | |� � }t ||� � |t ur|� |� � |r|� |� � |� | � � d}|c S # t $ r"}|}|�|� � � Y d}~��d}~ww xY w|� |�# d}w xY wt d� � �)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�_s r �create_connectionr8 s� � �$ �J�D�$����s��� ��z�z�$���� �C� � !� !�F�Q����F������� Q� Q� Q� �!E�T�!E�!E�!E�F�F�D�P�Q���� �!�$��f�f�6H�I�I� � ��-0�*��H�e�Y���� ��=��X�u�5�5�D� ��n�5�5�5��.�.�.�����(�(�(�� *�� � �.�)�)�)��L�L������C��K�K�K��� � � ��C���� � ������������� ���� �� ��I�� �C�J�J�J�J��9�:�:�:s1 �A �A6�'A3D� E �'E�E �E �Er6 �options�Nonec �, � |�d S |D ]} | j |� � d S )N)� setsockopt)r6 r9 �opts r r&