o
    i                     @   s>  d Z G dd dZG dd deZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd  d eZG d!d" d"eZG d#d$ d$eZG d%d& d&eZg d'Zd(S ))z^
HTTP/2 specific exceptions.

These exceptions map to HTTP/2 error codes defined in RFC 7540.
c                   @   sH   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdS )HTTP2ErrorCodez(HTTP/2 Error Codes (RFC 7540 Section 7).                            	   
            N)__name__
__module____qualname____doc__NO_ERRORPROTOCOL_ERRORINTERNAL_ERRORFLOW_CONTROL_ERRORSETTINGS_TIMEOUTSTREAM_CLOSEDFRAME_SIZE_ERRORREFUSED_STREAMCANCELCOMPRESSION_ERRORCONNECT_ERRORENHANCE_YOUR_CALMINADEQUATE_SECURITYHTTP_1_1_REQUIRED r"   r"   I/home/ubuntu/.local/lib/python3.10/site-packages/gunicorn/http2/errors.pyr      s     r   c                       s&   e Zd ZdZdZd fdd	Z  ZS )
HTTP2Errorz!Base exception for HTTP/2 errors.r   Nc                    s.   |p| j j| _|d ur|| _t | j d S N)	__class__r   message
error_codesuper__init__)selfr'   r(   r&   r"   r#   r*   %   s   zHTTP2Error.__init__NN)r   r   r   r   r(   r*   __classcell__r"   r"   r,   r#   r$       s    r$   c                   @      e Zd ZdZdZdS )HTTP2ProtocolErrorzProtocol error detected.r   Nr   r   r   r   r(   r"   r"   r"   r#   r0   ,       r0   c                   @   r/   )HTTP2InternalErrorzInternal error occurred.r   Nr1   r"   r"   r"   r#   r3   2   r2   r3   c                   @   r/   )HTTP2FlowControlErrorzFlow control limits exceeded.r   Nr1   r"   r"   r"   r#   r4   8   r2   r4   c                   @   r/   )HTTP2SettingsTimeoutz Settings acknowledgment timeout.r   Nr1   r"   r"   r"   r#   r5   >   r2   r5   c                   @   r/   )HTTP2StreamClosedzStream was closed.r   Nr1   r"   r"   r"   r#   r6   D   r2   r6   c                   @   r/   )HTTP2FrameSizeErrorzFrame size is incorrect.r   Nr1   r"   r"   r"   r#   r7   J   r2   r7   c                   @   r/   )HTTP2RefusedStreamzStream was refused.r	   Nr1   r"   r"   r"   r#   r8   P   r2   r8   c                   @   r/   )HTTP2CancelzStream was cancelled.r
   Nr1   r"   r"   r"   r#   r9   V   r2   r9   c                   @   r/   )HTTP2CompressionErrorzCompression state error.r   Nr1   r"   r"   r"   r#   r:   \   r2   r:   c                   @   r/   )HTTP2ConnectErrorz Connection error during CONNECT.r   Nr1   r"   r"   r"   r#   r;   b   r2   r;   c                   @   r/   )HTTP2EnhanceYourCalmz"Peer is generating excessive load.r   Nr1   r"   r"   r"   r#   r<   h   r2   r<   c                   @   r/   )HTTP2InadequateSecurityz!Transport security is inadequate.r   Nr1   r"   r"   r"   r#   r=   n   r2   r=   c                   @   r/   )HTTP2RequiresHTTP11z&HTTP/1.1 is required for this request.r   Nr1   r"   r"   r"   r#   r>   t   r2   r>   c                       s*   e Zd ZdZd fdd	Zdd Z  ZS )HTTP2StreamErrorz"Error specific to a single stream.Nc                    s   || _ t || d S r%   )	stream_idr)   r*   )r+   r@   r'   r(   r,   r"   r#   r*   }   s   zHTTP2StreamError.__init__c                 C   s   d| j  d| j S )NzStream z: )r@   r'   )r+   r"   r"   r#   __str__   s   zHTTP2StreamError.__str__r-   )r   r   r   r   r*   rA   r.   r"   r"   r,   r#   r?   z   s    r?   c                   @      e Zd ZdZdS )HTTP2ConnectionErrorz&Error affecting the entire connection.Nr   r   r   r   r"   r"   r"   r#   rC          rC   c                   @   rB   )HTTP2ConfigurationErrorzInvalid HTTP/2 configuration.NrD   r"   r"   r"   r#   rF      rE   rF   c                       s"   e Zd ZdZd fdd	Z  ZS )HTTP2NotAvailablez;HTTP/2 support is not available (h2 library not installed).Nc                    s   |pd}t  | d S )Nz;HTTP/2 requires the h2 library: pip install gunicorn[http2])r)   r*   )r+   r'   r,   r"   r#   r*      s   zHTTP2NotAvailable.__init__r%   )r   r   r   r   r*   r.   r"   r"   r,   r#   rG      s    rG   )r   r$   r0   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   rC   rF   rG   N)r   r   	Exceptionr$   r0   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   rC   rF   rG   __all__r"   r"   r"   r#   <module>   s*   