
    (j                     f    S SK r S SKrS SKrS SKJr  S SKJrJr  Sr " S S5      r	 " S S\	5      r
g)	    N)Request)SocketUnreaderIterUnreaderi   c                   8    \ rS rSrSrS rS rSS jrS r\r	Sr
g)	Parser   Nc                     Xl         [        US5      (       a  [        U5      U l        O[	        U5      U l        S U l        X0l        SU l        g )Nrecvr   )cfghasattrr   unreaderr   mesgsource_addr	req_count)selfr   sourcer   s       L/var/www/html/KUNJ/venv/lib/python3.13/site-packages/gunicorn/http/parser.py__init__Parser.__init__   sB    66""*62DM(0DM	&     c                     U $ )N r   s    r   __iter__Parser.__iter__#   s    r   c                 (   U R                   (       d  gUc	  Ub  [        n[        U R                  SS5      nUb5  [	        US5      (       a$  [	        US5      (       a  UnUR                  5       nOSnSnSn  UbJ  UbG  U[        R                  " 5       -
  nUS::  a   Ub   UR                  U5        ggUR                  U5         U R                   R                  R                  S5      nU(       d   Ub   UR                  U5        ggU[#        U5      -  nUb  Xb:  a   Ub   UR                  U5        ggM  ! [         a     gf = f! [        R                  [        4 a)     Ub#   UR                  U5        g! [         a     gf = fg[        R                    a)     Ub#   UR                  U5        g! [         a     gf = fgf = f! [         a     gf = f! [         a     gf = f! Ub#   UR                  U5        f ! [         a     f f = ff = f)	a  Discard any unread body of the current message.

Called before returning a keepalive connection to the poller so the
socket does not appear readable due to leftover body bytes.

``deadline`` is an absolute ``time.monotonic()`` value; when set the
socket read timeout is bounded by the remaining time before each read.
``max_bytes`` caps the total drained bytes; when a deadline is given
and ``max_bytes`` is left at the default, ``_DRAIN_MAX_BYTES`` applies
to defend against a slow client that keeps trickling under it.  When
called without a deadline (the default invocation from ``__next__``),
no byte cap is applied so the prior unbounded drain semantics are
preserved for callers that don't know how to react to a partial drain.

Returns ``True`` when the body was fully drained, ``False`` when the
drain was abandoned (deadline, byte cap, or socket timeout).  Callers
that observe ``False`` MUST close the connection rather than serve
another request on it.
TNsock
gettimeout
settimeoutr   Fi   )r   _DRAIN_MAX_BYTESgetattrr   r   r   time	monotonicr   OSErrorbodyreadsockettimeoutTimeoutErrorsslSSLWantReadErrorlen)	r   deadline	max_bytesr   timeoutable_sockprior_timeoutdrained	remainingdatas	            r   finish_bodyParser.finish_body&   sT   ( yy!5(It}}fd3 l ; ;l@[@[# OO-M# M	',<,H (4>>+; ;I A~$  +$//> , %//	: 99>>..t4D 
  +$//> ,	 3t9$(W-A +$//> ,' ,   5 !   +$//>  , ++    +$//>  ,   w   +$//>  ,s   5%G) D8 2G) %E )G) 5G	 G) #G 6G) 8
EEG"G) 'E9 9
FF
GG) "F4 4
G GGG) 	
GG
G&%G&)H.H ?H 
H
HHHc                    U R                   (       a)  U R                   R                  5       (       a
  [        5       eU R                  5         U =R                  S-  sl        U R                  U R                  U R                  U R                  U R                  5      U l         U R                   (       d
  [        5       eU R                   $ )N   )	r   should_closeStopIterationr4   r   
mesg_classr   r   r   r   s    r   __next__Parser.__next__e   s    99//11/! 	 	!OODHHdmmT=M=Mt~~^	yy/!yyr   )r   r   r   r   r   )NN)__name__
__module____qualname____firstlineno__r:   r   r   r4   r;   next__static_attributes__r   r   r   r   r      s#    J
=~ Dr   r   c                       \ rS rSr\rSrg)RequestParserw   r   N)r=   r>   r?   r@   r   r:   rB   r   r   r   rD   rD   w   s    Jr   rD   )r'   r*   r"   gunicorn.http.messager   gunicorn.http.unreaderr   r   r    r   rD   r   r   r   <module>rH      s7   
  
  ) ?  a aHF r   