add debug log back

This commit is contained in:
Rob Ede 2021-08-11 22:09:30 +01:00
parent 437c7d993b
commit f0a3c224fb
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
1 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,6 @@
use std::{io, task::Poll}; use std::{io, task::Poll};
use bytes::{Buf as _, Bytes, BytesMut}; use bytes::{Buf as _, Bytes, BytesMut};
use log::trace;
macro_rules! byte ( macro_rules! byte (
($rdr:ident) => ({ ($rdr:ident) => ({
@ -79,15 +78,17 @@ impl ChunkedState {
Poll::Ready(Ok(ChunkedState::Size)) Poll::Ready(Ok(ChunkedState::Size))
} }
None => Poll::Ready(Err(io::Error::new( None => {
log::debug!("chunk size would overflow u64");
Poll::Ready(Err(io::Error::new(
io::ErrorKind::InvalidInput, io::ErrorKind::InvalidInput,
"Invalid chunk size line: Size is too big", "Invalid chunk size line: Size is too big",
))), )))
}
} }
} }
fn read_size_lws(rdr: &mut BytesMut) -> Poll<Result<ChunkedState, io::Error>> { fn read_size_lws(rdr: &mut BytesMut) -> Poll<Result<ChunkedState, io::Error>> {
trace!("read_size_lws");
match byte!(rdr) { match byte!(rdr) {
// LWS can follow the chunk size, but no more digits can come // LWS can follow the chunk size, but no more digits can come
b'\t' | b' ' => Poll::Ready(Ok(ChunkedState::SizeLws)), b'\t' | b' ' => Poll::Ready(Ok(ChunkedState::SizeLws)),
@ -129,7 +130,7 @@ impl ChunkedState {
rem: &mut u64, rem: &mut u64,
buf: &mut Option<Bytes>, buf: &mut Option<Bytes>,
) -> Poll<Result<ChunkedState, io::Error>> { ) -> Poll<Result<ChunkedState, io::Error>> {
trace!("Chunked read, remaining={:?}", rem); log::trace!("Chunked read, remaining={:?}", rem);
let len = rdr.len() as u64; let len = rdr.len() as u64;
if len == 0 { if len == 0 {