Skip to content

Commit

Permalink
test(http1): add test for when headers contain HTABs
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Sep 15, 2018
1 parent ca5e520 commit 2f19578
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include = [
bytes = "0.4.4"
futures = "0.1.21"
futures-cpupool = { version = "0.1.6", optional = true }
http = "0.1.7"
http = "0.1.13"
httparse = "1.0"
h2 = "0.1.10"
iovec = "0.1"
Expand Down
13 changes: 13 additions & 0 deletions src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,19 @@ mod tests {
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")]
use test::Bencher;

Expand Down

0 comments on commit 2f19578

Please sign in to comment.