o
    KK&h                     @   sh   d dl Z ddlmZ ddlmZmZmZ ddlm	Z	 G dd deZ
G dd	 d	eZG d
d deZdS )    N   )datastructures)InvalidHandshakeInvalidMessageProtocolError)
StatusLikec                   @   s6   e Zd ZdZdedejddfddZdefdd	Z	dS )
InvalidStatusCodezC
    Raised when a handshake response status code is invalid.

    status_codeheadersreturnNc                 C   s   || _ || _d S N)r	   r
   )selfr	   r
    r   O/var/www/html/venv/lib/python3.10/site-packages/websockets/legacy/exceptions.py__init__   s   
zInvalidStatusCode.__init__c                 C      d| j  S )Nz+server rejected WebSocket connection: HTTP )r	   r   r   r   r   __str__      zInvalidStatusCode.__str__)
__name__
__module____qualname____doc__intr   Headersr   strr   r   r   r   r   r      s    r   c                	   @   s>   e Zd ZdZ	ddedejdeddfdd	Zde	fd
dZ
dS )AbortHandshakea  
    Raised to abort the handshake on purpose and return an HTTP response.

    This exception is an implementation detail.

    The public API is
    :meth:`~websockets.legacy.server.WebSocketServerProtocol.process_request`.

    Attributes:
        status (~http.HTTPStatus): HTTP status code.
        headers (Headers): HTTP response headers.
        body (bytes): HTTP response body.
        statusr
   bodyr   Nc                 C   s"   t || _t|| _|| _d S r   )http
HTTPStatusr   r   r   r
   r   )r   r   r
   r   r   r   r   r   *   s   
zAbortHandshake.__init__c                 C   s(   d| j ddt| j dt| j dS )NzHTTP dz, z
 headers, z bytes)r   lenr
   r   r   r   r   r   r   5   s   &zAbortHandshake.__str__)r   )r   r   r   r   r   r   HeadersLikebytesr   r   r   r   r   r   r   r      s    
r   c                   @   s0   e Zd ZdZdeddfddZdefddZdS )	RedirectHandshakezd
    Raised when a handshake gets redirected.

    This exception is an implementation detail.

    urir   Nc                 C   s
   || _ d S r   r'   )r   r'   r   r   r   r   C   s   
zRedirectHandshake.__init__c                 C   r   )Nzredirect to r(   r   r   r   r   r   F   r   zRedirectHandshake.__str__)r   r   r   r   r   r   r   r   r   r   r   r&   ;   s    r&   )r     r   
exceptionsr   r   r   WebSocketProtocolErrortypingr   r   r   r&   r   r   r   r   <module>   s     