Viewing File: /opt/alt/python35/lib/python3.5/site-packages/urllib3/contrib/__pycache__/ntlmpool.cpython-35.pyc



âì‚V³ã@s¥dZddlmZyddlmZWn"ek
rNddlmZYnXddlmZddl	m	Z	ddl
mZeeƒZ
Gdd„deƒZd	S)
z
NTLM authenticating pool, contributed by erikcederstran

Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10
é)Úabsolute_import)ÚHTTPSConnection)Ú	getLogger)Úntlm)ÚHTTPSConnectionPoolcs[eZdZdZdZ‡fdd†Zdd„Zdddd	d	‡fd
d†Z‡S)ÚNTLMConnectionPoolzQ
    Implements an NTLM authentication version of an urllib3 connection pool
    Zhttpscsjtt|ƒj||Ž||_||_|jddƒ}|djƒ|_|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__©ú/ntlmpool.pyrs		
zNTLMConnectionPool.__init__c
Cs¸|jd7_tjd|j|j|jƒi}d|d<d}d}td|jd|jƒ}d	tj|j	ƒ||<tjd
|ƒ|j
d|jd|ƒ|jƒ}t|j
ƒƒ}tjd|j|jƒtjd
|ƒtjd|jdƒƒd|_||jdƒ}d}x4|D],}	|	dd…dkr1|	dd…}q1W|dkr‡td|||fƒ‚tj|ƒ\}
}tj|
|j|j|j|ƒ}d	|||<tjd
|ƒ|j
d|jd|ƒ|jƒ}tjd|j|jƒtjd
t|j
ƒƒƒtjd|jƒdd…ƒ|jdkrž|jdkr‚tdƒ‚td|j|jfƒ‚d|_tjdƒ|S)Nr	z3Starting NTLM HTTPS connection no. %d: https://%s%sz
Keep-AliveÚ
ConnectionZ
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)Znum_connectionsÚlogÚdebugrrrrrZcreate_NTLM_NEGOTIATE_MESSAGEr
ZrequestZgetresponseÚdictZ
getheadersÚstatusÚreasonÚreadÚfprÚ	ExceptionZparse_NTLM_CHALLENGE_MESSAGEZ create_NTLM_AUTHENTICATE_MESSAGErrr)
rÚheadersZ
req_headerZresp_headerÚconnÚresZreshdrZauth_header_valuesZauth_header_valueÚsZServerChallengeZNegotiateFlagsZauth_msgrrrÚ	_new_conn*s\	
	
		 	
zNTLMConnectionPool._new_connNéTcsD|dkri}d|d<tt|ƒj|||||||ƒS)Nz
Keep-Aliver)r
rÚurlopen)rÚmethodZurlZbodyr(ZretriesZredirectZassert_same_host)rrrr.ks
zNTLMConnectionPool.urlopen)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úschemerr,r.rr)rrrsA	rN)r3Z
__future__rZhttp.clientrÚImportErrorÚhttplibÚloggingrrZurllib3rr0r rrrrrÚ<module>s

Back to Directory File Manager