
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
•�abc           @@  s\  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z m	 Z
 d  d l Z d d l m Z d d l m Z d d l m Z y d  d l Z e j Z Wn3 e e f k
 rì d Z d e f d	 „  ƒ  YZ n Xy
 e Z Wn' e k
 r d
 e f d „  ƒ  YZ n Xd d l m Z m Z m Z m  Z  d d l! m" Z" m# Z# d d l$ m% Z% m& Z& m' Z' m( Z( m) Z) d d l* m+ Z+ d d l, m- Z- e j. e/ ƒ Z0 i d d 6d d 6Z1 e j2 d d d ƒ Z3 d e4 f d „  ƒ  YZ5 d e e4 f d „  ƒ  YZ d e f d „  ƒ  YZ6 d e6 f d „  ƒ  YZ7 d „  Z8 e rRe6 Z9 e7 Z6 n e5 Z6 d S(   i    (   t   absolute_importN(   t   errort   timeouti   (   t   six(   t   HTTPConnection(   t   HTTPExceptiont   BaseSSLErrorc           B@  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR      s   t   ConnectionErrorc           B@  s   e  Z RS(    (   R   R   (    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR	      s   (   t   NewConnectionErrort   ConnectTimeoutErrort   SubjectAltNameWarningt   SystemTimeWarning(   t   match_hostnamet   CertificateError(   t   resolve_cert_reqst   resolve_ssl_versiont   assert_fingerprintt   create_urllib3_contextt   ssl_wrap_socket(   t
   connection(   t   HTTPHeaderDictiP   t   httpi»  t   httpsià  t   DummyConnectionc           B@  s   e  Z d  Z RS(   s-   Used to detect a failed ConnectionCls import.(   R   R   t   __doc__(    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR   A   s   R   c           B@  si   e  Z d  Z e d Z e j e j d f g Z e	 Z
 d „  Z d „  Z d „  Z d „  Z d d d „ Z RS(	   s{  
    Based on httplib.HTTPConnection but provides an extra constructor
    backwards-compatibility layer between older and newer Pythons.

    Additional keyword parameters are used to configure attributes of the connection.
    Accepted parameters include:

      - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
      - ``source_address``: Set the source address for the current connection.

        .. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x

      - ``socket_options``: Set specific options on the underlying socket. If not specified, then
        defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
        Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.

        For example, if you wish to enable TCP Keep Alive in addition to the defaults,
        you might pass::

            HTTPConnection.default_socket_options + [
                (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
            ]

        Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).
    R   i   c         O@  s   t  j r | j d d  ƒ n  | j d ƒ |  _ t j d k  rP | j d d  ƒ n  | j d |  j ƒ |  _	 t
 j |  | | Ž d  S(   Nt   strictt   source_addressi   i   t   socket_options(   i   i   (   R   t   PY3t   popt   Nonet   getR   t   syst   version_infot   default_socket_optionsR   t   _HTTPConnectiont   __init__(   t   selft   argst   kw(    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR&   j   s    	c         C@  s¾   i  } |  j  r |  j  | d <n  |  j r8 |  j | d <n  y( t j |  j |  j f |  j | � } WnW t k
 r” } t |  d |  j |  j f ƒ ‚ n& t	 k
 r¹ } t
 |  d | ƒ ‚ n X| S(   sp    Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        R   R   s0   Connection to %s timed out. (connect timeout=%s)s(   Failed to establish a new connection: %s(   R   R   R   t   create_connectiont   hostt   portR   t   SocketTimeoutR   t   SocketErrorR
   (   R'   t   extra_kwt   connt   e(    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt	   _new_conn   s     		"c         C@  s5   | |  _  t |  d d  ƒ r1 |  j ƒ  d |  _ n  d  S(   Nt   _tunnel_hosti    (   t   sockt   getattrR    t   _tunnelt	   auto_open(   R'   R0   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt   _prepare_connš   s    	
c         C@  s   |  j  ƒ  } |  j | ƒ d  S(   N(   R2   R8   (   R'   R0   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt   connect¥   s    c         C@  sŠ  t  | d k	 r | n i  ƒ } d | k } d | k } |  j | | d | d | ƒx* | j ƒ  D] \ } } |  j | | ƒ q_ Wd | k rž |  j d d ƒ n  |  j ƒ  | d k	 ryt j t j f }	 t	 | |	 ƒ râ | f } n  x” | D]‰ }
 |
 sû qé n  t	 |
 t j ƒ s|
 j
 d ƒ }
 n  t t |
 ƒ ƒ d	 } |  j | j
 d
 ƒ ƒ |  j d ƒ |  j |
 ƒ |  j d ƒ qé Wn  |  j d ƒ d S(   sƒ   
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        s   accept-encodingR+   t   skip_accept_encodingt	   skip_hosts   transfer-encodings   Transfer-Encodingt   chunkedt   utf8i   s   utf-8s   
s   0

N(   R   R    t
   putrequestt   itemst	   putheadert
   endheadersR   t   string_typest   binary_typet
   isinstancet   encodet   hext   lent   send(   R'   t   methodt   urlt   bodyt   headersR:   R;   t   headert   valuet   stringish_typest   chunkt   len_str(    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt   request_chunked©   s8    
N(   R   R   R   t   port_by_schemet   default_portt   sockett   IPPROTO_TCPt   TCP_NODELAYR$   t   Falset   is_verifiedR&   R2   R8   R9   R    RR   (    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR   F   s   
				t   HTTPSConnectionc           B@  s?   e  Z e d  Z d Z d d d d e j d d „ Z d „  Z	 RS(   R   c   	   	   K@  sJ   t  j |  | | d | d | | �| |  _ | |  _ | |  _ d |  _ d  S(   NR   R   R   (   R   R&   t   key_filet	   cert_filet   ssl_contextt	   _protocol(	   R'   R+   R,   R[   R\   R   R   R]   R)   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR&   Õ   s    
			c      	   C@  s€   |  j  ƒ  } |  j | ƒ |  j d  k rO t d t d  ƒ d t d  ƒ ƒ |  _ n  t d | d |  j d |  j	 d |  j ƒ |  _
 d  S(   Nt   ssl_versiont	   cert_reqsR4   t   keyfilet   certfileR]   (   R2   R8   R]   R    R   R   R   R   R[   R\   R4   (   R'   R0   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR9   ä   s    		N(
   R   R   RS   RT   R    R_   RU   t   _GLOBAL_DEFAULT_TIMEOUTR&   R9   (    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRZ   Ð   s   
		t   VerifiedHTTPSConnectionc           B@  sS   e  Z d  Z d Z d Z d Z d Z d Z d d d d d d d d „ Z	 d „  Z
 RS(   s[   
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    c         C@  s©   | d k rB | s | r! d } qB |  j d k	 rB |  j j } qB n  | |  _ | |  _ | |  _ | |  _ | |  _ | o„ t j	 j
 | ƒ |  _ | oŸ t j	 j
 | ƒ |  _ d S(   sX   
        This method should only be called once, before the connection is used.
        t   CERT_REQUIREDN(   R    R]   t   verify_modeR[   R\   R`   t   assert_hostnameR   t   ost   patht
   expandusert   ca_certst   ca_cert_dir(   R'   R[   R\   R`   Rk   Rg   R   Rl   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt   set_cert  s    						c         C@  sü  |  j  ƒ  } |  j } t |  d d  ƒ rO | |  _ |  j ƒ  d |  _ |  j } n  t j	 j
 ƒ  t k  } | r† t j d j t ƒ t ƒ n  |  j d  k rÂ t d t |  j ƒ d t |  j ƒ ƒ |  _ n  |  j } t |  j ƒ | _ t d | d |  j d |  j d	 |  j d
 |  j d | d | ƒ |  _ |  j rJt |  j j d t ƒ |  j ƒ nŠ | j t j  k rÔt | d t! ƒ rÔ|  j" t! k	 rÔ|  j j ƒ  } | j# d d ƒ s»t j d j | ƒ t$ ƒ n  t% | |  j" pÍ| ƒ n  | j t j& k pò|  j d  k	 |  _' d  S(   NR3   i    sW   System time is way off (before {0}). This will probably lead to SSL verification errorsR_   R`   R4   Ra   Rb   Rk   Rl   t   server_hostnameR]   t   binary_formt   check_hostnamet   subjectAltNamesê   Certificate for {0} has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)(    ((   R2   R+   R5   R    R4   R6   R7   R3   t   datetimet   datet   todayt   RECENT_DATEt   warningst   warnt   formatR   R]   R   R   R_   R   R`   Rf   R   R[   R\   Rk   Rl   R   t   getpeercertt   Truet   sslt	   CERT_NONERX   Rg   R!   R   t   _match_hostnameRe   RY   (   R'   R0   t   hostnamet   is_time_offt   contextt   cert(    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR9     sT    		
	
						
N(   R   R   R   R    R`   Rk   Rl   R_   R   Rm   R9   (    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyRd   ö   s   c         C@  sJ   y t  |  | ƒ Wn2 t k
 rE } t j d | |  ƒ |  | _ ‚  n Xd  S(   Ns@   Certificate did not match expected hostname: %s. Certificate: %s(   R   R   t   logR   t
   _peer_cert(   R�   t   asserted_hostnameR1   (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyR}   b  s    
	(:   t
   __future__R    Rr   t   loggingRh   R"   RU   R   R.   R   R-   Rv   t   packagesR   t   packages.six.moves.http_clientR   R%   R   R{   t   SSLErrorR   t   ImportErrort   AttributeErrorR    t   BaseExceptionR	   t	   NameErrort	   Exceptiont
   exceptionsR
   R   R   R   t   packages.ssl_match_hostnameR   R   t	   util.ssl_R   R   R   R   R   t   utilR   t   _collectionsR   t	   getLoggerR   R‚   RS   Rs   Ru   t   objectR   RZ   Rd   R}   t   UnverifiedHTTPSConnection(    (    (    sB   /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.pyt   <module>   sN   
"(	
Š&l		