Add in an eof guard for extra safety

This commit is contained in:
jefshe 2019-08-20 11:08:32 +10:00
parent 48f57b422d
commit 4ebd5232e7
1 changed files with 1 additions and 1 deletions

View File

@ -781,7 +781,7 @@ impl PayloadBuffer {
/// Read bytes until new line delimiter or eof /// Read bytes until new line delimiter or eof
pub fn readline_or_eof(&mut self) -> Result<Option<Bytes>, MultipartError> { pub fn readline_or_eof(&mut self) -> Result<Option<Bytes>, MultipartError> {
match self.readline() { match self.readline() {
Err(MultipartError::Incomplete) => Ok(Some(self.buf.take().freeze())), Err(MultipartError::Incomplete) if self.eof => Ok(Some(self.buf.take().freeze())),
line => line line => line
} }
} }