§
    ŸjX  ã                   ó^   — d Z ddlmZ ddlmZ  G d„ d¦  «        Z G d„ d¦  «        ZddgZdS )	zV
HTTP/2 request wrapper.

Provides a Request-compatible interface for HTTP/2 streams.
é    )ÚBytesIO)Úsplit_request_uric                   óB   — e Zd ZdZd„ Zd
d„Zd
d„Zd
d„Zd„ Zd„ Z	d	„ Z
dS )Ú	HTTP2Bodyz›Body wrapper for HTTP/2 request data.

    Provides a file-like interface to the request body,
    compatible with gunicorn's Body class expectations.
    c                 óV   — t          |¦  «        | _        t          |¦  «        | _        dS )zfInitialize with body data.

        Args:
            data: bytes containing the request body
        N)r   Ú_dataÚlenÚ_len)ÚselfÚdatas     úc/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/gunicorn/http2/request.pyÚ__init__zHTTP2Body.__init__   s"   € õ ˜T‘]”]ˆŒ
Ý˜‘I”IˆŒ	ˆ	ˆ	ó    Nc                 ól   — |€| j                              ¦   «         S | j                              |¦  «        S )z­Read data from the body.

        Args:
            size: Number of bytes to read, or None for all remaining

        Returns:
            bytes: The requested data
        )r   Úread©r   Úsizes     r   r   zHTTP2Body.read!   s/   € ð ˆ<Ø”:—?’?Ñ$Ô$Ð$ØŒz�Š˜tÑ$Ô$Ð$r   c                 ól   — |€| j                              ¦   «         S | j                              |¦  «        S )zŽRead a line from the body.

        Args:
            size: Maximum bytes to read

        Returns:
            bytes: A line of data
        )r   Úreadliner   s     r   r   zHTTP2Body.readline.   s3   € ð ˆ<Ø”:×&Ò&Ñ(Ô(Ð(ØŒz×"Ò" 4Ñ(Ô(Ð(r   c                 ó6   — | j                              |¦  «        S )z•Read all lines from the body.

        Args:
            hint: Approximate byte count hint

        Returns:
            list: List of lines
        )r   Ú	readlines)r   Úhints     r   r   zHTTP2Body.readlines;   s   € ð Œz×#Ò# DÑ)Ô)Ð)r   c                 ó*   — t          | j        ¦  «        S )zIterate over lines in the body.)Úiterr   ©r   s    r   Ú__iter__zHTTP2Body.__iter__F   s   € å�D”JÑÔÐr   c                 ó   — | j         S )zReturn the content length.)r
   r   s    r   Ú__len__zHTTP2Body.__len__J   s
   € àŒyÐr   c                 ó8   — | j                              ¦   «          dS )zClose the body stream.N)r   Úcloser   s    r   r    zHTTP2Body.closeN   s   € àŒ
×ÒÑÔÐÐÐr   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r    © r   r   r   r      s–   € € € € € ðð ðð ð ð%ð %ð %ð %ð)ð )ð )ð )ð	*ð 	*ð 	*ð 	*ð ð  ð  ðð ð ðð ð ð ð r   r   c                   ó\   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zed„ ¦   «         Z	ed„ ¦   «         Z
d„ Zd	S )
ÚHTTP2RequestzìHTTP/2 request wrapper compatible with gunicorn Request interface.

    Wraps an HTTP2Stream to provide the same interface as the HTTP/1.x
    Request class, allowing workers to handle HTTP/2 requests using
    existing code paths.
    c                 ó$  — || _         || _        || _        || _        d| _        |                     ¦   «         }|                     dd¦  «        | _        |                     dd¦  «        | _        |                     dd¦  «        }|                     dd	¦  «        }|| _	        	 t          |¦  «        }|j        pd| _        |j        pd| _        |j        pd| _        n%# t          $ r || _        d| _        d| _        Y nw xY w|| _        g | _        |                     ¦   «         D ]3\  }}	| j                             |                     ¦   «         |	f¦  «         Œ4|r2d
„ | j        D ¦   «         | _        | j                             d|f¦  «         g | _        |j        rd„ |j        D ¦   «         | _        |                     ¦   «         }
t-          |
¦  «        | _        d| _        d| _        |j        | _        d| _        |j        | _        |j        | _        dS )zåInitialize from an HTTP/2 stream.

        Args:
            stream: HTTP2Stream instance with received headers/body
            cfg: Gunicorn configuration object
            peer_addr: Client address tuple (host, port)
        )é   r   z:methodÚGETz:schemeÚhttpsz
