HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/osm/venv/lib64/python3.10/site-packages/urllib3/http2/__pycache__/connection.cpython-310.pyc
o

<i�1�@sddlmZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlmZddl
mZddlmZmZddlmZddlmZeZe�d	�Ze�e�Ze�d
�Ze�d�Zddd�Zddd�Z Gdd�dej!e�Z"Gdd�de�Z#Gdd�de�Z$dS)�)�annotationsN�)�
_TYPE_BODY)�HTTPHeaderDict)�HTTPSConnection�_get_default_user_agent)�ConnectionError)�BaseHTTPResponse�Ts^[!#$%&'*+\-.^_`|~0-9a-z]+$s*[\0\x00\x0a\x0d\r\n]|^[ \r\n\t]|[ \r\n\t]$�name�bytes�return�boolcC�tt�|��S)a5
    "An implementation that validates fields according to the definitions in Sections
    5.1 and 5.5 of [HTTP] only needs an additional check that field names do not
    include uppercase characters." (https://httpwg.org/specs/rfc9113.html#n-field-validity)

    `http.client._is_legal_header_name` does not validate the field name according to the
    HTTP 1.1 spec, so we do that here, in addition to checking for uppercase characters.

    This does not allow for the `:` character in the header name, so should not
    be used to validate pseudo-headers.
    )r�RE_IS_LEGAL_HEADER_NAME�match)r�r�F/opt/osm/venv/lib/python3.10/site-packages/urllib3/http2/connection.py�_is_legal_header_namesr�valuecCr)aK
    "A field value MUST NOT contain the zero value (ASCII NUL, 0x00), line feed
    (ASCII LF, 0x0a), or carriage return (ASCII CR, 0x0d) at any position. A field
    value MUST NOT start or end with an ASCII whitespace character (ASCII SP or HTAB,
    0x20 or 0x09)." (https://httpwg.org/specs/rfc9113.html#n-field-validity)
    )r�RE_IS_ILLEGAL_HEADER_VALUE�search)rrrr�_is_illegal_header_value,src@s2eZdZdZdZddd�Zddd	�Zddd�ZdS)�
_LockedObjectaX
    A wrapper class that hides a specific object behind a lock.
    The goal here is to provide a simple way to protect access to an object
    that cannot safely be simultaneously accessed from multiple threads. The
    intended use of this class is simple: take hold of it with a context
    manager, which returns the protected object.
    )�lock�_obj�objr
cCst��|_||_dS�N)�	threading�RLockrr)�selfrrrr�__init__Ds

z_LockedObject.__init__r
cCs|j��|jSr)r�acquirer�r rrr�	__enter__Hs
z_LockedObject.__enter__�exc_type�type[BaseException] | None�exc_val�BaseException | None�exc_tb�types.TracebackType | None�NonecCs|j��dSr)r�release)r r%r'r)rrr�__exit__Lsz_LockedObject.__exit__N)rr
)r
r
)r%r&r'r(r)r*r
r+)�__name__�
__module__�__qualname__�__doc__�	__slots__r!r$r-rrrrr6s

rcs�eZdZ	d5d6�fd
d�
Zd7d
d�Zd8�fdd�Zd9dd�Zd:dd�Zd5d;dd�Zd<dd�Z				 d=d>d$d%�Z
d?d'd(�Z		d@d)d)d)d*�dAd1d2�Zd8�fd3d4�Z
�ZS)B�HTTP2ConnectionN�host�str�port�
int | None�kwargs�
typing.Anyr
r+csZ|��|_d|_g|_d|vsd|vrtd��t�j||fi|��|jdur+td��dS)N�proxy�proxy_configz$Proxies aren't supported with HTTP/2z%Tunneling isn't supported with HTTP/2)�_new_h2_conn�_h2_conn�
_h2_stream�_headers�NotImplementedError�superr!�_tunnel_host)r r4r6r8��	__class__rrr!Vs

�zHTTP2Connection.__init__�)_LockedObject[h2.connection.H2Connection]cCs tjjdd�}ttjj|d��S)NT)Zclient_side)�config)�h2rFZH2Configurationr�
connectionZH2Connection)r rFrrrr<eszHTTP2Connection._new_h2_conncsft���|j�!}|��|��}r!|j�|�Wd�dSWd�dS1s,wYdSr)rA�connectr=Zinitiate_connection�data_to_send�sock�sendall)r �connrJrCrrrIis
�"�zHTTP2Connection.connect�method�urlcKs�d|vrtd��d|vrtd��|pd|_|�|�d|jvr,d|j�d|jp(d	��}n|j�d|jp4d	��}|j�d
�|j�d|��f�|j�d|��f�|j�d
|��f�|j�}|�	�|_
Wd�dS1sowYdS)z�putrequest
        This deviates from the HTTPConnection method signature since we never need to override
        sending accept-encoding headers or the host header.
        �	skip_hostz`skip_host` isn't supported�skip_accept_encodingz&`skip_accept_encoding` isn't supported�/�:�[z]:i�)s:schemeshttpss:methods
:authoritys:pathN)r@�_request_url�_validate_pathr4r6r?�append�encoder=Zget_next_available_stream_idr>)r rNrOr8�	authorityrMrrr�
putrequestps 



