Skip to content

Commit

Permalink
Fix "Unexpected EOB" when reading crlf (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui authored Mar 25, 2022
1 parent c7b20a1 commit 6f0f0f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/warc_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ impl<R: BufRead> StreamingIter<'_, R> {

let mut crlfs = [0; 4];

match self.reader.read(&mut crlfs) {
Ok(4) => {}
Ok(_) => return Err(Error::UnexpectedEOB),
match self.reader.read_exact(&mut crlfs) {
Ok(()) => (),
Err(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => {
return Err(Error::UnexpectedEOB)
}
Err(io) => return Err(Error::ReadData(io)),
}

Expand Down

0 comments on commit 6f0f0f9

Please sign in to comment.