← back to Atmos Game
assets/gen/.venv/lib/python3.12/site-packages/httpcore/_sync/__pycache__/http_proxy.cpython-312.pyc
114 lines
�
c�bj8 � �� � d dl mZ d dlZd dlZd dlZd dlZddlmZmZ ddl m
Z
ddlmZm
Z
mZmZmZmZmZ ddlmZ ddlmZ dd lmZ d
dlmZ d
dlmZ d
d
lmZ d
dlm Z ejB e"e#f Z$ejJ ejL e$e$f Z'ejP e$e$f Z) ejT d� Z+ d dd�Z, G d� de� Z- G d� de � Z. G d� de � Z/y)� )�annotationsN� )�
SOCKET_OPTION�NetworkBackend)�
ProxyError)�URL�Origin�Request�Response�
enforce_bytes�enforce_headers�enforce_url)�default_ssl_context)�Lock)�Trace� )�HTTPConnection)�ConnectionPool)�HTTP11Connection)�ConnectionInterfacezhttpcore.proxyc �� � | �g n
t | � } |�g n
t |� }t d� |D � � }| D ��cg c] \ }}|j � |vr||f�� } }}| |z S c c}}w )zh
Append default_headers and override_headers, de-duplicating if a key exists
in both cases.
c 3 �B K � | ] \ }}|j � �� � y �w�N)�lower)�.0�key�values �p/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpcore/_sync/http_proxy.py� <genexpr>z merge_headers.<locals>.<genexpr>- s � �� �F�5E�z�s�E�s�y�y�{�5E�s �)�list�setr )�default_headers�override_headers�has_overrider r s r �
merge_headersr% # s� � � ,�3�b��o�9N�O�-�5�r�4�@P�;Q���F�5E�F�F�L� *��)�J�C���9�9�;�l�*�
�e��)� � �
�-�-�-��s � Ac � � � e Zd ZdZ d d� fd�
Zdd�Z� xZS )� HTTPProxyzB
A connection pool that sends requests via an HTTP proxy.
c
� �� t �| � ||||| |
||||
|�� t |d�� | _ | j j dk( r
|�t d� �|| _ || _ t |d�� | _ |�Xt |d d �� }t |d
d �� }|dz |z }dt j |� z }d
|fg| j z | _ yy)a�
A connection pool for making HTTP requests.
Parameters:
proxy_url: The URL to use when connecting to the proxy server.
For example `"http://127.0.0.1:8080/"`.
proxy_auth: Any proxy authentication as a two-tuple of
(username, password). May be either bytes or ascii-only str.
proxy_headers: Any HTTP headers to use for the proxy requests.
For example `{"Proxy-Authorization": "Basic <username>:<password>"}`.
ssl_context: An SSL context to use for verifying connections.
If not specified, the default `httpcore.default_ssl_context()`
will be used.
proxy_ssl_context: The same as `ssl_context`, but for a proxy server rather than a remote origin.
max_connections: The maximum number of concurrent HTTP connections that
the pool should allow. Any attempt to send a request on a pool that
would exceed this amount will block until a connection is available.
max_keepalive_connections: The maximum number of idle HTTP connections
that will be maintained in the pool.
keepalive_expiry: The duration in seconds that an idle HTTP connection
may be maintained for before being expired from the pool.
http1: A boolean indicating if HTTP/1.1 requests should be supported
by the connection pool. Defaults to True.
http2: A boolean indicating if HTTP/2 requests should be supported by
the connection pool. Defaults to False.
retries: The maximum number of retries when trying to establish
a connection.
local_address: Local address to connect from. Can also be used to
connect using a particular address family. Using
`local_address="0.0.0.0"` will connect using an `AF_INET` address
(IPv4), while using `local_address="::"` will connect using an
`AF_INET6` address (IPv6).
uds: Path to a Unix Domain Socket to use instead of TCP sockets.
network_backend: A backend instance to use for handling network I/O.
)�ssl_context�max_connections�max_keepalive_connections�keepalive_expiry�http1�http2�network_backend�retries�
local_address�uds�socket_options� proxy_url��name� httpNzCThe `proxy_ssl_context` argument is not allowed for the http scheme�
proxy_headersr �
proxy_authr � :s Basic s Proxy-Authorization)
�super�__init__r �
_proxy_url�scheme�RuntimeError�_ssl_context�_proxy_ssl_contextr
�_proxy_headersr �base64� b64encode)�selfr4 r9 r8 r) �proxy_ssl_contextr* r+ r, r- r. r0 r1 r2 r/ r3 �username�password�userpass�
authorization� __class__s �r r<