Skip to content

Commit 2f19578

Browse files
committed
test(http1): add test for when headers contain HTABs
1 parent ca5e520 commit 2f19578

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include = [
2121
bytes = "0.4.4"
2222
futures = "0.1.21"
2323
futures-cpupool = { version = "0.1.6", optional = true }
24-
http = "0.1.7"
24+
http = "0.1.13"
2525
httparse = "1.0"
2626
h2 = "0.1.10"
2727
iovec = "0.1"

src/proto/h1/role.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,19 @@ mod tests {
14051405
assert!(encoder.is_last());
14061406
}
14071407

1408+
#[test]
1409+
fn parse_header_htabs() {
1410+
let mut bytes = BytesMut::from("HTTP/1.1 200 OK\r\nserver: hello\tworld\r\n\r\n");
1411+
let parsed = Client::parse(&mut bytes, ParseContext {
1412+
cached_headers: &mut None,
1413+
req_method: &mut Some(Method::GET),
1414+
})
1415+
.expect("parse ok")
1416+
.expect("parse complete");
1417+
1418+
assert_eq!(parsed.head.headers["server"], "hello\tworld");
1419+
}
1420+
14081421
#[cfg(feature = "nightly")]
14091422
use test::Bencher;
14101423

0 commit comments

Comments
 (0)