From 5fccdea90d89c0bb4d6f2ea12e29b2ce0ef253c7 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 29 Dec 2014 12:15:08 +0100 Subject: [PATCH] Fixes #211 and adds one test for it. --- src/header/mod.rs | 7 +++++++ src/http.rs | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/header/mod.rs b/src/header/mod.rs index 3c6ca29b..1c5c2216 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -594,6 +594,13 @@ mod tests { assert!(headers.get::().is_none()); } + #[test] + fn test_trailing_whitespace() { + let headers = Headers::from_raw(&mut mem("Content-Length: 10 \r\n\r\n")).unwrap(); + let ContentLength(_) = *headers.get::().unwrap(); + assert!(headers.get::().is_none()); + } + #[test] fn test_multiple_reads() { let headers = Headers::from_raw(&mut mem("Content-Length: 10\r\n\r\n")).unwrap(); diff --git a/src/http.rs b/src/http.rs index d2809ce5..aa869069 100644 --- a/src/http.rs +++ b/src/http.rs @@ -544,6 +544,9 @@ pub fn read_header(stream: &mut R) -> HttpResult