connection.pyc
1 o 2 ��YcfN � @ s d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlm 3 Z ddlm Z ddlmZ ddlmZ dd lmZ z d dlZejZW n eefy` dZG d 4 d� de�ZY nw zeZW n eyv G dd � d e�ZY nw zeZW n ey� G dd� de�ZY nw ddlmZ ddl m!Z! ddl"m#Z#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4 e�5e6�Z7ddd�Z8e�9ddd�Z:e�;d�Z<G dd� dee=�ZG dd� de�Z>dd � Z?d!d"� Z@G d#d$� d$e=�ZAe�seAZ>e>ZBdS )%� )�absolute_importN)�error)�timeout� )�six)�HTTPConnection)� HTTPException)�create_proxy_ssl_contextc @ � e Zd ZdS )�BaseSSLErrorN��__name__� 5 __module__�__qualname__� r r ��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connection.pyr � r c @ r 6 )�ConnectionErrorNr r r r r r ! r r c @ r 7 )�BrokenPipeErrorNr r r r r r * r r )�HTTPHeaderDict��__version__)�ConnectTimeoutError�NewConnectionError�SubjectAltNameWarning�SystemTimeWarning)�SKIP_HEADER�SKIPPABLE_HEADERS� 8 connection)�assert_fingerprint�create_urllib3_context�is_ipaddress�resolve_cert_reqs�resolve_ssl_version�ssl_wrap_socket)�CertificateError�match_hostname�P i� )�http�httpsi� z[^-!#$%&'*+.^_`|~0-9a-zA-Z]c s� e Zd ZdZed ZejejdfgZ dZ 9 dZdd� Ze dd � �Zejd 10 d � �Zdd� Zd d� Zdd� Zdd� Zdd� Zdd� Zd� fdd� Zddd�Z� ZS )r a5 11 Based on :class:`http.client.HTTPConnection` but provides an extra constructor 12 backwards-compatibility layer between older and newer Pythons. 13 14 Additional keyword parameters are used to configure attributes of the connection. 15 Accepted parameters include: 16 17 - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool` 18 - ``source_address``: Set the source address for the current connection. 19 - ``socket_options``: Set specific options on the underlying socket. If not specified, then 20 defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling 21 Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. 22 23 For example, if you wish to enable TCP Keep Alive in addition to the defaults, 24 you might pass: 25 26 .. code-block:: python 27 28 HTTPConnection.default_socket_options + [ 29 (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), 30 ] 31 32 Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). 33 r( r FNc O sf t js |�dd � |�d�| _|�d| j�| _|�dd �| _|�dd �| _t j 34 | g|�R i |�� d S )N�strict�source_address�socket_options�proxy�proxy_config)r �PY2�pop�getr+ �default_socket_optionsr, r- r. �_HTTPConnection�__init__)�self�args�kwr r r r4 s s zHTTPConnection.__init__c C s | j �d�S )a� 35 Getter method to remove any trailing dots that indicate the hostname is an FQDN. 36 37 In general, SSL certificates don't include the trailing dot indicating a 38 fully-qualified domain name, and thus, they don't validate properly when 39 checked against a domain name that includes the dot. In addition, some 40 servers may not expect to receive the trailing dot when provided. 41 42 However, the hostname with trailing dot is critical to DNS resolution; doing a 43 lookup with the trailing dot will properly only resolve the appropriate FQDN, 44 whereas a lookup without a trailing dot will search the system's search domain 45 list. Thus, it's important to keep the original host around for use only in 46 those cases where it's appropriate (i.e., when doing DNS lookup to establish the 47 actual TCP connection across which we're going to send HTTP requests). 48 �.)� _dns_host�rstrip�r5 r r r �host� s zHTTPConnection.hostc C s 49 || _ dS )z� 50 Setter for the `host` property. 51 52 We assume that only urllib3 uses the _dns_host attribute; httplib itself 53 only uses `host`, and it seems reasonable that other libraries follow suit. 54 N)r9 )r5 �valuer r r r<