HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/websockets/legacy/__pycache__/http.cpython-310.pyc
o

�h��@s�ddlmZddlZddlZddlZddlmZddlmZddgZ	e
ej�dd	��Z
e
ej�d
d��Zddd�Ze�d�Ze�d�Zd dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$�)�annotationsN�)�Headers)�
SecurityError�read_request�
read_response�WEBSOCKETS_MAX_NUM_HEADERS�128�WEBSOCKETS_MAX_LINE_LENGTH�8192�value�bytes�return�strcCs|jdd�S)zG
    Decode a bytestring for interpolating into an error message.

    �backslashreplace)�errors)�decode)r�r�I/usr/local/CyberCP/lib/python3.10/site-packages/websockets/legacy/http.py�dsrs[-!#$%&\'*+.^_`|~0-9a-zA-Z]+s[\x09\x20-\x7e\x80-\xff]*�stream�asyncio.StreamReader�tuple[str, Headers]c
�s��z	t|�IdH}Wnty}ztd�|�d}~wwz|�dd�\}}}Wnty8tdt|����d�w|dkrFtdt|�����|dkrStd	t|�����|�d
d�}t|�IdH}||fS)a�
    Read an HTTP/1.1 GET request and return ``(path, headers)``.

    ``path`` isn't URL-decoded or validated in any way.

    ``path`` and ``headers`` are expected to contain only ASCII characters.
    Other characters are represented with surrogate escapes.

    :func:`read_request` doesn't attempt to read the request body because
    WebSocket handshake requests don't have one. If the request contains a
    body, it may be read from ``stream`` after this coroutine returns.

    Args:
        stream: Input to read the request from.

    Raises:
        EOFError: If the connection is closed without a full HTTP request.
        SecurityError: If the request exceeds a security limit.
        ValueError: If the request isn't well formatted.

    Nz1connection closed while reading HTTP request line� rzinvalid HTTP request line: sGETzunsupported HTTP method: �HTTP/1.1�unsupported HTTP version: �ascii�surrogateescape)�	read_line�EOFError�split�
ValueErrorrr�read_headers)r�request_line�exc�method�raw_path�version�path�headersrrrr-s&�
����tuple[int, str, Headers]c	
�s �z	t|�IdH}Wnty}ztd�|�d}~wwz|�dd�\}}}Wnty8tdt|����d�w|dkrFtdt|�����zt|�}Wnty]tdt|����d�wd	|krhd
ksrntdt|�����t�|�s�tdt|�����|��}t	|�IdH}|||fS)
a�
    Read an HTTP/1.1 response and return ``(status_code, reason, headers)``.

    ``reason`` and ``headers`` are expected to contain only ASCII characters.
    Other characters are represented with surrogate escapes.

    :func:`read_request` doesn't attempt to read the response body because
    WebSocket handshake responses don't have one. If the response contains a
    body, it may be read from ``stream`` after this coroutine returns.

    Args:
        stream: Input to read the response from.

    Raises:
        EOFError: If the connection is closed without a full HTTP response.
        SecurityError: If the response exceeds a security limit.
        ValueError: If the response isn't well formatted.

    Nz0connection closed while reading HTTP status linerrzinvalid HTTP status line: rrzinvalid HTTP status code: �di�zunsupported HTTP status code: zinvalid HTTP reason phrase: )
rrr r!r�int�	_value_re�	fullmatchrr")	r�status_liner$r'�raw_status_code�
raw_reason�status_code�reasonr)rrrr^s4�
����

rc	�s��t�}ttd�D]p}z	t|�IdH}Wnty&}ztd�|�d}~ww|dkr.|Sz
|�dd�\}}WntyItdt|����d�wt�	|�sXtdt|�����|�
d�}t�	|�sktd	t|�����|�d
�}|�d
d�}|||<q
t
d��)
zo
    Read HTTP headers from ``stream``.

    Non-ASCII characters are represented with surrogate escapes.

    �Nz,connection closed while reading HTTP headers��:zinvalid HTTP header line: zinvalid HTTP header name: s 	zinvalid HTTP header value: rrztoo many HTTP headers)r�range�MAX_NUM_HEADERSrrr r!r�	_token_rer.�stripr-rr)	rr)�_�liner$�raw_name�	raw_value�namerrrrr"�s4�
����




r"c�sB�|��IdH}t|�tkrtd��|�d�std��|dd�S)z[
    Read a single line from ``stream``.

    CRLF is stripped from the return value.

    Nz
line too longs
zline without CRLF���)�readline�len�MAX_LINE_LENGTHr�endswithr)rr<rrrr�s�
r)rr
rr)rrrr)rrrr*)rrrr)rrrr
)�
__future__r�asyncio�os�re�datastructuresr�
exceptionsr�__all__r,�environ�getr8rCr�compiler9r-rrr"rrrrr�<module>s 




1
4(