mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 09:31:10 +00:00
add HTTP/0.9 rejection test
This commit is contained in:
parent
7e990e423f
commit
e524fc86ea
1 changed files with 22 additions and 2 deletions
|
@ -654,12 +654,32 @@ mod tests {
|
|||
assert_eq!(req.path(), "/test");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_h09_reject() {
|
||||
let mut buf = BytesMut::from(
|
||||
"GET /test1 HTTP/0.9\r\n\
|
||||
\r\n",
|
||||
);
|
||||
|
||||
let mut reader = MessageDecoder::<Request>::default();
|
||||
reader.decode(&mut buf).unwrap_err();
|
||||
|
||||
let mut buf = BytesMut::from(
|
||||
"POST /test2 HTTP/0.9\r\n\
|
||||
Content-Length: 3\r\n\
|
||||
\r\n
|
||||
abc",
|
||||
);
|
||||
|
||||
let mut reader = MessageDecoder::<Request>::default();
|
||||
reader.decode(&mut buf).unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_h10_get() {
|
||||
let mut buf = BytesMut::from(
|
||||
"GET /test1 HTTP/1.0\r\n\
|
||||
\r\n\
|
||||
abc",
|
||||
\r\n",
|
||||
);
|
||||
|
||||
let mut reader = MessageDecoder::<Request>::default();
|
||||
|
|
Loading…
Reference in a new issue