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/python38/lib/python3.8/site-packages/urllib3/util/__pycache__/ssltransport.cpython-38.pyc
U

��`��@sFddlZddlZddlZddlmZddlmZdZGdd�d�ZdS)�N)�ProxySchemeUnsupported)�sixi@c@s�eZdZdZedd��Zd:dd�Zdd	�Zd
d�Zdd
�Z	d;dd�Z
d<dd�Zd=dd�Zd>dd�Z
d?dd�Zd@dd�Zdd�Zdd �ZdAd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdBd6d7�Zd8d9�ZdS)C�SSLTransportaL
    The SSLTransport wraps an existing socket and establishes an SSL connection.

    Contrary to Python's implementation of SSLSocket, it allows you to chain
    multiple TLS connections together. It's particularly useful if you need to
    implement TLS within TLS.

    The class supports most of the socket API operations.
    cCs&t|d�s"tjrtd��ntd��dS)z�
        Raises a ProxySchemeUnsupported if the provided ssl_context can't be used
        for TLS in TLS.

        The only requirement is that the ssl_context provides the 'wrap_bio'
        methods.
        �wrap_biozKTLS in TLS requires SSLContext.wrap_bio() which isn't supported on Python 2zXTLS in TLS requires SSLContext.wrap_bio() which isn't available on non-native SSLContextN)�hasattrrZPY2r)�ssl_context�r�J/opt/alt/python38/lib/python3.8/site-packages/urllib3/util/ssltransport.py�$_validate_ssl_context_for_tls_in_tlss

��z1SSLTransport._validate_ssl_context_for_tls_in_tlsNTcCsHt��|_t��|_||_||_|j|j|j|d�|_|�|jj	�dS)zV
        Create an SSLTransport around socket using the provided ssl_context.
        )�server_hostnameN)
�sslZ	MemoryBIO�incoming�outgoing�suppress_ragged_eofs�socketr�sslobj�_ssl_io_loopZdo_handshake)�selfrrrrrrr	�__init__,s

�zSSLTransport.__init__cCs|S�Nr�rrrr	�	__enter__?szSSLTransport.__enter__cGs|��dSr)�close)r�_rrr	�__exit__BszSSLTransport.__exit__cCs
|j��Sr)r�filenorrrr	rEszSSLTransport.fileno�cCs|�||�Sr)�_wrap_ssl_read)r�len�bufferrrr	�readHszSSLTransport.readrcCs|dkrtd��|�|�S)Nrz+non-zero flags not allowed in calls to recv)�
ValueErrorr)rr�flagsrrr	�recvKszSSLTransport.recvcCs>|dkrtd��|r&|dkr&t|�}n|dkr2d}|�||�S)Nrz0non-zero flags not allowed in calls to recv_intor)r!rr )rr�nbytesr"rrr	�	recv_intoPs
zSSLTransport.recv_intoc
Csn|dkrtd��d}t|��H}|�d��2}t|�}||krV|�||d��}||7}q2W5QRXW5QRXdS)Nrz.non-zero flags not allowed in calls to sendall�B)r!�
memoryview�castr�send)r�datar"�countZviewZ	byte_viewZamount�vrrr	�sendallYszSSLTransport.sendallcCs$|dkrtd��|�|jj|�}|S)Nrz+non-zero flags not allowed in calls to send)r!rr�write)rr*r"Zresponserrr	r)cszSSLTransport.send�rc
Cst|�dddhks td|f��d|k}d|kp4|}|sB|sBt�d|k}d}	|rZ|	d7}	|rf|	d7}	t�||	�}
|jjd7_|dkr�d}|d	kr�tj}|d	kr�|s�td
��|
S|r�|r�t�|
|
|�}n&|r�t�	|
|�}n|s�t�t�
|
|�}|r�|St�||||�}||_|S)a
        Python's httpclient uses makefile and buffered io when reading HTTP
        messages and we need to support it.

        This is unfortunately a copy and paste of socket.py makefile with small
        changes to point to the socket directly.
        r/�w�bz&invalid mode %r (only r, w, b allowed)��N���rz!unbuffered streams must be binary)
�setr!�AssertionErrorrZSocketIOZ_io_refs�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
rr=�	buffering�encoding�errors�newlineZwritingZreadingZbinaryZrawmode�rawr�textrrr	�makefileis@
zSSLTransport.makefilecCs|�|jj�dSr)rr�unwraprrrr	rE�szSSLTransport.unwrapcCs|j��dSr)rrrrrr	r�szSSLTransport.closeFcCs|j�|�Sr)r�getpeercert)rZbinary_formrrr	rF�szSSLTransport.getpeercertcCs
|j��Sr)r�versionrrrr	rG�szSSLTransport.versioncCs
|j��Sr)r�cipherrrrr	rH�szSSLTransport.ciphercCs
|j��Sr)r�selected_alpn_protocolrrrr	rI�sz#SSLTransport.selected_alpn_protocolcCs
|j��Sr)r�selected_npn_protocolrrrr	rJ�sz"SSLTransport.selected_npn_protocolcCs
|j��Sr)r�shared_ciphersrrrr	rK�szSSLTransport.shared_cipherscCs
|j��Sr)r�compressionrrrr	rL�szSSLTransport.compressioncCs|j�|�dSr)r�
settimeout)r�valuerrr	rM�szSSLTransport.settimeoutcCs
|j��Sr)r�
gettimeoutrrrr	rO�szSSLTransport.gettimeoutcCs|j��dSr)r�_decref_socketiosrrrr	rP�szSSLTransport._decref_socketiosc
Cs\z|�|jj||�WStjk
rV}z"|jtjkrD|jrDWY�
dS�W5d}~XYnXdS)Nr)rrr r�SSLError�errnoZ
SSL_ERROR_EOFr)rrr�errr	r�s
zSSLTransport._wrap_ssl_readc
Gs�d}d}|r�d}z||�}Wn@tjk
r\}z |jtjtjfkrF|�|j}W5d}~XYnX|j��}|j�|�|dkr�d}q|tjkr|j�	t
�}|r�|j�|�q|j�
�q|S)z>Performs an I/O loop between incoming/outgoing and the socket.TNF)rrQrRZSSL_ERROR_WANT_READZSSL_ERROR_WANT_WRITErr rr-r#�
SSL_BLOCKSIZEr
r.Z	write_eof)r�func�argsZshould_loopZretrRrSZbufrrr	r�s(

zSSLTransport._ssl_io_loop)NT)rN)rr)Nr)r)r)r/NNNN)F)N)�__name__�
__module__�__qualname__�__doc__�staticmethodr
rrrrr r#r%r-r)rDrErrFrGrHrIrJrKrLrMrOrPrrrrrr	rsD

�



	


�
-

	r)	r7rrZurllib3.exceptionsrZurllib3.packagesrrTrrrrr	�<module>s