Skip to content

Commit 7c0d445

Browse files
bearcageseanmonstar
authored andcommitted
Add regression tests covering this bug
1 parent 896f1c1 commit 7c0d445

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/lib.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,34 @@ mod tests {
15471547
}
15481548
}
15491549

1550+
// A single byte which is part of a method is not invalid
1551+
req! {
1552+
test_request_one_byte_method,
1553+
b"G", Ok(Status::Partial),
1554+
|_req| {}
1555+
}
1556+
1557+
// A subset of a method is a partial method, not invalid
1558+
req! {
1559+
test_request_partial_method,
1560+
b"GE", Ok(Status::Partial),
1561+
|_req| {}
1562+
}
1563+
1564+
// A method, without the delimiting space, is a partial request
1565+
req! {
1566+
test_request_method_no_delimiter,
1567+
b"GET", Ok(Status::Partial),
1568+
|_req| {}
1569+
}
1570+
1571+
// Regression test: assert that a partial read with just the method and
1572+
// space results in a partial, rather than a token error from uri parsing.
1573+
req! {
1574+
test_request_method_only,
1575+
b"GET ", Ok(Status::Partial),
1576+
|_req| {}
1577+
}
15501578

15511579
req! {
15521580
test_request_partial,
@@ -1560,6 +1588,18 @@ mod tests {
15601588
|_req| {}
15611589
}
15621590

1591+
req! {
1592+
test_request_method_path_no_delimiter,
1593+
b"GET /", Ok(Status::Partial),
1594+
|_req| {}
1595+
}
1596+
1597+
req! {
1598+
test_request_method_path_only,
1599+
b"GET / ", Ok(Status::Partial),
1600+
|_req| {}
1601+
}
1602+
15631603
req! {
15641604
test_request_partial_parses_headers_as_much_as_it_can,
15651605
b"GET / HTTP/1.1\r\nHost: yolo\r\n",

0 commit comments

Comments
 (0)