
    жvg                         d Z ddlmZ ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
  ej        d	e            ee          Z G d
 de          ZdS )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     e Zd ZdZdZ fdZd Z	 	 	 	 	 d	 fd	Z xZS )
NTLMConnectionPoolzQ
    Implements an NTLM authentication version of an urllib3 connection pool
    httpsc                      t          t          |           j        |i | || _        || _        |                    dd          }|d                                         | _        |d         | _        || _	        dS )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.
        \   r   N)
superr
   __init__authurlrawusersplitupperdomainuserpw)selfr   r   r   argskwargs
user_parts	__class__s          a/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.pyr   zNTLMConnectionPool.__init__"   sv     	1 $''0$A&AAAZZa((
 m))++qM	    c                 Z   | xj         dz  c_         t                              d| j         | j        | j                   ddi}d}d}t          | j        | j                  }dt          j        | j	                  z  ||<   t                              d	|           |
                    d
| j        d |           |                                }t          |j                  }t                              d|j        |j                   t                              d|           t                              d|                    d                     d |_        ||                             d          }d }|D ]}	|	d d         dk    r
|	dd          }|t'          d|d||                   t          j        |          \  }
}t          j        |
| j        | j        | j        |          }d|z  ||<   t                              d	|           |
                    d
| j        d |           |                                }t                              d|j        |j                   t                              dt          |j                             t                              d|                                d d                    |j        dk    r9|j        dk    rt'          d          t'          d|j        d|j                  d |_        t                              d           |S )Nr   z3Starting NTLM HTTPS connection no. %d: https://%s%s
Connection
Keep-AliveAuthorizationzwww-authenticate)hostportzNTLM %szRequest headers: %sGETzResponse status: %s %szResponse headers: %szResponse data: %s [...]d   z,    zNTLM zUnexpected z response header:    i  z3Server rejected request: wrong username or passwordzWrong server response:  zConnection established)num_connectionslogdebugr#   r   r   r$   r   create_NTLM_NEGOTIATE_MESSAGEr   requestgetresponsedictheadersstatusreasonreadfpr   	Exceptionparse_NTLM_CHALLENGE_MESSAGE create_NTLM_AUTHENTICATE_MESSAGEr   r   r   )r   r1   
req_headerresp_headerconnresreshdrauth_header_valuesauth_header_valuesServerChallengeNegotiateFlagsauth_msgs                r   	_new_connzNTLMConnectionPool._new_conn0   s    	!		A IL		
 	
 	
  .$
(DIDI>>> ($*LL+
 +
 

 			'111UDL$888  ck""		*CJ
CCC		(&111		+SXXc]];;;  $K066t<< # 	* 	*A!u$%abbE!$)7B{{F;DWDWX  
 +/*K+
 +
' 8TYTWn
 
 ((2
		'111UDL$888  		*CJ
CCC		($s{*;*;<<<		+SXXZZ-=>>>:zS   UVVV)cjjj#**UVVV		*+++r   N   Tc           	      r    |i }d|d<   t          t          |                               |||||||          S )Nr!   r    )r   r
   urlopen)	r   methodurlbodyr1   retriesredirectassert_same_hostr   s	           r   rG   zNTLMConnectionPool.urlopens   sL     ?G ,'..66Cw;K
 
 	
r   )NNrE   TT)	__name__
__module____qualname____doc__schemer   rD   rG   __classcell__)r   s   @r   r
   r
      s          F    A A AN 
 
 
 
 
 
 
 
 
 
r   r
   )rQ   
__future__r   warningsloggingr   r    r   packages.six.moves.http_clientr   warnDeprecationWarningrN   r+   r
    r   r   <module>r\      s    
 ' & & & & &              " " " " " " < < < < < < N    ig
 g
 g
 g
 g
, g
 g
 g
 g
 g
r   