"�zHTTP2Connection.putrequest�header�str | bytes�valuescGs�t|t�r	|��n|}|��}t|�stdt|�����|D]"}t|t�r)|��n|}t|�r8tdt|�����|j�||f�qdS)NzIllegal header name zIllegal header value )	�
isinstancer5rX�lowerr�
ValueErrorrr?rW)r r[r]rrrr�	putheader�s�zHTTP2Connection.putheader�message_bodycCsr|jdur	td��|j� }|j|j|j|dud�|��}r%|j�|�Wd�n1s/wYg|_dS)N�Must call `putrequest` first.)�	stream_id�headers�
end_stream)r>rr=�send_headersr?rJrKrL)r rbrMrJrrr�
endheaders�s
���
zHTTP2Connection.endheaders�datac	Cs||jdur	td��|j��}|��}r|j�|�t|d�rV	|�|j�}|s(nt	|t
�r1|��}|j|j|dd�|��}rF|j�|�q|�
|j�	Wd�dSt	|t
�r_|��}z=t	|t�r{|j|j|dd�|��}rz|j�|�n |D]}|j|j|dd�|��}r�|j�|�q}|�
|j�Wnty�tdt|���wWd�dS1s�wYdS)z�Send data to the server.
        `data` can be: `str`, `bytes`, an iterable, or file-like objects
        that support a .read() method.
        Nrc�readTF)rfz6`data` should be str, bytes, iterable, or file. got %r)r>rr=rJrKrL�hasattrrj�	blocksizer^r5rXZ	send_datarfr�	TypeError�type)r rirMrJ�chunkrrr�send�sV


�	�

�������"�zHTTP2Connection.send�httpre�typing.Mapping[str, str] | None�schemecCstd��)Nz;HTTP/2 does not support setting up a tunnel through a proxy)r@)r r4r6rersrrr�
set_tunnel�s�zHTTP2Connection.set_tunnel�
HTTP2Responsec	Cs*d}t�}|j�t}d}|su|j�d�}rg|�|�}|D]J}t|tjj�rHt	�}|j
D]\}	}
|	dkr:t|
���}q+|�
|	�d�|
�d��q+qt|tjj�r]||j7}|�|j|j�qt|tjj�rfd}q|��}rs|j�|�|r
Wd�n1swY|dus�J�t|||jt|�d�S)NFi��s:status�asciiT)�statusre�request_urlri)�	bytearrayr=rK�recvZreceive_datar^rG�eventsZResponseReceivedrre�int�decode�addZDataReceivedriZacknowledge_received_dataZflow_controlled_lengthrdZStreamEndedrJrLrurUr)r rwrirMrfZ
received_datar{�eventrer[rrJrrr�getresponse�sJ
��
������zHTTP2Connection.getresponseT)�preload_content�decode_content�enforce_content_length�body�_TYPE_BODY | Noner�rr�r�cKs�d|vr	|jdur|j�|j�|�||�|pi}|��D]\}	}
|	��dkr.|
dkr.q|�|	|
�qdt|j�vrC|�dt	��|rR|j
|d�|�|�dS|�
�dS)zSend an HTTP/2 request�chunkedNztransfer-encodings
user-agent)rb)rK�
settimeout�timeoutrZ�itemsr_ra�dictr?rrhrp)r rNrOr�rer�r�r�r8�k�vrrr�requests 

zHTTP2Connection.requestc	s�|j�$}z|��|��}r|j�|�Wn	tyYnwWd�n1s*wY|��|_d|_g|_t	��
�dSr)r=Zclose_connectionrJrKrL�	Exceptionr<r>r?rA�close)r rMrirCrrr�3s����
	zHTTP2Connection.closer)r4r5r6r7r8r9r
r+)r
rE�r
r+)rNr5rOr5r8r9r
r+)r[r\r]r\r
r+)rbr9r
r+)rir9r
r+)NNrq)
r4r5r6r7rerrrsr5r
r+)r
ru)NN)rNr5rOr5r�r�rerrr�rr�rr�rr8r9r
r+)r.r/r0r!r<rIrZrarhrprtr�r�r��
__classcell__rrrCrr3Us,�



0�
.��'r3csDeZdZ	dd�fdd�
Zeddd��Zddd�Zddd�Z�ZS)ruFrwr|rerrxr5rirr�rr
r+c	s*t�j||ddd||d�||_d|_dS)N�zHTTP/2)rwre�version�version_string�reasonr�rxr)rAr!�_data�length_remaining)r rwrerxrir�rCrrr!Fs�
zHTTP2Response.__init__cCs|jSr)r�r#rrrri\szHTTP2Response.datacC�dSrrr#rrr�get_redirect_location`�z#HTTP2Response.get_redirect_locationcCr�rrr#rrrr�cr�zHTTP2Response.close)F)rwr|rerrxr5rirr�rr
r+)r
rr�)	r.r/r0r!�propertyrir�r�r�rrrCrruDs�
ru)rrr
r)rrr
r)%�
__future__r�logging�rer�types�typingZ	h2.configrGZ
h2.connectionZ	h2.eventsZ_base_connectionr�_collectionsrrHrr�
exceptionsr�responser	Zorig_HTTPSConnection�TypeVarr
�	getLoggerr.�log�compilerrrr�Genericrr3rurrrr�<module>s2






p