� ��^i����dZddlmZddlZddlmZddlmZddlmZddl m Z ej d e ��ee ��ZGd �d e��ZdS) z NTLM authenticating pool, contributed by erikcederstran Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10 �)�absolute_importN)� getLogger)�ntlm�)�HTTPSConnectionPool)�HTTPSConnectiona#The 'urllib3.contrib.ntlmpool' module is deprecated and will be removed in urllib3 v2.0 release, urllib3 is not able to support it properly due to reasons listed in issue: https://github.com/urllib3/urllib3/issues/2282. If you are a user of this module please comment in the mentioned issue.c�B��eZdZdZdZ�fd�Zd�Z d �fd� Z�xZS) �NTLMConnectionPoolzQ Implements an NTLM authentication version of an urllib3 connection pool �httpsc����tt|��j|i|��||_||_|�dd��}|d���|_|d|_||_ dS)z� authurl is a random URL on the server that is protected by NTLM. user is the Windows user, probably in the DOMAIN\username format. pw is the password for the user. �\�rN) �superr �__init__�authurl�rawuser�split�upper�domain�user�pw)�selfrrr�args�kwargs� user_parts� __class__s ���/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.pyrzNTLMConnectionPool.__init__"sv��� 1�� �$�'�'�0�$�A�&�A�A�A��� ��� ��Z�Z��a�(�(� � ��m�)�)�+�+�� ��q�M�� ������c��|xjdz c_t�d|j|j|j��ddi}d}d}t |j|j���}dtj|j ��z||<t�d |��|� d |jd|��|� ��}t|� ����}t�d |j|j��t�d |��t�d |�d����d|_||�d��}d}|D]} | dd�dkr | dd�}�|�t'd|�d||�����tj|��\} } tj| |j|j|j| ��} d| z||<t�d |��|� d |jd|��|� ��}t�d |j|j��t�d t|� ������t�d |���dd���|jdkr9|jdkrt'd���t'd|j�d|j�����d|_t�d��|S)Nrz3Starting NTLM HTTPS connection no. %d: https://%s%s� Connection� Keep-Alive� Authorizationzwww-authenticate)�host�portzNTLM %szRequest headers: %s�GETzResponse status: %s %szResponse headers: %szResponse data: %s [...]�dz, �zNTLM z Unexpected z response header: ��i�z3Server rejected request: wrong username or passwordzWrong server response: � zConnection established)�num_connections�log�debugr#rrr$r�create_NTLM_NEGOTIATE_MESSAGEr�request� getresponse�dict� getheaders�status�reason�read�fpr� Exception�parse_NTLM_CHALLENGE_MESSAGE� create_NTLM_AUTHENTICATE_MESSAGErrr) r�headers� req_header� resp_header�conn�res�reshdr�auth_header_values�auth_header_value�s�ServerChallenge�NegotiateFlags�auth_msgs r� _new_connzNTLMConnectionPool._new_conn0s$�� ����!��� � � � A� � � �I� �L�  � � � ��.��$� �(� ��D�I�D�I�>�>�>��(�$�*L� �L�+ �+ � �� �� � � �'��1�1�1� � � �U�D�L�$��8�8�8���� � ���c�n�n�&�&�'�'�� � � �*�C�J�� �C�C�C� � � �(�&�1�1�1� � � �+�S�X�X�c�]�]�;�;�;����$�K�0�6�6�t�<�<�� ��#� *� *�A���!��u����$%�a�b�b�E�!�� � $��)�7B�{�{�F�;�DW�DW�X��� � +/�*K� �+ �+ �'����8� �T�Y�� �T�W�n� � ��(�(�2�� �� � � �'��1�1�1� � � �U�D�L�$��8�8�8���� � �� � � �*�C�J�� �C�C�C� � � �(�$�s�~�~�/?�/?�*@�*@�A�A�A� � � �+�S�X�X�Z�Z����-=�>�>�>� �:�� � ��z�S� � �� U�V�V�V��)�c�j�j�j�#�*�*�U�V�V� V���� � � �*�+�+�+�� rN�Tc �r��|�i}d|d<tt|���|||||||��S)Nr!r )rr �urlopen) r�method�url�bodyr9�retries�redirect�assert_same_hostrs �rrHzNTLMConnectionPool.urlopenssL��� �?��G� ,�� ���'��.�.�6�6� �C��w���;K� � � r)NNrFTT) �__name__� __module__� __qualname__�__doc__�schemerrErH� __classcell__)rs@rr r s�����������F� � � � � �A�A�A�N����� � � � � � � � � � rr )rR� __future__r�warnings�loggingrr�r�packages.six.moves.http_clientr�warn�DeprecationWarningrOr+r �rr�r]s����� '�&�&�&�&�&�����������������"�"�"�"�"�"�<�<�<�<�<�<� �� �N�� ����i�����g �g �g �g �g �,�g �g �g �g �g r