diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..46b4827 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,17 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "uhttp" +version = "0.1.0" +dependencies = [ + "uhttp-ext", +] + +[[package]] +name = "uhttp-ext" +version = "0.1.0" +dependencies = [ + "uhttp", +] diff --git a/src/lib.rs b/src/lib.rs index cde6dca..c31ddd9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -168,6 +168,9 @@ impl Connection { (_, StateRecv::Body(body_state)) => match body_state { BodyState::ContentLength(remaining) => { + if bytes.is_empty() && *remaining != 0 { + return fail(ErrorKind::NeedMoreData).tup(bytes); + } if bytes.len() < *remaining { Ok(( &[] as &[u8],