<s> from gunicorn . http . message import Request <EOL> from gunicorn . http . unreader import SocketUnreader , IterUnreader <EOL> class Parser ( object ) : <EOL> mesg_class = None <EOL> def __init__ ( self , cfg , source ) : <EOL> self . cfg = cfg <EOL> if hasattr ( source , "<STR_LIT>" ) : <EOL> self . unreader = SocketUnreader ( source ) <EOL> else : <EOL> self . unreader = IterUnreader ( source ) <EOL> self . mesg = None <EOL> self . req_count = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def __next__ ( self ) : <EOL> if self . mesg and self . mesg . should_close ( ) : <EOL> raise StopIteration ( ) <EOL> if self . mesg : <EOL> data = self . mesg . body . read ( <NUM_LIT> ) <EOL> while data : <EOL> data = self . mesg . body . read ( <NUM_LIT> ) <EOL> self . req_count += <NUM_LIT:1> <EOL> self . mesg = self . mesg_class ( self . cfg , self . unreader , self . req_count ) <EOL> if not self . mesg : <EOL> raise StopIteration ( ) <EOL> return self . mesg <EOL> next = __next__ <EOL> class RequestParser ( Parser ) : <EOL> mesg_class = Request </s>