:authorityÚ z:pathú/c                 ó(   — g | ]\  }}|d k    ¯||f‘ŒS )ÚHOSTr%   )Ú.0ÚnÚvs      r   ú
<listcomp>z)HTTP2Request.__init__.<locals>.<listcomp>‹   s%   € ÐKÐKÐK¡t q¨!¸qÀFº{¸{˜Q ˜F¸{¸{¸{r   r/   c                 ó@   — g | ]\  }}|                      ¦   «         |f‘ŒS r%   )Úupper)r0   ÚnameÚvalues      r   r3   z)HTTP2Request.__init__.<locals>.<listcomp>‘   s9   € ð ð ð á�D˜%ð —’‘”˜uÐ%ðð ð r   FN)ÚstreamÚcfgÚ	peer_addrÚremote_addrÚversionÚget_pseudo_headersÚgetÚmethodÚschemeÚurir   ÚpathÚqueryÚfragmentÚ
ValueErrorÚ
_authorityÚheadersÚget_regular_headersÚappendr5   ÚtrailersÚget_request_bodyr   ÚbodyÚ
must_closeÚ_expected_100_continueÚ	stream_idÚ
req_numberÚproxy_protocol_infoÚpriority_weightÚpriority_depends_on)r   r8   r9   r:   ÚpseudoÚ	authorityrB   Úpartsr6   r7   Ú	body_datas              r   r   zHTTP2Request.__init__[   s7  € ð ˆŒØˆŒØ"ˆŒØ$ˆÔð ˆŒð ×*Ò*Ñ,Ô,ˆØ—j’j ¨EÑ2Ô2ˆŒØ—j’j ¨GÑ4Ô4ˆŒØ—J’J˜|¨RÑ0Ô0ˆ	Ø�zŠz˜' 3Ñ'Ô'ˆð ˆŒð	Ý% dÑ+Ô+ˆEØœ
Ð( bˆDŒIØœÐ*¨ˆDŒJØ!œNÐ0¨bˆDŒMˆMøÝð 	ð 	ð 	ØˆDŒIØˆDŒJØˆDŒMˆMˆMð	øøøð $ˆŒð ˆŒØ!×5Ò5Ñ7Ô7ð 	7ð 	7‰KˆD�%àŒL×Ò §¢¡¤¨uÐ 5Ñ6Ô6Ð6Ð6ð ð 	5ØKÐK¨t¬|ÐKÑKÔKˆDŒLØŒL×Ò ¨Ð 3Ñ4Ô4Ð4ð ˆŒØŒ?ð 	ðð à#)¤?ðñ ô ˆDŒMð ×+Ò+Ñ-Ô-ˆ	Ý˜iÑ(Ô(ˆŒ	ð  ˆŒØ&+ˆÔ#ð !Ô*ˆŒð $(ˆÔ ð  &Ô5ˆÔØ#)Ô#=ˆÔ Ð Ð s   Â"9C ÃC>Ã=C>c                 ó   — d| _         dS )z1Force the connection to close after this request.TN©rM   r   s    r   Úforce_closezHTTP2Request.force_close¨   s   € àˆŒˆˆr   c                 ó   — | j         rdS dS )z÷Check if connection should close after this request.

        HTTP/2 connections are persistent by design, but we may still
        need to close if explicitly requested.

        Returns:
            bool: True if connection should close
        TFrY   r   s    r   Úshould_closezHTTP2Request.should_close¬   s   € ð Œ?ð 	Ø�4àˆur   c                 ó\   — |                      ¦   «         }| j        D ]\  }}||k    r|c S ŒdS )zªGet a header value by name.

        Args:
            name: Header name (case-insensitive)

        Returns:
            str: Header value, or None if not found
        N)r5   rG   )r   r6   Úh_nameÚh_values       r   Ú
get_headerzHTTP2Request.get_headerº   sB   € ð �zŠz‰|Œ|ˆØ#œ|ð 	ð 	‰OˆF�GØ˜Š~ˆ~Ø���ð àˆtr   c                 ót   — |                       d¦  «        }|� 	 t          |¦  «        S # t          $ r Y nw xY wdS )zsGet the Content-Length header value.

        Returns:
            int: Content length, or None if not set
        zCONTENT-LENGTHN)r`   ÚintrE   )r   Úcls     r   Úcontent_lengthzHTTP2Request.content_lengthÉ   sP   € ð �_Š_Ð-Ñ.Ô.ˆØˆ>ðÝ˜2‘w”w�øÝð ð ð Ø�ðøøøàˆts   ™( ¨
5´5c                 ó,   — |                       d¦  «        S )zoGet the Content-Type header value.

        Returns:
            str: Content type, or None if not set
        zCONTENT-TYPE)r`   r   s    r   Úcontent_typezHTTP2Request.content_typeØ   s   € ð �Š˜~Ñ.Ô.Ð.r   c                 óB   — d| j         › d| j        › d| j        j        › d�S )Nz<HTTP2Request method=z path=z stream_id=ú>)r?   rB   r8   rO   r   s    r   Ú__repr__zHTTP2Request.__repr__á   sC   € ð2Ø”kð2ð 2à”Ið2ð 2ð œÔ.ð2ð 2ð 2ð	
r   N)r!   r"   r#   r$   r   rZ   r\   r`   Úpropertyrd   rf   ri   r%   r   r   r'   r'   S   s£   € € € € € ðð ðK>ð K>ð K>ðZð ð ðð ð ðð ð ð ðð ñ „Xðð ð/ð /ñ „Xð/ð
ð 
ð 
ð 
ð 
r   r'   N)r$   Úior   Úgunicorn.utilr   r   r'   Ú__all__r%   r   r   ú<module>rn      sŸ   ððð ð Ð Ð Ð Ð Ð à +Ð +Ð +Ð +Ð +Ð +ð?ð ?ð ?ð ?ð ?ñ ?ô ?ð ?ðDT
ð T
ð T
ð T
ð T
ñ T
ô T
ð T
ðn ˜;Ð
'€€€r   