/// Process a given chunk of data. This method returns true to keep
/// processing, false otherwise.
Process a given chunk of data. This method returns true to keep
processing, false otherwise.
Process a given chunk of data . This method returns true to keep processing false otherwise .
fn add(&mut self, chunk: &[u8]) -> ParsingResult<bool> {
        let mut pos = 0;
        while pos < chunk.len() {
            if self.header_parser.is_complete() {
                if self.response_handler.body(&chunk[pos..]) {
                    pos = chunk.len();
                } else {
                    return Ok(false);
                }
            } else {
                pos += try!(self.line_reader.add(&chunk[pos..]));
                if self.line_reader.is_complete() {
                    if try!(self.process_header_line()) {
                        self.line_reader.clear();
                    } else {
                        return Ok(false);
                    }
                }
            }
        }
        Ok(true)
    }
fn add ( & mut self , chunk : & [ u8 ] ) -> ParsingResult < bool > { let mut pos = 0 ; while pos < chunk . len ( ) { if self . header_parser . is_complete ( ) { if self . response_handler . body ( & chunk [ pos .. ] ) { pos = chunk . len ( ) ; } else { return Ok ( false ) ; } } else { pos += try ! ( self line_reader add ( chunk [ pos ] ) ) ; if self . line_reader . is_complete ( ) { if try ! ( self process_header_line ( ) ) { self . line_reader . clear ( ) ; } else { return Ok ( false ) ; } } } } Ok ( true ) }
Process a given chunk of data.
Process a given chunk of data .
&mut self
chunk
&[u8]