
     iX                     P    S r SSKJr  SSKJr   " S S5      r " S S5      rSS/rg)	zV
HTTP/2 request wrapper.

Provides a Request-compatible interface for HTTP/2 streams.
    )BytesIO)split_request_uric                   N    \ rS rSrSrS rSS jrSS jrSS jrS r	S	 r
S
 rSrg)	HTTP2Body   zBody wrapper for HTTP/2 request data.

Provides a file-like interface to the request body,
compatible with gunicorn's Body class expectations.
c                 D    [        U5      U l        [        U5      U l        g)zNInitialize with body data.

Args:
    data: bytes containing the request body
N)r   _datalen_len)selfdatas     H/var/www/ias/venv/lib/python3.13/site-packages/gunicorn/http2/request.py__init__HTTP2Body.__init__   s     T]
I	    Nc                 r    Uc  U R                   R                  5       $ U R                   R                  U5      $ )zRead 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   HTTP2Body.read!   s-     <::??$$zzt$$r   c                 r    Uc  U R                   R                  5       $ U R                   R                  U5      $ )zfRead a line from the body.

Args:
    size: Maximum bytes to read

Returns:
    bytes: A line of data
)r	   readliner   s     r   r   HTTP2Body.readline.   s1     <::&&((zz""4((r   c                 8    U R                   R                  U5      $ )zmRead all lines from the body.

Args:
    hint: Approximate byte count hint

Returns:
    list: List of lines
)r	   	readlines)r   hints     r   r   HTTP2Body.readlines;   s     zz##D))r   c                 ,    [        U R                  5      $ )zIterate over lines in the body.)iterr	   r   s    r   __iter__HTTP2Body.__iter__F   s    DJJr   c                     U R                   $ )zReturn the content length.)r   r    s    r   __len__HTTP2Body.__len__J   s    yyr   c                 8    U R                   R                  5         g)zClose the body stream.N)r	   closer    s    r   r'   HTTP2Body.closeN   s    

r   )r	   r   )N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r!   r$   r'   __static_attributes__ r   r   r   r      s*    %)	* r   r   c                   V    \ rS rSrSrS rS rS rS r\	S 5       r
\	S 5       rS	 rS
rg)HTTP2RequestS   zHTTP/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                    Xl         X l        X0l        X0l        SU l        UR                  5       nUR                  SS5      U l        UR                  SS5      U l        UR                  SS5      nUR                  SS	5      nX`l	         [        U5      nUR                  =(       d    SU l        UR                  =(       d    SU l        UR                  =(       d    SU l        XPl        / U l        UR#                  5        H0  u  pU R                   R%                  UR'                  5       U	45        M2     U(       aL  U R                    V
Vs/ s H  u  pU
S
:w  d  M  X4PM     snn
U l        U R                   R%                  S
U45        / U l        UR(                  (       a6  UR(                   VV	s/ s H  u  pUR'                  5       U	4PM     sn	nU l        UR+                  5       n[-        U5      U l        SU l        SU l        UR4                  U l        SU l        UR:                  U l        UR<                  U l        g! [         a    X`l        SU l        SU l         GN|f = fs  snn
f s  sn	nf )zInitialize 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:   r;   r<   pseudo	authorityrD   partsnamevaluenv	body_datas                r   r   HTTP2Request.__init__[   s    "$  **,jjE2jjG4JJ|R0	zz'3' 	%d+E

(bDI*DJ!NN0bDM $ !557KDLLu 56 8 /3||K|tqqF{FQF|KDLLL 34 ?? $*??#2KD u%#2DM ++-	i(	  &+# !** $(   &55#)#=#= [  	IDJDM	$ Ls%   	AH= 	I"I"-I(=IIc                     SU l         g)z1Force the connection to close after this request.TNrP   r    s    r   force_closeHTTP2Request.force_close   s	    r   c                 (    U R                   (       a  gg)zCheck 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
TFra   r    s    r   should_closeHTTP2Request.should_close   s     ??r   c                 `    UR                  5       nU R                   H  u  p#X!:X  d  M  Us  $    g)zGet a header value by name.

Args:
    name: Header name (case-insensitive)

Returns:
    str: Header value, or None if not found
N)rL   rI   )r   rZ   h_nameh_values       r   
get_headerHTTP2Request.get_header   s.     zz|#||OF~  , r   c                 d    U R                  S5      nUb   [        U5      $ g! [         a     gf = f)z[Get the Content-Length header value.

Returns:
    int: Content length, or None if not set
zCONTENT-LENGTHN)rj   intrG   )r   cls     r   content_lengthHTTP2Request.content_length   sB     __-.>2w   s   
" 
//c                 $    U R                  S5      $ )zWGet the Content-Type header value.

Returns:
    str: Content type, or None if not set
zCONTENT-TYPE)rj   r    s    r   content_typeHTTP2Request.content_type   s     ~..r   c                 j    SU R                    SU R                   SU R                  R                   S3$ )Nz<HTTP2Request method=z path=z stream_id=>)rA   rD   r:   rR   r    s    r   __repr__HTTP2Request.__repr__   s?    kk] #II; ../q2	
r   )rH   rQ   rO   r;   rF   rI   rA   rP   rD   r<   rV   rU   rT   rE   r=   rS   rB   r:   rM   rC   r>   N)r)   r*   r+   r,   r-   r   rb   re   rj   propertyro   rr   rv   r.   r/   r   r   r1   r1   S   sJ    K>Z   / /
r   r1   N)r-   ior   gunicorn.utilr   r   r1   __all__r/   r   r   <module>r|      s6     +? ?DT
 T
n ;
'r   