HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/root/lib/python3/dist-packages/urllib3/util/__pycache__/
Upload File :
Current File : //proc/1784574/root/lib/python3/dist-packages/urllib3/util/__pycache__/ssltransport.cpython-311.pyc
�

��fg���P�ddlZddlZddlZddlmZddlZdZGd�d��ZdS)�N�)�ProxySchemeUnsupportedi@c���eZdZdZed���Z	d!d�Zd�Zd�Zd�Z	d"d
�Z
d#d�Zd$d
�Zd%d�Z
d%d�Z	d&d�Zd�Zd�Zd'd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd(d�Zd �ZdS))�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.
    c�z�t|d��s*tjrtd���td���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)�hasattr�six�PY2r)�ssl_contexts �;/usr/lib/python3/dist-packages/urllib3/util/ssltransport.py�$_validate_ssl_context_for_tls_in_tlsz1SSLTransport._validate_ssl_context_for_tls_in_tlssZ���{�J�/�/�
	��w�	
�,�,����
-�9����
	�
	�NTc��tj��|_tj��|_||_||_|�|j|j|���|_|�|jj	��dS)zV
        Create an SSLTransport around socket using the provided ssl_context.
        )�server_hostnameN)
�ssl�	MemoryBIO�incoming�outgoing�suppress_ragged_eofs�socketr�sslobj�_ssl_io_loop�do_handshake)�selfrrrrs     r
�__init__zSSLTransport.__init__,su���
����
��
����
�$8��!����!�*�*��M�4�=�/�+�
�
���
	
���$�+�2�3�3�3�3�3rc��|S�N��rs r
�	__enter__zSSLTransport.__enter__?s���rc�.�|���dSr)�close)r�_s  r
�__exit__zSSLTransport.__exit__Bs���
�
�����rc�4�|j���Sr)r�filenor s r
r'zSSLTransport.filenoE����{�!�!�#�#�#r�c�.�|�||��Sr)�_wrap_ssl_read)r�len�buffers   r
�readzSSLTransport.readHs���"�"�3��/�/�/rrc�V�|dkrtd���|�|��S)Nrz+non-zero flags not allowed in calls to recv)�
ValueErrorr+)rr,�flagss   r
�recvzSSLTransport.recvKs.���A�:�:��J�K�K�K��"�"�3�'�'�'rc��|dkrtd���|r|�t|��}n|�d}|�||��S)Nrz0non-zero flags not allowed in calls to recv_intor))r0r,r.)rr-�nbytesr1s    r
�	recv_intozSSLTransport.recv_intoPsQ���A�:�:��O�P�P�P��	�v�~���[�[�F�F�
�^��F��y�y���(�(�(rc�X�|dkrtd���d}t|��5}|�d��5}t|��}||kr(|�||d���}||z
}||k�(ddd��n#1swxYwYddd��dS#1swxYwYdS)Nrz.non-zero flags not allowed in calls to sendall�B)r0�
memoryview�castr,�send)r�datar1�count�view�	byte_view�amount�vs        r
�sendallzSSLTransport.sendallYs1���A�:�:��M�N�N�N���
��
�
�	��t�y�y��~�~�	����^�^�F��&�.�.��I�I�i����/�0�0����
���&�.�.�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s4�B�>B�;B�B	�B�B	�B�B#�&B#c�p�|dkrtd���|�|jj|��}|S)Nrz+non-zero flags not allowed in calls to send)r0rr�write)rr;r1�responses    r
r:zSSLTransport.sendcs9���A�:�:��J�K�K�K��$�$�T�[�%6��=�=���r�rc�.�t|��hd�kstd|�d����d|v}d|vp|}|s|sJ�d|v}d}	|r|	dz
}	|r|	dz
}	tj||	��}
|jxjdz
c_|�d
}|dkrt
j}|dkr|std���|
S|r|rtj|
|
|��}n1|rtj|
|��}n|sJ�tj	|
|��}|r|Stj
||||��}||_|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.
        >�brE�wz
invalid mode z (only r, w, b allowed)rHrErG��N���rz!unbuffered streams must be binary)�setr0r�SocketIO�_io_refs�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
rrU�	buffering�encoding�errors�newline�writing�reading�binary�rawmode�rawr-�texts
             r
