
    h(.                     F   S SK r S SKJr  S SKJrJr  S SKJrJrJ	r	J
r
JrJr  SSKJrJr  SSKJrJr  SSKJrJrJr  / S	Qr\ R0                  " \R2                  " S
5      5      r\ R0                  " \R2                  " S
5      5      r " S S\5      r\" SSS9 " S S\5      5       r\" SSS9 " S S\5      5       r\" SSS9 " S S\5      5       r\" SSS9 " S S\5      5       r \" SSS9 " S S\5      5       r!\" SSS9 " S S\5      5       r"\" SS9 " S S\5      5       r#g)    N)ABC)	dataclassfield)AnycastDictListTupleUnion   )methodrequest_target)Headersnormalize_and_validate)bytesifyLocalProtocolErrorvalidate)EventRequestInformationalResponseResponseDataEndOfMessageConnectionClosedasciic                       \ rS rSrSrSrSrg)r       z
Base class for h11 events.
 N)__name__
__module____qualname____firstlineno____doc__	__slots____static_attributes__r       =/var/www/html/env/lib/python3.13/site-packages/h11/_events.pyr   r       s     Ir&   r   FT)initfrozenc                      ^  \ rS rSr% SrSr\\S'   \\S'   \\S'   \\S'   SS	S
.S\	\\
4   S\	\\\\\4      \\\
\
4      4   S\	\\
4   S\	\\
4   S\SS4U 4S jjjrSrSrU =r$ )r   (   a  The beginning of an HTTP request.

Fields:

.. attribute:: method

   An HTTP method, e.g. ``b"GET"`` or ``b"POST"``. Always a byte
   string. :term:`Bytes-like objects <bytes-like object>` and native
   strings containing only ascii characters will be automatically
   converted to byte strings.

.. attribute:: target

   The target of an HTTP request, e.g. ``b"/index.html"``, or one of the
   more exotic formats described in `RFC 7320, section 5.3
   <https://tools.ietf.org/html/rfc7230#section-5.3>`_. Always a byte
   string. :term:`Bytes-like objects <bytes-like object>` and native
   strings containing only ascii characters will be automatically
   converted to byte strings.

.. attribute:: headers

   Request headers, represented as a list of (name, value) pairs. See
   :ref:`the header normalization rules <headers-format>` for details.

.. attribute:: http_version

   The HTTP protocol version, represented as a byte string like
   ``b"1.1"``. See :ref:`the HTTP version normalization rules
   <http_version-format>` for details.

)r   headerstargethttp_versionr   r,   r-   r.      1.1F)r.   _parsedr0   returnNc          	      *  > [         T	U ]  5         [        U[        5      (       a  [        R                  U SU5        O[        R                  U S[        X%S95        U(       da  [        R                  U S[        U5      5        [        R                  U S[        U5      5        [        R                  U S[        U5      5        OE[        R                  U SU5        [        R                  U SU5        [        R                  U SU5        SnU R                   H  u  pxUS:X  d  M  US-  nM     U R                  S	:X  a  US:X  a  [        S
5      eUS:  a  [        S5      e[        [        U R                  S5        [        [        U R                  S5        g )Nr,   r0   r   r-   r.   r   s   hostr   r/   zMissing mandatory Host: headerzFound multiple Host: headerszIllegal method characterszIllegal target characters)super__init__
isinstancer   object__setattr__r   r   r,   r.   r   r   	method_rer   request_target_rer-   )
selfr   r,   r-   r.   r0   
host_countnamevalue	__class__s
            r'   r5   Request.__init__R   sI    	gw''tY8i!7!Q tXx/?@tXx/?@t^Xl5KLtXv6tXv6t^\B 
<<KDwa
 ( &:?$%EFF>$%CDDDKK)DE"DKK1LMr&   r   )r   r    r!   r"   r#   r$   bytes__annotations__r   r   strr	   r
   boolr5   __hash__r%   __classcell__r?   s   @r'   r   r   (   s    B @IMM +1(N eSj!(N wU5%<%8 94c3h;PPQ	(N
 eSj!(N E3J'(N (N 
(N (NV Hr&   r   c                      ^  \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   SSS	S
.S\	\\
\\\4      \
\\\4      4   S\S\	\\4   S\	\\4   S\SS4U 4S jjjrSS jrSrSrU =r$ )_ResponseBase   )r,   r.   reasonstatus_coder,   r.   rK   rL   r/   r&   F)r.   rK   r0   r0   r1   Nc          	      r  > [         TU ]  5         [        U[        5      (       a  [        R                  U SU5        O[        R                  U S[        XS95        U(       d  [        R                  U S[        U5      5        [        R                  U S[        U5      5        [        U[        5      (       d  [        S5      e[        R                  U S[        U5      5        OE[        R                  U SU5        [        R                  U SU5        [        R                  U SU5        U R                  5         g )Nr,   r3   rK   r.   zstatus code must be integerrL   )r4   r5   r6   r   r7   r8   r   r   intr   __post_init__)r;   r,   rL   r.   rK   r0   r?   s         r'   r5   _ResponseBase.__init__   s     	gw''tY8i!7!Q tXx/?@t^Xl5KLk3//()FGG t]C4DEtXv6t^\Bt]K@r&   c                     g )Nr   r;   s    r'   rO   _ResponseBase.__post_init__   s    r&   r   r1   N)r   r    r!   r"   r$   r   rB   rA   rN   r   r	   r
   rC   rD   r5   rO   rE   r%   rF   rG   s   @r'   rI   rI      s    DIM +1$' wU5%<%8 94c3h;PPQ 	
 E3J' eSj!  
 > Hr&   rI   c                   &    \ rS rSrSrSS jrSrSrg)r      a  An HTTP informational response.

Fields:

.. attribute:: status_code

   The status code of this response, as an integer. For an
   :class:`InformationalResponse`, this is always in the range [100,
   200).

.. attribute:: headers

   Request headers, represented as a list of (name, value) pairs. See
   :ref:`the header normalization rules <headers-format>` for
   details.

.. attribute:: http_version

   The HTTP protocol version, represented as a byte string like
   ``b"1.1"``. See :ref:`the HTTP version normalization rules
   <http_version-format>` for details.

.. attribute:: reason

   The reason phrase of this response, as a byte string. For example:
   ``b"OK"``, or ``b"Not Found"``.

Nc                 ~    SU R                   s=::  a  S:  d&  O  [        SR                  U R                   5      5      eg )Nd      zGInformationalResponse status_code should be in range [100, 200), not {}rL   r   formatrR   s    r'   rO   #InformationalResponse.__post_init__   s<    t''-#-$%%+VD,<,<%=  .r&   r   rT   r   r    r!   r"   r#   rO   rE   r%   r   r&   r'   r   r      s    : Hr&   r   c                   &    \ rS rSrSrSS jrSrSrg)r      a  The beginning of an HTTP response.

Fields:

.. attribute:: status_code

   The status code of this response, as an integer. For an
   :class:`Response`, this is always in the range [200,
   1000).

.. attribute:: headers

   Request headers, represented as a list of (name, value) pairs. See
   :ref:`the header normalization rules <headers-format>` for details.

.. attribute:: http_version

   The HTTP protocol version, represented as a byte string like
   ``b"1.1"``. See :ref:`the HTTP version normalization rules
   <http_version-format>` for details.

.. attribute:: reason

   The reason phrase of this response, as a byte string. For example:
   ``b"OK"``, or ``b"Not Found"``.

Nc                 ~    SU R                   s=::  a  S:  d&  O  [        SR                  U R                   5      5      eg )NrY   i  z;Response status_code should be in range [200, 1000), not {}rZ   rR   s    r'   rO   Response.__post_init__   s>    t''.$.$MTT$$  /r&   r   rT   r]   r   r&   r'   r   r      s    8 Hr&   r   c            	       `    \ rS rSr% SrSr\\S'   \\S'   \\S'    SS\S\S\SS4S	 jjr	Sr
S
rg)r   i  a  Part of an HTTP message body.

Fields:

.. attribute:: data

   A :term:`bytes-like object` containing part of a message body. Or, if
   using the ``combine=False`` argument to :meth:`Connection.send`, then
   any object that your socket writing code knows what to do with, and for
   which calling :func:`len` returns the number of bytes that will be
   written -- see :ref:`sendfile` for details.

.. attribute:: chunk_start

   A marker that indicates whether this data object is from the start of a
   chunked transfer encoding chunk. This field is ignored when when a Data
   event is provided to :meth:`Connection.send`: it is only valid on
   events emitted from :meth:`Connection.next_event`. You probably
   shouldn't use this attribute at all; see
   :ref:`chunk-delimiters-are-bad` for details.

.. attribute:: chunk_end

   A marker that indicates whether this data object is the last for a
   given chunked transfer encoding chunk. This field is ignored when when
   a Data event is provided to :meth:`Connection.send`: it is only valid
   on events emitted from :meth:`Connection.next_event`. You probably
   shouldn't use this attribute at all; see
   :ref:`chunk-delimiters-are-bad` for details.

)datachunk_start	chunk_endrc   rd   re   r1   Nc                     [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        g )Nrc   rd   re   )r7   r8   )r;   rc   rd   re   s       r'   r5   Data.__init__+  s:     	4.4<4i8r&   r   )FF)r   r    r!   r"   r#   r$   rA   rB   rD   r5   rE   r%   r   r&   r'   r   r     sR    @ 5I
KO IN99(,9AE9	9 Hr&   r   c            	          ^  \ rS rSr% SrSr\\S'   SSS.S\\\	\
\\4      \	\
\\4      S4   S\S	S4U 4S
 jjjrSrSrU =r$ )r   i;  aJ  The end of an HTTP message.

Fields:

.. attribute:: headers

   Default value: ``[]``

   Any trailing headers attached to this message, represented as a list of
   (name, value) pairs. See :ref:`the header normalization rules
   <headers-format>` for details.

   Must be empty unless ``Transfer-Encoding: chunked`` is in use.

)r,   r,   NF)r,   r0   r0   r1   c                   > [         TU ]  5         Uc  [        / 5      nO[        U[        5      (       d	  [	        XS9n[
        R                  U SU5        g )Nr3   r,   )r4   r5   r   r6   r   r7   r8   )r;   r,   r0   r?   s      r'   r5   EndOfMessage.__init__Q  sG     	?bkGGW--,WFG4G4r&   r   )r   r    r!   r"   r#   r$   r   rB   r   r	   r
   rA   rC   rD   r5   rE   r%   rF   rG   s   @r'   r   r   ;  sx      I 5 T%u-.U38_0EtK
5 5 
5 5" Hr&   r   )r)   c                       \ rS rSrSrSrg)r   ie  a)  This event indicates that the sender has closed their outgoing
connection.

Note that this does not necessarily mean that they can't *receive* further
data, because TCP connections are composed to two one-way channels which
can be closed independently. See :ref:`closing` for details.

No fields.
r   N)r   r    r!   r"   r#   r%   r   r&   r'   r   r   e  s     	r&   r   )$reabcr   dataclassesr   r   typingr   r   r   r	   r
   r   _abnfr   r   _headersr   r   _utilr   r   r   __all__compileencoder9   r:   r   r   rI   r   r   r   r   r   r   r&   r'   <module>rv      s]   
  ( 6 6 ) 5 9 9 JJv}}W-.	JJ~44W=> C  d#Te T $Tn d#+E + $+\ d#&M & $&R d#&} & $&R d#/5 / $/n d#&5 & $&R $	u 	 	r&   