관리-도구
편집 파일: ntlmpool.cpython-35.pyc
��Re@ � @ s| d Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z e e � Z Gd 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_import)� getLogger)�ntlm� )�HTTPSConnectionPool)�HTTPSConnectionc s[ e Z d Z d Z d Z � f d d � Z d d � Z d d d d d � f d d � Z � S)�NTLMConnectionPoolzQ Implements an NTLM authentication version of an urllib3 connection pool �httpsc sj t t | � j | | � | | _ | | _ | j d d � } | d j � | _ | 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�kwargsZ user_parts)� __class__� ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.pyr s zNTLMConnectionPool.__init__c C s� | j d 7_ t j d | j | j | j � d d i } d } d } t d | j d | j � } d t j | j � | | <t j d | � | j d | j d | � | j � } t | j � � } t j d | j | j � t j d | � t j d | j d � � d | _ | | j d � } d } x4 | D], } | d d � d k r-| d d � } q-W| d k r�t d | | | f � � t j | � \ } } t j | | j | j | j | � } d | | | <t j d | � | j d | j d | � | j � } t j d | j | j � t j d t | j � � � t j d | j � d d � � | j d k r�| j d k r~t d � � t d | j | j f � � d | _ t j d � | S)Nr z3Starting NTLM HTTPS connection no. %d: https://%s%s� Connectionz Keep-Alive� Authorizationzwww-authenticate�host�portzNTLM %szRequest headers: %s�GETzResponse status: %s %szResponse headers: %szResponse data: %s [...]�d z, � zNTLM z!Unexpected %s response header: %s�� i� z3Server rejected request: wrong username or passwordzWrong server response: %s %szConnection established)�num_connections�log�debugr r r r r Zcreate_NTLM_NEGOTIATE_MESSAGEr �request�getresponse�dict� getheaders�status�reason�read�fpr � ExceptionZparse_NTLM_CHALLENGE_MESSAGEZ create_NTLM_AUTHENTICATE_MESSAGEr r r ) r �headersZ req_headerZresp_header�conn�resZreshdrZauth_header_valuesZauth_header_value�sZServerChallengeZNegotiateFlagsZauth_msgr r r � _new_conn'