
    	^c                     ~    d dl Z ddlmZ ddlmZ ddlmZmZ ddlmZ ej	        Z	ej
        Z
 G d d          Zd	 ZdS )
    N   )_)open)pycompatutil)urlutilc                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )httpsendfilezThis is a wrapper around the objects returned by python's "open".

    Its purpose is to send file-like objects via HTTP.
    It do however not define a __len__ attribute because the length
    might be more than Py_ssize_t can handle.
    c                 F   || _         t          |i || _        | j        j        | _        | j        j        | _        | j        j        | _        t          j        | j                                                  j	        | _
        d| _        |                                 | _        d S )Nr   )uir   _dataseekclosewriteosfstatfilenost_sizelength_pos_makeprogress	_progress)selfr   argskwargss       :/usr/lib/python3/dist-packages/mercurial/httpconnection.py__init__zhttpsendfile.__init__%   s    4*6**
JO	Z%
Z%
htz002233;	++--    c                     | j                             t          d          t          d          | j        dz  dz            S )Ns   sendings   kb      )unittotal)r   makeprogressr   r   r   s    r   r   zhttpsendfile._makeprogress/   sB     w##jMM%1Dq1H $ 
 
 	
r   c                      | j         j        |i |}|s| j                                         |S | xj        t          |          z  c_        | j                            | j        dz             |S )Nr    )r   readr   completer   lenupdate)r   r   r   rets       r   r'   zhttpsendfile.read9   ss    djot.v.. 	N##%%%J		SXX		di4/000
r   c                     | S N r%   s    r   	__enter__zhttpsendfile.__enter__B   s    r   c                 .    |                                   d S r-   )r   )r   exc_typeexc_valexc_tbs       r   __exit__zhttpsendfile.__exit__E   s    

r   N)	__name__
__module____qualname____doc__r   r   r'   r/   r4   r.   r   r   r
   r
      si         . . .
 
 
        r   r
   c                 x   t          j        |          }i }|                     d          D ]\  }}|dv r
d|vr&|                     t	          d          |z             4|                    dd          \  }}|                    |i           }|dv rt          j        |          }|||<   |	                    dd          \  }	}
d }d}d }|
                                D ]X\  }}|r||                    d	|          k    r#|                    d
          }|s;t          j        |          }|j        r|j        |k    rbd |_        t          |          }|	                    dd          }t!          |          dk    r|d         g|d         }}n)|                    d          pd	                                }|dk    s|
                    |          rat!          |          |k    st!          |          |k    r;|s9d	|v r5|	|v r1t!          |          }||f}|                    d	          }|r|s||d	<   Z|S )Ns   auth)s
   cookiefile   .s!   ignoring invalid [auth] key '%s'
r   )   usernames   certs   keys   ://r   r;   s   prefixs   schemess   https   *)r   bytesurlconfigitemswarnr   rsplit
setdefaultr   
expandpathsplititemsgetr   urluserbytesr)   
startswith)r   urirG   groupskeyvalgroupsettinggdictschemehostpathbestuserbestlenbestauthauthprefix	prefixurlpschemess                      r   readauthforurir[   J   s   

C
 
 CFNN7++  S"""s??GGA;<<sBCCCD!,,w!!%,,444/#&&Cg yy++FHHGH||~~ )) ))t 	DDHH[$7777 )$$ 	K''	> 	in44  	y!!LL##q66A:: tfadVGGxx
++7x>>@@Gt^^x226::^Fg%%KK7**$ +#t++ '!!&kkGd{Hxx,,H )H )$([!Or   )r   i18nr   r   r    r   utilsr   urlerrurlreqr
   r[   r.   r   r   <module>ra      s    
			                        
 
	) ) ) ) ) ) ) )Z@ @ @ @ @r   