
    q"h                         S r SSKJr  SSKrSSKJr  SSKJr  SSKJr  SSK	J
r
  \R                  " S	\5        \" \5      r " S
 S\5      rg)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                   P   ^  \ rS rSrSrSrU 4S jrS r     SU 4S jjrSr	U =r
$ )	NTLMConnectionPool   zI
Implements an NTLM authentication version of an urllib3 connection pool
httpsc                    > [         [        U ]
  " U0 UD6  X0l        Xl        UR                  SS5      nUS   R                  5       U l        US   U l        X l	        g)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          V/var/www/html/env/lib/python3.13/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.pyr   NTLMConnectionPool.__init__"   sX     	 $0$A&AZZa(
 m))+qM	    c                 P   U =R                   S-  sl         [        R                  SU R                   U R                  U R                  5        SS0nSnSn[        U R                  U R                  S9nS[        R                  " U R                  5      -  X'   [        R                  S	U5        UR                  S
U R                  S U5        UR                  5       n[        UR                  5      n[        R                  SUR                  UR                  5        [        R                  SU5        [        R                  SUR!                  S5      5        S Ul        Xc   R%                  S5      nS nU H  n	U	S S S:X  d  M  U	SS  nM     Uc  ['        SU< SXc   < 35      e[        R(                  " U5      u  p[        R*                  " XR,                  U R.                  U R0                  U5      nSU-  X'   [        R                  S	U5        UR                  S
U R                  S U5        UR                  5       n[        R                  SUR                  UR                  5        [        R                  S[        UR                  5      5        [        R                  SUR!                  5       S S 5        UR                  S:w  aB  UR                  S:X  a  ['        S5      e['        SUR                  < SUR                  < 35      eS Ul        [        R                  S5        U$ )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   r3   
req_headerresp_headerconnresreshdrauth_header_valuesauth_header_valuesServerChallengeNegotiateFlagsauth_msgs                r   	_new_connNTLMConnectionPool._new_conn0   s    	!		A  IILL		
  .$
(DIIDII> ($*L*LLL+
 
 			'1UDLL$8 ckk"		*CJJ

C		(&1		+SXXc];  $066t< #A!u$%abE! $ $7BFDWX 
 +/*K*K+
' 88YYTWWn
 ((2		'1UDLL$8 		*CJJ

C		($s{{*;<		+SXXZ-=>::zzS  UVVcjj#**UVV		*+r    c           	      D   > Uc  0 nSUS'   [         [        U ]  XX4XVU5      $ )Nr#   r"   )r   r
   urlopen)	r   methodurlbodyr3   retriesredirectassert_same_hostr   s	           r   rI   NTLMConnectionPool.urlopens   s8     ?G ,'6;K
 	
r    )r   r   r   r   r   )NN   TT)__name__
__module____qualname____firstlineno____doc__schemer   rF   rI   __static_attributes____classcell__)r   s   @r   r
   r
      s6     FAN 
 
r    r
   )rV   
__future__r   warningsloggingr   r    r   packages.six.moves.http_clientr   warnDeprecationWarningrR   r-   r
    r    r   <module>rb      sP   
 '    " < N  g
, g
r    