Ë
    Û�ðiX  ã                   óP   — d Z ddlmZ ddlmZ  G d„ d«      Z G d„ d«      ZddgZy)	zV
HTTP/2 request wrapper.

Provides a Request-compatible interface for HTTP/2 streams.
é    )ÚBytesIO)Úsplit_request_uric                   ó@   — e Zd ZdZd„ Zd
d„Zd
d„Zd
d„Zd„ Zd„ Z	d	„ Z
y)Ú	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                 óD   — t        |«      | _        t        |«      | _        y)zfInitialize with body data.

        Args:
            data: bytes containing the request body
        N)r   Ú_dataÚlenÚ_len)ÚselfÚdatas     úQ/var/www/html/Extract/venv/lib/python3.12/site-packages/gunicorn/http2/request.pyÚ__init__zHTTP2Body.__init__   s   € ô ˜T“]ˆŒ
Ü˜“Iˆ�	ó    Nc                 óp   — |€| j                   j                  «       S | j                   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‰z�‰˜tÓ$Ð$r   c                 óp   — |€| j                   j                  «       S | j                   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.   s1   € ð ˆ<Ø—:‘:×&Ñ&Ó(Ð(Ø�z‰z×"Ñ" 4Ó(Ð(r   c                 ó8   — | j                   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‰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‘JÓÐr   c                 ó   — | j                   S )zReturn the content length.)r
   r   s    r   Ú__len__zHTTP2Body.__len__J   s   € à�y‰yÐr   c                 ó8   — | j                   j                  «        y)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                   óN   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zed„ «       Z	ed„ «       Z
d„ Zy	)
Ú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| _        |j                  «       }|j                  dd«      | _        |j                  dd«      | _        |j                  dd«      }|j                  dd	«      }|| _	        	 t        |«      }|j                  xs d| _        |j                  xs d| _        |j                  xs d| _        || _        g | _        |j#                  «       D ]0  \  }}	| j                   j%                  |j'                  «       |	f«       Œ2 |rI| j                   D �
�cg c]  \  }
}|
d
k7  sŒ|
|f‘Œ c}}
| _        | j                   j%                  d
|f«       g | _        |j(                  r4|j(                  D ��	cg c]  \  }}	|j'                  «       |	f‘Œ c}	}| _        |j+                  «       }t-        |«      | _        d| _        d| _        |j4                  | _        d| _        |j:                  | _        |j<                  | _        y# t        $ r || _        d| _        d| _        Y �Œmw xY wc c}}
w c c}	}w )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ú/ÚHOSTFN)ÚstreamÚcfgÚ	peer_addrÚremote_addrÚversionÚget_pseudo_headersÚgetÚmethodÚschemeÚurir   ÚpathÚqueryÚfragmentÚ
ValueErrorÚ
_authorityÚheadersÚget_regular_headersÚappendÚupperÚtrailersÚget_request_bodyr   ÚbodyÚ
must_closeÚ_expected_100_continueÚ	stream_idÚ
req_numberÚproxy_protocol_infoÚpriority_weightÚpriority_depends_on)r   r/   r0   r1   ÚpseudoÚ	authorityr9   ÚpartsÚnameÚvalueÚnÚvÚ	body_datas                r   r   zHTTP2Request.__init__[   s%  € ð ˆŒØˆŒØ"ˆŒØ$ˆÔð ˆŒð ×*Ñ*Ó,ˆØ—j‘j ¨EÓ2ˆŒØ—j‘j ¨GÓ4ˆŒØ—J‘J˜|¨RÓ0ˆ	Ø�z‰z˜' 3Ó'ˆð ˆŒð	Ü% dÓ+ˆEØŸ
™
Ò( bˆDŒIØŸ™Ò*¨ˆDŒJØ!ŸN™NÒ0¨bˆDŒMð $ˆŒð ˆŒØ!×5Ñ5Ó7ò 	7‰KˆD�%à�L‰L×Ñ §¡£¨uÐ 5Õ6ð	7ñ Ø/3¯|©|×K¡t q¨!¸qÀF»{˜Q šFÓKˆDŒLØ�L‰L×Ñ ¨Ð 3Ô4ð ˆŒØ�?Š?ð $*§?¡?÷á�D˜%ð —‘“˜uÒ%óˆDŒMð ×+Ñ+Ó-ˆ	Ü˜iÓ(ˆŒ	ð  ˆŒØ&+ˆÔ#ð !×*Ñ*ˆŒð $(ˆÔ ð  &×5Ñ5ˆÔØ#)×#=Ñ#=ˆÕ øô[ ò 	ØˆDŒIØˆDŒJØˆD�Mð	üó$ Lùós%   ÂA
H$ Ä:I	ÅI	ÆIÈ$IÉIc                 ó   — d| _         y)z1Force the connection to close after this request.TN©rE   r   s    r   Úforce_closezHTTP2Request.force_close¨   s	   € àˆ�r   c                 ó   — | j                   ryy)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
        TFrU   r   s    r   Úshould_closezHTTP2Request.should_close¬   s   € ð �?Š?Øàr   c                 ó^   — |j                  «       }| j                  D ]  \  }}||k(  sŒ|c S  y)zªGet a header value by name.

        Args:
            name: Header name (case-insensitive)

        Returns:
            str: Header value, or None if not found
        N)rA   r>   )r   rO   Úh_nameÚh_values       r   Ú
get_headerzHTTP2Request.get_headerº   s7   € ð �z‰z‹|ˆØ#Ÿ|™|ò 	‰OˆF�GØ˜‹~Ø’ð	ð r   c                 ó`   — | j                  d«      }|�	 t        |«      S y# t        $ r Y yw xY w)zsGet the Content-Length header value.

        Returns:
            int: Content length, or None if not set
        zCONTENT-LENGTHN)r\   Úintr<   )r   Úcls     r   Úcontent_lengthzHTTP2Request.content_lengthÉ   sB   € ð �_‰_Ð-Ó.ˆØˆ>ðÜ˜2“w�ð øô ò ØØðús   •
! ¡	-¬-c                 ó$   — | j                  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                 ój   — d| j                   › d| j                  › d| j                  j                  › d�S )Nz<HTTP2Request method=z path=z stream_id=ú>)r6   r9   r/   rG   r   s    r   Ú__repr__zHTTP2Request.__repr__á   s?   € ðØ—k‘k�]ð #Ø—I‘I�;ð ØŸ™×.Ñ.Ð/¨qð2ð	
r   N)r!   r"   r#   r$   r   rV   rX   r\   Úpropertyr`   rb   re   r%   r   r   r'   r'   S   sJ   „ ñòK>òZòòð ñó ðð ñ/ó ð/ó
r   r'   N)r$   Úior   Úgunicorn.utilr   r   r'   Ú__all__r%   r   r   ú<module>rj      s6   ðñõ å +÷?ñ ?÷DT
ñ T
ðn ˜;Ð
'�r   