%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core/17212/usr/lib/python3/dist-packages/urllib3/__pycache__/
Upload File :
Create Path :
Current File : //snap/core/17212/usr/lib/python3/dist-packages/urllib3/__pycache__/connection.cpython-35.pyc



Rg*�@slddlmZddlZddlZddlZddlZddlZddlmZm	Z
ddlZddlZy$ddl
mZddl
mZWn2ek
r�ddlmZddlmZYnXyddlZejZWn4eefk
r"dZGdd�de�ZYnXy
eZWn(ek
rWGdd	�d	e�ZYnXd
dlmZmZmZmZd
dl m!Z!d
d
l"m#Z#m$Z$m%Z%m&Z&d
dl'm(Z(ddddiZ)ej*dd
d
�Z+Gdd�de,�Z-ej.d�Z/Gdd�dee,�ZGdd�de�Z0Gdd�de0�Z1erbe0Z2e1Z0ne-Z0dS)�)�absolute_importN)�error�timeout)�HTTPConnection)�
HTTPExceptionc@seZdZdS)�BaseSSLErrorN)�__name__�
__module__�__qualname__�rr�4/usr/lib/python3/dist-packages/urllib3/connection.pyrsrc@seZdZdS)�ConnectionErrorN)rr	r
rrrrr
 sr
�)�NewConnectionError�ConnectTimeoutError�SubjectAltNameWarning�SystemTimeWarning)�match_hostname)�resolve_cert_reqs�resolve_ssl_version�ssl_wrap_socket�assert_fingerprint)�
connection�http�P�httpsi�i�c@seZdZdZdS)�DummyConnectionz-Used to detect a failed ConnectionCls import.N)rr	r
�__doc__rrrrr>srz[^-!#$%&'*+.^_`|~0-9a-zA-Z]c@szeZdZdZedZejejdfgZ	dZ
dd�Zdd�Zd	d
�Z
dd�Zd
d�ZdS)ra{
    Based on httplib.HTTPConnection but provides an extra constructor
    backwards-compatibility layer between older and newer Pythons.

    Additional keyword parameters are used to configure attributes of the connection.
    Accepted parameters include:

      - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
      - ``source_address``: Set the source address for the current connection.

        .. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x

      - ``socket_options``: Set specific options on the underlying socket. If not specified, then
        defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
        Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.

        For example, if you wish to enable TCP Keep Alive in addition to the defaults,
        you might pass::

            HTTPConnection.default_socket_options + [
                (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
            ]

        Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).
    rrFcOsytjr|jdd�|jd�|_tjdkrJ|jdd�|jd|j�|_t	j
|||�dS)N�strict�source_address���socket_options)r r!)�sixZPY3�pop�getr�sys�version_info�default_socket_optionsr"�_HTTPConnection�__init__)�self�args�kwrrrr*is	zHTTPConnection.__init__cCs�i}|jr|j|d<|jr2|j|d<y(tj|j|jf|j|�}Wnhtk
r�t|d|j|jf��Yn8t	k
r�}zt
|d|��WYdd}~XnX|S)zp Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        rr"z0Connection to %s timed out. (connect timeout=%s)z(Failed to establish a new connection: %sN)rr"rZcreate_connection�host�portr�
SocketTimeoutr�SocketErrorr)r+Zextra_kw�conn�errr�	_new_conn~s 	
	
"
#zHTTPConnection._new_conncCs2||_t|dd�r.|j�d|_dS)N�_tunnel_hostr)�sock�getattr�_tunnel�	auto_open)r+r2rrr�
_prepare_conn�s	
zHTTPConnection._prepare_conncCs|j�}|j|�dS)N)r4r:)r+r2rrr�connect�szHTTPConnection.connectcOsJtj|�}|r1td||j�f��tj|||||�S)zSend a request to the serverzAMethod cannot contain non-token characters %r (found at least %r))�_CONTAINS_CONTROL_CHAR_RE�search�
ValueError�groupr)�
putrequest)r+�methodZurlr,�kwargs�matchrrrr@�szHTTPConnection.putrequestN)rr	r
r�port_by_scheme�default_port�socketZIPPROTO_TCPZTCP_NODELAYr(�is_verifiedr*r4r:r;r@rrrrrEs
rc@sDeZdZedZddddejdd�Zdd�ZdS)�HTTPSConnectionrNc	KsAtj|||d|d||�||_||_d|_dS)Nrrr)rr*�key_file�	cert_fileZ	_protocol)r+r.r/rIrJrrr-rrrr*�s

		zHTTPSConnection.__init__cCs;|j�}|j|�tj||j|j�|_dS)N)r4r:�sslZwrap_socketrIrJr6)r+r2rrrr;�s
zHTTPSConnection.connect)	rr	r
rDrErFZ_GLOBAL_DEFAULT_TIMEOUTr*r;rrrrrH�s
	rHc	@saeZdZdZdZdZdZdZdZddddddddd�Z	dd�Z
dS)�VerifiedHTTPSConnectionz[
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    NcCs�|s|r|dkrd}||_||_||_||_||_|o`tjj|�|_|o{tjj|�|_	dS)N�
CERT_REQUIRED)
rIrJ�	cert_reqs�assert_hostnamer�os�path�
expanduser�ca_certs�ca_cert_dir)r+rIrJrNrSrOrrTrrr�set_cert�s					z VerifiedHTTPSConnection.set_certcCs�|j�}t|j�}t|j�}|j}t|dd�rj||_|j�d|_	|j
}tjj
�tk}|r�tjdjt�t�t||j|jd|d|jd|jd|d|�|_|jrt|jjd	d
�|j�n�|tjkr�|jdk	r�|jj�}|jdf�s`tjd
j|�t�|jpl|}|jd�}t ||�|tj!kp�|jdk	|_"dS)Nr5rzWSystem time is way off (before {0}). This will probably lead to SSL verification errorsrNrSrTZserver_hostname�ssl_versionZbinary_formTFZsubjectAltNamez�Certificate for {0} has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)z[])#r4rrNrrVr.r7r6r8r9r5�datetime�dateZtoday�RECENT_DATE�warnings�warn�formatrrrIrJrSrTrZgetpeercertrKZ	CERT_NONErOr%r�striprrMrG)r+r2Zresolved_cert_reqsZresolved_ssl_versionZhostnameZis_time_offZcertZasserted_hostnamerrrr;�sJ		
					
	
zVerifiedHTTPSConnection.connect)rr	r
rrNrSrTrVrrUr;rrrrrL�s
rL)3Z
__future__r�rerWrPr&rFrr1rr0rZr#Zhttp.clientrr)r�ImportErrorZhttplibrKZSSLErrorr�AttributeError�
BaseExceptionr
�	NameError�	Exception�
exceptionsrrrrZpackages.ssl_match_hostnamerZ	util.ssl_rrrr�utilrrDrXrY�objectr�compiler<rHrLZUnverifiedHTTPSConnectionrrrr�<module>sP



""o_	

Zerion Mini Shell 1.0