zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
U
I=®d@ã@s\dZddlmZddlmZddlmZddlmZddlm    Z    ee
ƒZ Gdd    „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_import)Ú    getLogger)Úntlmé)ÚHTTPSConnectionPool)ÚHTTPSConnectioncs:eZdZdZdZ‡fdd„Zdd„Zd ‡fd
d „    Z‡ZS) ÚNTLMConnectionPoolzQ
    Implements an NTLM authentication version of an urllib3 connection pool
    ÚhttpscsLtt|ƒj||Ž||_||_| 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ÚkwargsZ
user_parts©Ú    __class__©ú[D:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_vendor/urllib3/contrib/ntlmpool.pyr s 
zNTLMConnectionPool.__init__c Csô|jd7_t d|j|j|j¡ddi}d}d}t|j|jd}dt |j    ¡||<t d    |¡| 
d
|jd|¡|  ¡}t |  ¡ƒ}t d |j|j¡t d |¡t d | d¡¡d|_|| d¡}d}|D] }    |    dd…dkrÖ|    dd…}qÖ|dkrtd|||fƒ‚t |¡\}
} t |
|j|j|j| ¡} d| ||<t d    |¡| 
d
|jd|¡|  ¡}t d |j|j¡t d t |  ¡ƒ¡t d | ¡dd…¡|jdkrà|jdkrÌtdƒ‚td|j|jfƒ‚d|_t d¡|S)Nr z3Starting 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 %s response header: %séÈi‘z3Server rejected request: wrong username or passwordzWrong server response: %s %szConnection established)Únum_connectionsÚlogÚdebugrrrr rZcreate_NTLM_NEGOTIATE_MESSAGErÚrequestÚ getresponseÚdictÚ
getheadersÚstatusÚreasonÚreadÚfprÚ    ExceptionZparse_NTLM_CHALLENGE_MESSAGEZ create_NTLM_AUTHENTICATE_MESSAGErrr) rÚheadersZ
req_headerZ resp_headerÚconnÚresZreshdrZauth_header_valuesZauth_header_valueÚsZServerChallengeZNegotiateFlagsZauth_msgrrrÚ    _new_conn'snüÿ
 
ÿÿÿ    
zNTLMConnectionPool._new_connNéTc    s0|dkr i}d|d<tt|ƒ |||||||¡S)Nrr)r rÚurlopen)rÚmethodÚurlÚbodyr1ÚretriesÚredirectÚassert_same_hostrrrr7js
 
ÿzNTLMConnectionPool.urlopen)NNr6TT)    Ú__name__Ú
__module__Ú __qualname__Ú__doc__Úschemer r5r7Ú __classcell__rrrrrs GørN) rAÚ
__future__rÚloggingrrÚrZpackages.six.moves.http_clientrr>r&rrrrrÚ<module>s