1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-05-20 01:08:10 +00:00

add octal-ish CL test

This commit is contained in:
Rob Ede 2022-07-02 21:04:37 +01:00
parent 40eab1f091
commit c0d5d7bdb5
No known key found for this signature in database
GPG key ID: 97C636207D3EF933

View file

@ -964,12 +964,20 @@ mod tests {
"GET /test HTTP/1.1\r\n\
content-length: -1\r\n\r\n",
));
}
// octal CL
// expect_parse_err!(&mut BytesMut::from(
// "GET /test HTTP/1.1\r\n\
// content-length: 0123\r\n\r\n",
// ));
#[test]
fn octal_ish_cl_parsed_as_decimal() {
let mut buf = BytesMut::from(
"POST /test HTTP/1.1\r\n\
content-length: 011\r\n\r\n",
);
let mut reader = MessageDecoder::<Request>::default();
let (_req, pl) = reader.decode(&mut buf).unwrap().unwrap();
assert!(matches!(
pl,
PayloadType::Payload(pl) if pl == PayloadDecoder::length(11)
));
}
#[test]