fix(http): skip zero length chunks when encoding
This commit is contained in:
@@ -269,6 +269,10 @@ where I: AsyncRead + AsyncWrite,
|
||||
return Ok(AsyncSink::NotReady(chunk));
|
||||
}
|
||||
if let Some(chunk) = chunk {
|
||||
if chunk.as_ref().is_empty() {
|
||||
return Ok(AsyncSink::Ready);
|
||||
}
|
||||
|
||||
let mut cursor = Cursor::new(chunk);
|
||||
match encoder.encode(&mut self.io, cursor.buf()) {
|
||||
Ok(n) => {
|
||||
|
||||
@@ -63,7 +63,7 @@ impl Encoder {
|
||||
};
|
||||
|
||||
if n == 0 {
|
||||
return Err(io::Error::new(io::ErrorKind::WouldBlock, "would block"));
|
||||
return Err(io::Error::new(io::ErrorKind::WriteZero, "write zero"));
|
||||
}
|
||||
|
||||
*remaining -= n as u64;
|
||||
|
||||
Reference in New Issue
Block a user