1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-26 03:21:08 +00:00

add HTTP/0.9 rejection test

This commit is contained in:
Rob Ede 2022-07-01 09:03:57 +01:00
parent 7e990e423f
commit e524fc86ea
No known key found for this signature in database
GPG key ID: 97C636207D3EF933

View file

@ -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();