File: //opt/osm/venv/lib64/python3.10/site-packages/urllib3/http2/__pycache__/connection.cpython-310.pyc
o
<i�1 � @ s d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl Zd dl
ZddlmZ ddl
mZ ddlmZmZ ddlmZ ddlmZ eZe�d �Ze�e�Ze�d
�Ze�d�Zddd�Zddd�Z G dd� dej!e �Z"G dd� de�Z#G dd� 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�boolc C � t t�| ��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_name s r �valuec C r )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)r r r r �_is_illegal_header_value, s r c @ s2 e Zd ZdZdZddd�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
c C s t �� | _|| _d S �N)� threading�RLockr r )�selfr r r r �__init__D s
z_LockedObject.__init__r
c C s | j �� | jS r )r �acquirer �r r r r � __enter__H s
z_LockedObject.__enter__�exc_type�type[BaseException] | None�exc_val�BaseException | None�exc_tb�types.TracebackType | None�Nonec C s | j �� d S r )r �release)r r% r'