�makefilezSSLTransport.makefileis~���4�y�y�O�O�O�+�+��*����O�P�P�P���+����+�,�W����!�'�!�!�!��������	��s�N�G��	��s�N�G��o�d�G�,�,�������!������I��q�=�=��.�I���>�>��
F� �!D�E�E�E��J��	7�w�	7��&�s�C��;�;�F�F�
�	7��&�s�I�6�6�F�F��N�N�N��&�s�I�6�6�F��	��M�����&�'�B�B����	��rc�D�|�|jj��dSr)rr�unwrapr s r
rbzSSLTransport.unwrap�s!�����$�+�,�-�-�-�-�-rc�8�|j���dSr)rr#r s r
r#zSSLTransport.close�s����������rFc�6�|j�|��Sr)r�getpeercert)r�binary_forms  r
rezSSLTransport.getpeercert�s���{�&�&�{�3�3�3rc�4�|j���Sr)r�versionr s r
rhzSSLTransport.version�s���{�"�"�$�$�$rc�4�|j���Sr)r�cipherr s r
rjzSSLTransport.cipher�r(rc�4�|j���Sr)r�selected_alpn_protocolr s r
rlz#SSLTransport.selected_alpn_protocol�s���{�1�1�3�3�3rc�4�|j���Sr)r�selected_npn_protocolr s r
rnz"SSLTransport.selected_npn_protocol�s���{�0�0�2�2�2rc�4�|j���Sr)r�shared_ciphersr s r
rpzSSLTransport.shared_ciphers�s���{�)�)�+�+�+rc�4�|j���Sr)r�compressionr s r
rrzSSLTransport.compression�s���{�&�&�(�(�(rc�:�|j�|��dSr)r�
settimeout)r�values  r
rtzSSLTransport.settimeout�s������u�%�%�%�%�%rc�4�|j���Sr)r�
gettimeoutr s r
rwzSSLTransport.gettimeout�s���{�%�%�'�'�'rc�8�|j���dSr)r�_decref_socketiosr s r
ryzSSLTransport._decref_socketios�s����%�%�'�'�'�'�'rc��	|�|jj||��S#tj$r(}|jtjkr
|jrYd}~dS�d}~wwxYw�Nr)rrr.r�SSLError�errno�
SSL_ERROR_EOFr)rr,r-�es    r
r+zSSLTransport._wrap_ssl_read�sm��	��$�$�T�[�%5�s�F�C�C�C���|�	�	�	��w�#�+�+�+��0I�+��q�q�q�q�q������		���s� #�A�A�A�Ac���d}d}|r�d}	||�}nD#tj$r2}|jtjtjfvr|�|j}Yd}~nd}~wwxYw|j���}|j�|��|�d}ne|tjkrU|j�	t��}|r|j�|��n|j�
��|��|S)z>Performs an I/O loop between incoming/outgoing and the socket.TNF)rr|r}�SSL_ERROR_WANT_READ�SSL_ERROR_WANT_WRITErr.rrAr2�
SSL_BLOCKSIZErrC�	write_eof)r�func�args�should_loop�retr}r�bufs        r
rzSSLTransport._ssl_io_loop�s�������	.��E�
 ��d�D�k�����<�
 �
 �
 ��7�3�#:�C�<T�"U�U�U��G�������������	
 �����-�$�$�&�&�C��K����$�$�$��}�#����#�1�1�1��k�&�&�}�5�5���.��M�'�'��,�,�,�,��M�+�+�-�-�-�)�	.�*�
s��A�(A�A)NT)r)N)r)rr{)r)rENNNN)Fr)�__name__�
__module__�__qualname__�__doc__�staticmethodrrr!r%r'r.r2r5rAr:r`rbr#rerhrjrlrnrprrrtrwryr+rrrr
rrs�������������\��,OS�4�4�4�4�&������$�$�$�0�0�0�0�(�(�(�(�
)�)�)�)���������MQ�+�+�+�+�Z.�.�.����4�4�4�4�%�%�%�$�$�$�4�4�4�3�3�3�,�,�,�)�)�)�&�&�&�(�(�(�(�(�(���������rr)rOrr�
exceptionsrr
r�rrrr
�<module>r�s|��	�	�	�	�
�
�
�
�
�
�
�
�/�/�/�/�/�/�
�
�
�
��
�R�R�R�R�R�R�R�R�R�Rr