Your IP : 18.221.161.43


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/urllib3/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/urllib3/__pycache__/connection.cpython-311.pyc

�

^�DgBI���ddlmZddlZddlZddlZddlZddlZddlZddlmZ	ddlm
Zddlm
Z
ddlmZddlmZdd	lmZ	ddlZejZn#eef$rdZGd
�de��ZYnwxYw	eZn#e$rGd�d
e��ZYnwxYw	eZn#e$rGd�de��ZYnwxYwddlmZddl m!Z!ddl"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3ej4e5��Z6ddd�Z7ej8ddd��Z9ej:d��Z;Gd�dee<��ZGd�de��Z=d �Z>d!�Z?Gd"�d#e<��Z@ese@Z=e=ZAdS)$�)�absolute_importN)�error)�timeout�)�six)�HTTPConnection)�
HTTPException)�create_proxy_ssl_contextc��eZdZdS)�BaseSSLErrorN��__name__�
__module__�__qualname__���I/opt/imunify360/venv/lib64/python3.11/site-packages/urllib3/connection.pyrr��������rrc��eZdZdS)�ConnectionErrorNr
rrrrr!rrrc��eZdZdS)�BrokenPipeErrorNr
rrrrr*rrr)�HTTPHeaderDict��__version__)�ConnectTimeoutError�NewConnectionError�SubjectAltNameWarning�SystemTimeWarning)�CertificateError�match_hostname)�SKIP_HEADER�SKIPPABLE_HEADERS�
connection)�assert_fingerprint�create_urllib3_context�resolve_cert_reqs�resolve_ssl_version�ssl_wrap_socket�Pi�)�http�httpsi��z[^-!#$%&'*+.^_`|~0-9a-zA-Z]c���eZdZdZedZejejdfgZ	dZ
d�Zed���Z
e
jd���Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zd�fd�	Zdd�Z�xZS)ra5
    Based on :class:`http.client.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.
    - ``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:

      .. code-block:: python

         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., ``[]``).
    r+rFc�T�tjs|�dd��|�d��|_|�d|j��|_|�dd��|_|�dd��|_tj
|g|�Ri|��dS)N�strict�source_address�socket_options�proxy�proxy_config)r�PY2�pop�getr1�default_socket_optionsr2r3r4�_HTTPConnection�__init__)�self�args�kws   rr:zHTTPConnection.__init__ns����w�	#��F�F�8�T�"�"�"�!�f�f�%5�6�6���!�f�f�%5�t�7R�S�S����V�V�G�T�*�*��
��F�F�>�4�8�8���� ��3��3�3�3��3�3�3�3�3rc�6�|j�d��S)a�
        Getter method to remove any trailing dots that indicate the hostname is an FQDN.

        In general, SSL certificates don't include the trailing dot indicating a
        fully-qualified domain name, and thus, they don't validate properly when
        checked against a domain name that includes the dot. In addition, some
        servers may not expect to receive the trailing dot when provided.

        However, the hostname with trailing dot is critical to DNS resolution; doing a
        lookup with the trailing dot will properly only resolve the appropriate FQDN,
        whereas a lookup without a trailing dot will search the system's search domain
        list. Thus, it's important to keep the original host around for use only in
        those cases where it's appropriate (i.e., when doing DNS lookup to establish the
        actual TCP connection across which we're going to send HTTP requests).
        �.)�	_dns_host�rstrip�r;s r�hostzHTTPConnection.hosts��"�~�$�$�S�)�)�)rc��||_dS)z�
        Setter for the `host` property.

        We assume that only urllib3 uses the _dns_host attribute; httplib itself
        only uses `host`, and it seems reasonable that other libraries follow suit.
        N)r@)r;�values  rrCzHTTPConnection.host�s������rc	�8�i}|jr
|j|d<|jr
|j|d<	tj|j|jf|jfi|��}nO#t$r"t|d|j	�d|j�d����t$r}t|d|z���d}~wwxYw|S)zoEstablish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        r1r2zConnection to z timed out. (connect timeout=�)z(Failed to establish a new connection: %sN)r1r2r$�create_connectionr@�portr�
SocketTimeoutrrC�SocketErrorr)r;�extra_kw�conn�es    r�	_new_connzHTTPConnection._new_conn�s���
����	=�)-�)<�H�%�&���	=�)-�)<�H�%�&�	��/�����+�T�\���=E���D�D���	�	�	�%����9�9�9�d�l�l�l�,���
��	�	�	�$��@�1�D���
�����	����
�s�$A�4B�?B�Bc�$�t|dd��S)N�_tunnel_host)�getattrrBs r�_is_using_tunnelzHTTPConnection._is_using_tunnel�s���t�^�T�2�2�2rc�v�||_|���r|���d|_dSdS)Nr)�sockrS�_tunnel�	auto_open�r;rMs  r�
_prepare_connzHTTPConnection._prepare_conn�s?����	�� � �"�"�	��L�L�N�N�N��D�N�N�N�		�	rc�X�|���}|�|��dS�N)rOrYrXs  r�connectzHTTPConnection.connect�s+���~�~�������4� � � � � rc��t�|��}|r(td|�d|����d����t	j|||g|�Ri|��S)� z+Method cannot contain non-token characters z (found at least rG)�_CONTAINS_CONTROL_CHAR_RE�search�
ValueError�groupr9�
putrequest)r;�method�urlr<�kwargs�matchs      rrczHTTPConnection.putrequest�st��*�0�0��8�8���	��*��6�6�5�;�;�=�=�=�=�*���
�
�)�$���M�d�M�M�M�f�M�M�Mrc�\�td�|D����stj||g|�R�dStj|�����tvrPtdd�ttjtt�������d����dS)r^c3�VK�|]$}t|t��o
|tkV��%dSr[)�
isinstance�strr")�.0�vs  r�	<genexpr>z+HTTPConnection.putheader.<locals>.<genexpr>�s6����K�K�q�:�a��%�%�:�!�{�*:�K�K�K�K�K�Krz(urllib3.util.SKIP_HEADER only supports 'z', '�'N)
�anyr9�	putheaderr�
ensure_str�lowerr#ra�join�maprk�title�sorted)r;�header�valuess   rrqzHTTPConnection.putheader�s����K�K�F�K�K�K�K�K�	��%�d�F�<�V�<�<�<�<�<�<�
�^�F�L�L�N�N�
+�
+�3D�
D�
D��*��;�;�s�3�9�f�5F�.G�.G�H�H�I�I�I�I�L���
�E�
DrNc����|�i}n|���}dd�|D��vrt��|d<tt|���||||���dS)N�
user-agentc3�bK�|]*}tj|�����V��+dSr[�rrrrs�rl�ks  rrnz)HTTPConnection.request.<locals>.<genexpr>�s4����K�K�a���q�w�w�y�y� 9� 9�K�K�K�K�K�Kr�
User-Agent)�body�headers)�copy�_get_default_user_agent�superr�request)r;rdrer�r��	__class__s     �rr�zHTTPConnection.request�su����?��G�G��l�l�n�n�G��K�K�7�K�K�K�K�K�$;�$=�$=�G�L�!�
�n�d�#�#�+�+�F�C�d�G�+�T�T�T�T�Trc�>�|pi}td�|D����}d|v}d|v}|�||||���d|vr"|�dt����|���D]\}}	|�||	���d|vr|�dd	��|���|��tjtfz}
t||
��r|f}|D]�}|s�t|t��s|�
d��}tt|����dd
�}t|�
����}
|
d
z
}
|
|z
}
|
d
z
}
|�|
����|�d��d
S)z�
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        c�Z�g|](}tj|�������)Srr}r~s  r�
<listcomp>z2HTTPConnection.request_chunked.<locals>.<listcomp>�s*��F�F�F��3�>�!�'�'�)�)�4�4�F�F�Frzaccept-encodingrC)�skip_accept_encoding�	skip_hostr{r�ztransfer-encodingzTransfer-Encoding�chunkedN�utf8�s
s0

)�setrcrqr��items�
endheadersr�string_types�bytesrj�encode�hex�len�	bytearray�send)r;rdrer�r��header_keysr�r�rxrE�stringish_types�chunk�len_str�to_sends              r�request_chunkedzHTTPConnection.request_chunked�s���
�-�R���F�F�g�F�F�F�G�G��0�K�?���k�)�	�����C�.B�i�	�	
�	
�	
��{�*�*��N�N�<�)@�)B�)B�C�C�C�$�]�]�_�_�	*�	*�M�F�E��N�N�6�5�)�)�)�)��k�1�1��N�N�.�	�:�:�:���������!�.�%��9�O��$��0�0�
��w���

#�

#�����!�%��/�/�1�!�L�L��0�0�E��c�%�j�j�/�/�!�"�"�-��#�G�N�N�$4�$4�5�5���7�"���5� ���7�"���	�	�'�"�"�"�"�	
�	�	�,�����r)NN)rrr�__doc__�port_by_scheme�default_port�socket�IPPROTO_TCP�TCP_NODELAYr8�is_verifiedr:�propertyrC�setterrOrSrYr\rcrqr�r��
__classcell__)r�s@rrrKs0���������2"�&�)�L� &�1�6�3E�q�I�J���K�4�4�4�"�*�*��X�*�$
�[����[�����>3�3�3����!�!�!�N�N�N����U�U�U�U�U�U�% �% �% �% �% �% �% �% rrc��eZdZdZedZdZdZdZdZ	dZ
dZdZddddde
jddfd�Z									d	d�Zd�Zd�ZdS)
�HTTPSConnectionz�
    Many of the parameters to this constructor are passed to the underlying SSL
    socket by means of :py:func:`urllib3.util.ssl_wrap_socket`.
    r,NFc
��tj|||f||d�|
��||_||_||_||_|	|_d|_dS)N)r0rr,)rr:�key_file�	cert_file�key_password�ssl_context�server_hostname�	_protocol)r;rCrIr�r�r�r0rr�r�r=s           rr:zHTTPSConnection.__init__$s\��	���d�D�W���W�W�TV�W�W�W� ��
�"���(���&���.���!����rc
�J�|�#|j�
|jj}ntd��}||_||_||_||_||_||_|otj
�|��|_|otj
�|��|_
|	|_dS)zX
        This method should only be called once, before the connection is used.
        N)r��verify_moder'r�r��	cert_reqsr��assert_hostnamer%�os�path�
expanduser�ca_certs�ca_cert_dir�ca_cert_data)
r;r�r�r�r�r�r�r%r�r�s
          r�set_certzHTTPSConnection.set_cert>s���"����+� �,�8�	�	�-�d�3�3�	� ��
�"���"���(���.���"4��� �A�R�W�%7�%7��%A�%A��
�&�J�2�7�+=�+=�k�+J�+J���(����rc�h�|���}|j}d}|���rH|jr|�||��}d}||_|���d|_|j}|}|j	�|j	}tj���tk}|r2tjd�t��t"��d}|j�<d}t't)|j��t-|j�����|_|j}t-|j��|_|js4|js-|js&|r$t9|d��r|���t=||j|j |j!|j|j|j|||��
�
|_|rt|j�mt9|jd��rX|j�"��d	vr=tjd
|j�d|j�"���d�tF��|j$r/tI|j�%d�
��|j$��n�|jtLj'kr�tQ|dd��s||j)durs|j�%��}|�*dd��s-tjd�|��tV��tY||j)p|��|jtLj-kp|j$du|_.dS)NFTrzWSystem time is way off (before {0}). This will probably lead to SSL verification errors)�ssl_versionr��load_default_certs)
rU�keyfile�certfiler�r�r�r�r�r��
tls_in_tls�version>�TLSv1.1�TLSv1zjNegotiating TLSv1/TLSv1.1 by default is deprecated and will be disabled in urllib3 v2.0.0. Connecting to 'z' with 'z;' can be enabled by explicitly opting-in with 'ssl_version')�binary_form�check_hostname�subjectAltNamerz�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/urllib3/urllib3/issues/497 for details.))/rOrCrS�tls_in_tls_required�_connect_tls_proxyrUrVrWrQr��datetime�date�today�RECENT_DATE�warnings�warn�formatrr�r&r(r�r'r�r�r�r�r��hasattrr�r)r�r�r�r��DeprecationWarningr%�getpeercert�ssl�	CERT_NONErRr�r7r�_match_hostname�
CERT_REQUIREDr�)	r;rM�hostnamer�r��is_time_off�default_ssl_context�context�certs	         rr\zHTTPSConnection.connect_sr���~�~�����9���
�� � �"�"�	)��'�
"��.�.�x��>�>��!�
��D�I�
�L�L�N�N�N��D�N��(�H�"����+�"�2�O��m�)�)�+�+�k�9���	��M�6��&��%�%�!�
�
�
�$����#�"&��5�/��0@�A�A�+�D�N�;�;� � � �D��
�"��/���?�?���
�
�	)��$�	)��%�	)�$�		)�
��!5�6�6�	)�
�&�&�(�(�(�#���M��^��*��]��(��*�+��!�
�
�
��	�"
 �	�� �(���	�9�-�-�)��	�!�!�#�#�';�;�;��M�M�)-�	�	�	�4�9�3D�3D�3F�3F�3F�3F�H�#�
�
�
��"�	K���	�%�%�$�%�7�7��9P�
�
�
�
�
��3�=�0�0��G�%5�u�=�=�
1��$�E�1�1�
�9�(�(�*�*�D��8�8�,�b�1�1�	
��
�(�)/��x�(8�(8�)����
�D�$�"6�"I�/�J�J�J�
��3�#4�4�
3��&�d�2�	
���rc���|j}|j}|rt|||���St|j|j|j|j|j��}d|_	t||j|j|j||���S)zY
        Establish a TLS connection to the proxy using the provided SSL context.
        )rUr�r�T)rUr�r�r�r�r�)
r4r�r)r
r�r�r�r�r�r�)r;r�rMr4r�s     rr�z"HTTPSConnection._connect_tls_proxy�s����(��"�.���	�#�� (�'����
�/����N��M�����
�
��&*��"����]��(��*�$�#�

�
�
�	
r)	NNNNNNNNN)rrrr�r�r�r�r�r�r�r�r%r�r��_GLOBAL_DEFAULT_TIMEOUTr:r�r\r�rrrr�r�s���������
"�'�*�L��I��H��K��L��K�����
������.���!�!�!�!�8���������)�)�)�)�Bv
�v
�v
�p$
�$
�$
�$
�$
rr�c��	t||��dS#t$r)}t�d||��||_�d}~wwxYw)Nz@Certificate did not match expected hostname: %s. Certificate: %s)r!r �log�warning�
_peer_cert)r��asserted_hostnamerNs   rr�r��sh����t�.�/�/�/�/�/���	�	�	����N���	
�	
�	
����
�����	���s��
A�$A�Ac��dtzS)Nzpython-urllib3/%srrrrr�r�
s
����,�,rc��eZdZdZdS)�DummyConnectionz-Used to detect a failed ConnectionCls import.N)rrrr�rrrr�r�s������7�7��Drr�)B�
__future__rr��loggingr��rer�r�rrKrrJ�packagesr�packages.six.moves.http_clientrr9r	�
util.proxyr
r��SSLErrorr�ImportError�AttributeError�
BaseExceptionr�	NameError�	Exceptionr�_collectionsr�_versionr�
exceptionsrrrr�packages.ssl_match_hostnamer r!�utilr"r#r$�	util.ssl_r%r&r'r(r)�	getLoggerrr�r�r�r��compiler_�objectr�r�r�r��VerifiedHTTPSConnectionrrr�<module>r�s���&�&�&�&�&�&���������	�	�	�	�	�	�	�	�
�
�
�
�����'�'�'�'�'�'�+�+�+�+�+�+�������M�M�M�M�M�M�9�9�9�9�9�9�0�0�0�0�0�0�
��J�J�J��<�L�L���^�$�
�
�
�
�C�
�
�
�
�
�}�
�
�
�
�
�
����
�%�O�O���
�
�
�
�
�
�
�
�)�
�
�
�
�
�
����
�%�O�O���
�
�
�
�
�
�
�
�)�
�
�
�
�
�
����)�(�(�(�(�(�!�!�!�!�!�!�������������J�I�I�I�I�I�I�I�<�<�<�<�<�<�<�<�<�<����������������g���!�!���s�+�+���h�m�D�!�Q�'�'��&�B�J�'E�F�F��F �F �F �F �F �_�f�F �F �F �Rg
�g
�g
�g
�g
�n�g
�g
�g
�T���-�-�-�	�	�	�	�	�f�	�	�	��&�%�O�*���s6�A�A*�)A*�.A1�1B�B�B�B$�#B$

?>