HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/__pycache__/httpconnection.cpython-310.pyc
o

�]Lb�@spddlmZddlZddlmZddlmZddlmZmZddl	m
Z
ejZejZGdd	�d	e
�Zd
d�ZdS)�)�absolute_importN�)�_)�open)�pycompat�util)�urlutilc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�httpsendfilez�This 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.
    cOs\||_t|i|��|_|jj|_|jj|_|jj|_t�|j���j	|_
d|_|��|_
dS)Nr)�uir�_data�seek�close�write�os�fstat�fileno�st_size�length�_pos�
_makeprogress�	_progress)�selfr
�args�kwargs�r�:/usr/lib/python3/dist-packages/mercurial/httpconnection.py�__init__&s


zhttpsendfile.__init__cCs$|jjtd�td�|jddd�S)Nssendingskb��)�unit�total)r
�makeprogressrr�rrrrr0s�zhttpsendfile._makeprogresscOsL|jj|i|��}|s|j��|S|jt|�7_|j�|jd�|S)Nr)r�readr�completer�len�update)rrr�retrrrr#:s
zhttpsendfile.readcCs|S�Nrr"rrr�	__enter__Cszhttpsendfile.__enter__cCs|��dSr()r
)r�exc_type�exc_val�exc_tbrrr�__exit__Fszhttpsendfile.__exit__N)	�__name__�
__module__�__qualname__�__doc__rrr#r)r-rrrrr	s

	r	cCs�t�|�}i}|�d�D]2\}}|dvrqd|vr#|�td�|�q|�dd�\}}|�|i�}|dvr:t�|�}|||<q|�	dd�\}	}
d}d}d}
t�
|�D]�\}}|ra||�d	|�kraqR|�d
�}|siqRt�
|�}|jrw|j|krwqRd|_t|�}|�	dd�}t|�dkr�|dg|d}}n	|�d�p�d�	�}|d
ks�|
�|�r�t|�|ks�t|�|kr�|s�d	|vr�|	|vr�t|�}||f}
|�d	�}|r�|s�||d	<qR|
S)Nsauth)s
cookiefile�.s!ignoring invalid [auth] key '%s'
r)�usernamescertskeys://rr3sprefixsschemesshttps�*)r�bytesurl�configitems�warnr�rsplit�
setdefaultr�
expandpath�split�	iteritems�getr�url�user�bytesr%�
startswith)r
�urir?�groups�key�val�group�setting�gdict�scheme�hostpath�bestuser�bestlen�bestauth�auth�prefix�	prefixurl�p�schemesrrr�readauthforuriKs\




�
�rS)�
__future__rr�i18nrrr�r�utilsr�urlerr�urlreq�objectr	rSrrrr�<module>s
-