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/starlette/__pycache__/endpoints.cpython-310.pyc
o

�h��@s�ddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZmZmZmZdd
lmZGdd�d�ZGd
d�d�ZdS)�)�annotationsN)�status)�is_async_callable)�run_in_threadpool)�
HTTPException)�Request)�PlainTextResponse�Response)�Message�Receive�Scope�Send)�	WebSocketc@s4eZdZdd	d
�Zddd
�Zddd�Zddd�ZdS)�HTTPEndpoint�scoper�receiver�sendr
�return�Nonecs:|ddksJ�|�_|�_|�_�fdd�dD��_dS)N�type�httpcs$g|]}t�|��d�dur|�qS�N)�getattr�lower)�.0�method��self��F/usr/local/CyberCP/lib/python3.10/site-packages/starlette/endpoints.py�
<listcomp>s
�z)HTTPEndpoint.__init__.<locals>.<listcomp>)�GET�HEAD�POST�PUT�PATCH�DELETE�OPTIONS)rrr�_allowed_methods�rrrrrrr�__init__s
�zHTTPEndpoint.__init__�(typing.Generator[typing.Any, None, None]cC�|����Sr��dispatch�	__await__rrrrr/�zHTTPEndpoint.__await__c�s��t|j|jd�}|jdkrt|d�sdn|j��}t|||j�}t|�}|r/||�IdH}nt	||�IdH}||j|j|j
�IdHdS)N)rr"�head�get)rrrr�hasattrrr�method_not_allowedrrr)r�request�handler_name�handler�is_async�responserrrr.s�"zHTTPEndpoint.dispatchr5rr	c�s6�dd�|j�i}d|jvrtd|d��tdd|d�S)N�Allowz, �appi�)�status_code�headerszMethod Not Allowed)�joinr(rrr)rr5r=rrrr4+s
�
zHTTPEndpoint.method_not_allowedN�rrrrrr
rr�rr+�rr)r5rrr	)�__name__�
__module__�__qualname__r*r/r.r4rrrrrs



rc@s`eZdZUdZded<d#dd
�Zd$dd�Zd%dd�Zd&dd�Zd'dd�Z	d(dd�Z
d)d!d"�ZdS)*�WebSocketEndpointNz
str | None�encodingrrrrrr
rrcCs&|ddksJ�||_||_||_dS)Nr�	websocket)rrrr)rrrr*8s
zWebSocketEndpoint.__init__r+cCr,rr-rrrrr/>r0zWebSocketEndpoint.__await__c
�s��t|j|j|jd�}|�|�IdHtj}zSz5	|��IdH}|ddkr9|�||�IdH}|�||�IdHn|ddkrJt	|�
d�pGtj�}nqWnty]}ztj}|�d}~wwW|�
||�IdHdS|�
||�IdHw)N)rrTrzwebsocket.receivezwebsocket.disconnect�code)rrrr�
on_connectr�WS_1000_NORMAL_CLOSURE�decode�
on_receive�intr2�	Exception�WS_1011_INTERNAL_ERROR�
on_disconnect)rrG�
close_code�message�data�excrrrr.As,�����*zWebSocketEndpoint.dispatchrGrrRr
�
typing.Anyc�s�|jdkrd|vr|jtjd�IdHtd��|dS|jdkr7d|vr3|jtjd�IdHtd��|dS|jdkrm|�d�durH|d}n|d�d�}zt�|�WStj	j
yl|jtjd�IdHtd��w|jduszJd	|j����|�d�r�|dS|dS)
N�text)rHz/Expected text websocket messages, but got bytes�bytesz/Expected bytes websocket messages, but got text�jsonzutf-8zMalformed JSON data received.z!Unsupported 'encoding' attribute )rF�closer�WS_1003_UNSUPPORTED_DATA�RuntimeErrorr2rKrX�loads�decoder�JSONDecodeError)rrGrRrVrrrrKVs.�



�zWebSocketEndpoint.decodec�s�|��IdHdS)z3Override to handle an incoming websocket connectionN)�accept)rrGrrrrIrs�zWebSocketEndpoint.on_connectrSc���dS)z0Override to handle an incoming websocket messageNr)rrGrSrrrrLv�zWebSocketEndpoint.on_receiverQrMc�r`)z,Override to handle a disconnecting websocketNr)rrGrQrrrrPyrazWebSocketEndpoint.on_disconnectr?r@rA)rGrrRr
rrU)rGrrr)rGrrSrUrr)rGrrQrMrr)rBrCrDrF�__annotations__r*r/r.rKrIrLrPrrrrrE5s






rE)�
__future__rrX�typing�	starletter�starlette._utilsr�starlette.concurrencyr�starlette.exceptionsr�starlette.requestsr�starlette.responsesrr	�starlette.typesr
rrr
�starlette.websocketsrrrErrrr�<module>s%