ó
    t0c(.  ã                   ó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   ó    Ú-/usr/lib/python3/dist-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  ø€ ô 	‰ÑÔÜ�gœw×'Ñ'Ü×Ñ˜t Y°Õ8ä×ÑØ�iÔ!7¸Ñ!Qôö Ü×Ñ˜t X¬x¸Ó/?Ô@Ü×Ñ˜t X¬x¸Ó/?Ô@Ü×Ñ˜t ^´X¸lÓ5KÕLä×Ñ˜t X¨vÔ6Ü×Ñ˜t X¨vÔ6Ü×Ñ˜t ^°\ÔBð ˆ
ØŸ<œ<‰KˆDØ�w�Ø˜a‘’
ñ (ð ×Ñ Ó&¨:¸«?Ü$Ð%EÓFÐFØ˜‹>Ü$Ð%CÓDÐDä”˜DŸK™KÐ)DÔEÜÔ" D§K¡KÐ1LÕ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ð �e˜S�jÑ!ð(Nð �w  U¨5°%¨<Ñ%8Ñ 9¸4ÀÀcÈ3ÀhÁÑ;PÐPÑQð	(Nð
 �e˜S�jÑ!ð(Nð ˜E 3˜JÑ'ð(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ñ   ø€ ô 	‰ÑÔÜ�gœw×'Ñ'Ü×Ñ˜t Y°Õ8ä×ÑØ�iÔ!7¸Ñ!Qôö Ü×Ñ˜t X¬x¸Ó/?Ô@Ü×Ñ˜t ^´X¸lÓ5KÔLÜ˜k¬3×/Ñ/Ü(Ð)FÓGÐGô ×Ñ˜t ]´C¸Ó4DÕEä×Ñ˜t X¨vÔ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µ   ø‡ àD€IàÓØÓØƒMØÓð +1Ø$'Øòð �w  U¨5°%¨<Ñ%8Ñ 9¸4ÀÀcÈ3ÀhÁÑ;PÐPÑQðð ð	ð
 ˜E 3˜JÑ'ðð �e˜S�jÑ!ðð ðð 
÷ð ô>ð †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 )Néd   éÈ   zGInformationalResponse status_code should be in range [100, 200), not {}©rL   r   ÚformatrR   s    r'   rO   Ú#InformationalResponse.__post_init__Î   s<   € Ø�t×'Ñ'Õ-¨#Õ-Ü$ð%ß%+¡V¨D×,<Ñ,<Ó%=óð ð .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   ‡ ñð@ 5€Ià
ƒKØÓØƒOð INñ9Øð9Ø(,ð9ØAEð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   ø€ ô 	‰ÑÔØ‰?Ü˜b“k‰GÜ˜G¤W×-Ñ-Ü,¨WÑFˆGä×Ñ˜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 Ñ-Ñ.°°U¸3À¸8±_Ñ0EÀtÐ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ò€ð �JŠJ�v—}’} WÓ-Ó.€	Ø—J’J˜~×4Ò4°WÓ=Ó>Ð ôˆCô ñ �˜dÑ#ôTˆeó Tó $ðTñn �˜dÑ#ô+�Eó +ó $ð+ñ\ �˜dÑ#ô&˜Mó &ó $ð&ñR �˜dÑ#ô&ˆ}ó &ó $ð&ñR �˜dÑ#ô/ˆ5ó /ó $ð/ñn �˜dÑ#ô&�5ó &ó $ð&ñR �$Ñô	�uó 	ó ñ	r&   