MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/urllib3/__pycache__/connection.cpython-35.opt-1.pyc


�`Wa-�@s�ddlmZddlZddlZddlZddlZddlZddlmZm	Z
ddlZddlm
Z
y$ddlmZddlmZWn2ek
r�ddlmZddlmZYnXyddlZejZWn4eefk
r&dZGdd	�d	e�ZYnXy
eZWn(ek
r[Gd
d�de�ZYnXddlmZmZmZm Z dd
l!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ej-e.�Z/ddddiZ0ej1ddd�Z2Gdd�de3�Z4Gdd�dee3�ZGdd�de�Z5Gdd�de5�Z6dd�Z7er�e5Z8e6Z5ne4Z5dS) �)�absolute_importN)�error�timeout�)�six)�HTTPConnection)�
HTTPExceptionc@seZdZdS)�BaseSSLErrorN)�__name__�
__module__�__qualname__�r
r
�/connection.pyr	sr	c@seZdZdS)�ConnectionErrorN)r
rrr
r
r
rr sr)�NewConnectionError�ConnectTimeoutError�SubjectAltNameWarning�SystemTimeWarning)�match_hostname�CertificateError)�resolve_cert_reqs�resolve_ssl_version�ssl_wrap_socket�assert_fingerprint)�
connection)�HTTPHeaderDict�http�P�httpsi�i�c@seZdZdZdS)�DummyConnectionz-Used to detect a failed ConnectionCls import.N)r
rr�__doc__r
r
r
rrBsrc@s�eZdZdZedZejejdfgZ	dZ
dd�Zdd�Zd	d
�Z
dd�Zd
d
dd�Zd
S)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$)rZPY3�pop�getr"�sys�version_info�default_socket_optionsr%�_HTTPConnection�__init__)�self�args�kwr
r
rr,ks	zHTTPConnection.__init__cCs�i}|jr|j|d<|jr2|j|d<y(tj|j|jf|j|�}Wn{tk
r�}z$t|d|j|jf��WYdd}~Xn8t	k
r�}zt
|d|��WYdd}~XnX|S)zp Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        r"r%z0Connection to %s timed out. (connect timeout=%s)Nz(Failed to establish a new connection: %s)r"r%r�create_connection�host�portr�
SocketTimeoutr�SocketErrorr)r-Zextra_kw�conn�er
r
r�	_new_conn�s 	
	
"(#zHTTPConnection._new_conncCs2||_t|dd�r.|j�d|_dS)N�_tunnel_hostr)�sock�getattr�_tunnel�	auto_open)r-r5r
r
r�
_prepare_conn�s	
zHTTPConnection._prepare_conncCs|j�}|j|�dS)N)r7r=)r-r5r
r
r�connect�szHTTPConnection.connectNcCsot|dk	r|ni�}d|k}|j||d|�x*|j�D]\}}|j||�qMWd|kr�|jdd�|j�|dk	r^tjtjf}t||�r�|f}x�|D]�}	|	s�q�t|	tj�s|	j	d�}	t
t|	��dd�}
|j|
j	d	��|jd
�|j|	�|jd
�q�W|jd�dS)z�
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        Nzaccept-encoding�skip_accept_encodingztransfer-encodingzTransfer-EncodingZchunked�utf8r#zutf-8s
s0

)
rZ
putrequest�itemsZ	putheaderZ
endheadersrZstring_typesZbinary_type�
isinstance�encode�hex�len�send)r-�methodZurlZbodyZheadersr?�header�valueZstringish_types�chunkZlen_strr
r
r�request_chunked�s.
	


zHTTPConnection.request_chunked)r
rrr �port_by_scheme�default_port�socket�IPPROTO_TCP�TCP_NODELAYr*�is_verifiedr,r7r=r>rKr
r
r
rrGs
rc@sDeZdZedZddddejdd�Zdd�ZdS)�HTTPSConnectionrNc	KsAtj|||d|d||�||_||_d|_dS)Nr!rr)rr,�key_file�	cert_fileZ	_protocol)r-r1r2rSrTr!rr/r
r
rr,�s

		zHTTPSConnection.__init__cCs;|j�}|j|�tj||j|j�|_dS)N)r7r=�sslZwrap_socketrSrTr9)r-r5r
r
rr>�s
zHTTPSConnection.connect)	r
rrrLrMrN�_GLOBAL_DEFAULT_TIMEOUTr,r>r
r
r
rrR�s
	rRc	@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)
rSrT�	cert_reqs�assert_hostnamer�os�path�
expanduser�ca_certs�ca_cert_dir)r-rSrTrYr^rZrr_r
r
r�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�nn|tjkrv|jdk	rv|jj�}|jdf�s`tjd
j|�t�t||jpr|�|tj kp�|jdk	|_!dS)Nr8rzWSystem time is way off (before {0}). This will probably lead to SSL verification errorsrYr^r_Zserver_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.))"r7rrYrrar1r:r9r;r<r8�datetime�dateZtoday�RECENT_DATE�warnings�warn�formatrrrSrTr^r_rZgetpeercertrUZ	CERT_NONErZr'r�_match_hostnamerXrQ)r-r5Zresolved_cert_reqsZresolved_ssl_version�hostnameZis_time_off�certr
r
rr>�sF		
					
zVerifiedHTTPSConnection.connect)r
rrr rYr^r_rarr`r>r
r
r
rrW�s
rWcCs\yt||�WnDtk
rW}z$tjd||�||_�WYdd}~XnXdS)Nz@Certificate did not match expected hostname: %s. Certificate: %s)rr�logrZ
_peer_cert)rjZasserted_hostnamer6r
r
rrh7s
	rh)9Z
__future__rrb�loggingr[r(rNrr4rr3reZpackagesrZhttp.clientrr+r�ImportError�httplibrUZSSLErrorr	�AttributeError�
BaseExceptionr�	NameError�	Exception�
exceptionsrrrrZpackages.ssl_match_hostnamerrZ	util.ssl_rrrr�utilr�_collectionsr�	getLoggerr
rkrLrcrd�objectrrRrWrhZUnverifiedHTTPSConnectionr
r
r
r�<module>sT



""�V