test(http1): add test for when headers contain HTABs

This commit is contained in:
Sean McArthur
2018-09-14 11:21:50 -07:00
parent ca5e520e7a
commit 2f19578162
2 changed files with 14 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ include = [
bytes = "0.4.4" bytes = "0.4.4"
futures = "0.1.21" futures = "0.1.21"
futures-cpupool = { version = "0.1.6", optional = true } futures-cpupool = { version = "0.1.6", optional = true }
http = "0.1.7" http = "0.1.13"
httparse = "1.0" httparse = "1.0"
h2 = "0.1.10" h2 = "0.1.10"
iovec = "0.1" iovec = "0.1"

View File

@@ -1405,6 +1405,19 @@ mod tests {
assert!(encoder.is_last()); assert!(encoder.is_last());
} }
#[test]
fn parse_header_htabs() {
let mut bytes = BytesMut::from("HTTP/1.1 200 OK\r\nserver: hello\tworld\r\n\r\n");
let parsed = Client::parse(&mut bytes, ParseContext {
cached_headers: &mut None,
req_method: &mut Some(Method::GET),
})
.expect("parse ok")
.expect("parse complete");
assert_eq!(parsed.head.headers["server"], "hello\tworld");
}
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use test::Bencher; use test::Bencher;