HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/h11/__pycache__/_receivebuffer.cpython-310.pyc
o

���g��@sJddlZddlZddlmZmZmZdgZe�dej�Z	Gdd�d�Z
dS)�N)�List�Optional�Union�
ReceiveBuffers

?
c@s�eZdZddd�Zdeeefddfdd�Zdefdd	�Z	de
fd
d�Zdefdd
�Zde
defdd�Z
de
deefdd�Zdeefdd�Zdeeefdd�Zdefdd�ZdS)r�returnNcCst�|_d|_d|_dS�Nr)�	bytearray�_data�_next_line_search�_multiple_lines_search��self�r�=/usr/local/lib/python3.10/dist-packages/h11/_receivebuffer.py�__init__0s
zReceiveBuffer.__init__�	byteslikecCs|j|7_|S�N)r	)r
rrrr�__iadd__5szReceiveBuffer.__iadd__cCstt|��Sr)�bool�lenrrrr�__bool__9szReceiveBuffer.__bool__cC�
t|j�Sr)rr	rrrr�__len__<�
zReceiveBuffer.__len__cCrr)�bytesr	rrrr�	__bytes__@rzReceiveBuffer.__bytes__�countcCs*|jd|�}|jd|�=d|_d|_|Sr)r	r
r�r
r�outrrr�_extractCs
zReceiveBuffer._extractcCs |jd|�}|sdS|�|�S)zB
        Extract a fixed number of bytes from the buffer.
        N)r	rrrrr�maybe_extract_at_mostMs
z#ReceiveBuffer.maybe_extract_at_mostcCsHtd|jd�}|j�d|�}|dkrt|j�|_dS|d}|�|�S)zK
        Extract the first line, if it is completed in the buffer.
        r��
���N�)�maxr
r	�findrr)r
�search_start_index�partial_idx�idxrrr�maybe_extract_next_lineWs
z%ReceiveBuffer.maybe_extract_next_linecCs�|jdd�dkr|�d�gS|jdd�dkr |�d�gSt�|j|j�}|dur9tdt|j�d�|_dS|�d�d}|�|�}|�d�}|D]
}|�	d�rV|d=qL|d	|dkrfd
ksiJ�J�|d	d�=|S)z\
        Extract everything up to the first blank line, and return a list of lines.
        Nr!�
r$r"rr#�
����)
r	r�blank_line_regex�searchrr%r�span�split�endswith)r
�matchr)r�lines�linerrr�maybe_extract_lineshs(




�$
z!ReceiveBuffer.maybe_extract_linescCs&z|jddkWStyYdSw)Nr�!F)r	�
IndexErrorrrrr�+is_next_line_obviously_invalid_request_line�s
�z9ReceiveBuffer.is_next_line_obviously_invalid_request_line)rN)�__name__�
__module__�__qualname__rrrrrrr�intrrrrr r*rr7r:rrrrr/s


+)�re�sys�typingrrr�__all__�compile�	MULTILINEr/rrrrr�<module>s'