Format: application/x-python-code
⬇ Download File (3.1 KB)
   1  o
   2  
   3  .'h��@sJddlZddlZddlmZmZmZdgZe�dej�Z	Gdd�d�Z
   4  dS)�N)�List�Optional�Union�
   5  ReceiveBuffers
   6  
   7  ?
   8  c@s�eZdZddd�Zdeeefddfdd�Zdefdd	�Z	de
   9  fd
  10  d�Zdefdd
  11  �Zde
  12  defdd�Z
  13  de
  14  deefdd�Zdeefdd�Zdeeefdd�Zdefdd�ZdS)r�returnNcCst�|_d|_d|_dS�Nr)�	bytearray�_data�_next_line_search�_multiple_lines_search��self�r�HC:\Users\shubh\Videos\agent\nova\Lib\site-packages\h11/_receivebuffer.py�__init__0s
  15  zReceiveBuffer.__init__�	byteslikecCs|j|7_|S�N)r	)r
  16  rrrr�__iadd__5szReceiveBuffer.__iadd__cCstt|��Sr)�bool�lenrrrr�__bool__9szReceiveBuffer.__bool__cC�
  17  t|j�Sr)rr	rrrr�__len__<�
  18  zReceiveBuffer.__len__cCrr)�bytesr	rrrr�	__bytes__@rzReceiveBuffer.__bytes__�countcCs*|jd|�}|jd|�=d|_d|_|Sr)r	r
  19  r�r
  20  r�outrrr�_extractCs
  21  zReceiveBuffer._extractcCs |jd|�}|sdS|�|�S)zB
  22          Extract a fixed number of bytes from the buffer.
  23          N)r	rrrrr�maybe_extract_at_mostMs
  24  z#ReceiveBuffer.maybe_extract_at_mostcCsHtd|jd�}|j�d|�}|dkrt|j�|_dS|d}|�|�S)zK
  25          Extract the first line, if it is completed in the buffer.
  26          r��
  27  �����N�)�maxr
  28  r	�findrr)r
  29  Zsearch_start_indexZpartial_idx�idxrrr�maybe_extract_next_lineWs
  30  z%ReceiveBuffer.maybe_extract_next_linecCs�|jdd�dkr|�d�gS|jdd�dkr |�d�gSt�|j|j�}|dur9tdt|j�d�|_dS|�d�d}|�|�}|�d�}|D]
  31  }|�	d�rV|d=qL|d	|dkrfd
  32  ksiJ�J�|d	d�=|S)z\
  33          Extract everything up to the first blank line, and return a list of lines.
  34          Nr!�
  35  r$r"rr#�
  36  ������)
  37  r	r�blank_line_regex�searchrr%r�span�split�endswith)r
  38  �matchr'r�lines�linerrr�maybe_extract_lineshs(
  39  
  40  
  41  
  42  
  43  �$
  44  z!ReceiveBuffer.maybe_extract_linescCs&z|jddkWStyYdSw)Nr�!F)r	�
  45  IndexErrorrrrr�+is_next_line_obviously_invalid_request_line�s
  46  �z9ReceiveBuffer.is_next_line_obviously_invalid_request_line)rN)�__name__�
  47  __module__�__qualname__rrrrrrr�intrrrrr r(rr5r8rrrrr/s
  48  
  49  
  50  +)�re�sys�typingrrr�__all__�compile�	MULTILINEr-rrrrr�<module>s'