관리-도구
편집 파일: connectionpool.cpython-312.pyc
� G��e6� � � � d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlm Z ddlm Z mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" ddl#m$Z$ dd l%m&Z& dd l'm(Z( ddl)m*Z* ddl+m,Z, dd l-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z<m=Z= ddl;m>Z? ddl;m@Z@mAZA d dlBZBeBj� ZDe$j� j� ZH ej� eJ� ZK eL� ZM G d� deL� ZNej� ej� hZQ G d� deNe(� ZR G d� deR� ZSd� ZTd� Z>d � ZUy# eE$ r ddlFmDZD Y ��w xY w)!� )�absolute_importN)�error��timeout� )�BaseSSLError�BrokenPipeError�DummyConnection�HTTPConnection� HTTPException�HTTPSConnection�VerifiedHTTPSConnection�port_by_scheme) �ClosedPoolError�EmptyPoolError�HeaderParsingError�HostChangedError�InsecureRequestWarning�LocationValueError� MaxRetryError�NewConnectionError� ProtocolError� ProxyError�ReadTimeoutError�SSLError�TimeoutError)�six)�queue)�RequestMethods)�HTTPResponse)�is_connection_dropped)�connection_requires_http_tunnel)� LifoQueue)�set_file_position)�assert_header_parsing)�Retry)�CertificateError)�Timeout)�Url�_encode_target)�_normalize_host)�get_host� parse_url)�weakref_finalizec �8 � e Zd ZdZdZeZdd�Zd� Zd� Z d� Z d� Zy) �ConnectionPoola; Base class for all connection pools, such as :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. .. note:: ConnectionPool.urlopen() does not normalize or percent-encode target URIs which is useful if your target server doesn't support percent-encoded target URIs. Nc � � |st d� �t || j �� | _ |j � | _ || _ y )NzNo host specified.��scheme)r r+ r3 �host�lower�_proxy_host�port)�selfr4 r7 s ��/builddir/build/BUILDROOT/alt-python312-pip-23.3.1-1.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_vendor/urllib3/connectionpool.py�__init__zConnectionPool.__init__R s8 � ��$�%9�:�:�#�D����=�� ��:�:�<����� � c �f � t | � j �d| j �d| j �d�S )Nz(host=z, port=�))�type�__name__r4 r7 �r8 s r9 �__str__zConnectionPool.__str__Z s! � �)-�d��)<�)<�d�i�i����S�Sr; c � � | S �N� r@ s r9 � __enter__zConnectionPool.__enter__] s � ��r; c �$ � | j � y)NF)�close)r8 �exc_type�exc_val�exc_tbs r9 �__exit__zConnectionPool.__exit__` s � �� � ��r; c � � y�zD Close all pooled connections and disable the pool. NrD r@ s r9 rG zConnectionPool.closee � � � r; rC )r? � __module__�__qualname__�__doc__r3 r# �QueueClsr: rA rE rK rG rD r; r9 r0 r0 D s- � �� �F��H��T��� r; r0 c � � e Zd ZdZdZeZeZdde j dddddddf d�Zd� Zdd�Z d � Zd � Zd� Zd� Zd � Zedfd�Zd� Zd� Zd� Zdddddeddddf d�Zy)�HTTPConnectionPoola: Thread-safe connection pool for one host. :param host: Host used for this HTTP Connection (e.g. "localhost"), passed into :class:`http.client.HTTPConnection`. :param port: Port used for this HTTP Connection (None is equivalent to 80), passed into :class:`http.client.HTTPConnection`. :param strict: Causes BadStatusLine to be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line, passed into :class:`http.client.HTTPConnection`. .. note:: Only works in Python 2. This parameter is ignored in Python 3. :param timeout: Socket timeout in seconds for each individual connection. This can be a float or integer, which sets the timeout for the HTTP request, or an instance of :class:`urllib3.util.Timeout` which gives you more fine-grained control over request timeouts. After the constructor has been parsed, this is always a `urllib3.util.Timeout` object. :param maxsize: Number of connections to save that can be reused. More than 1 is useful in multithreaded situations. If ``block`` is set to False, more connections will be created but they will not be saved once they've been used. :param block: If set to True, no more than ``maxsize`` connections will be used at a time. When no free connections are available, the call will block until a connection has been released. This is a useful side effect for particular multithreaded situations where one does not want to use more than maxsize connections per host to prevent flooding. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param retries: Retry configuration to use by default with requests in this pool. :param _proxy: Parsed proxy URL, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param _proxy_headers: A dictionary with proxy headers, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param \**conn_kw: Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, :class:`urllib3.connection.HTTPSConnection` instances. �httpNFr c �� � t j | ||� t j | |� || _ t |t � st j |� }|�t j }|| _ || _ | j |� | _ || _ | | _ | xs i | _ || _ t# |� D ] } | j j% d � � d| _ d| _ || _ | j rN| j* j- dg � | j | j* d<