1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

document all remaining unsafe usages (#1642)

adds some debug assertions where appropriate
This commit is contained in:
Rob Ede
2020-09-03 10:00:24 +01:00
committed by GitHub
parent 4e321595bc
commit 9a9d4b182e
7 changed files with 84 additions and 24 deletions

View File

@ -227,9 +227,11 @@ where
if !has_date {
let mut bytes = BytesMut::with_capacity(29);
self.config.set_date_header(&mut bytes);
res.headers_mut().insert(DATE, unsafe {
HeaderValue::from_maybe_shared_unchecked(bytes.freeze())
});
res.headers_mut().insert(
DATE,
// SAFETY: serialized date-times are known ASCII strings
unsafe { HeaderValue::from_maybe_shared_unchecked(bytes.freeze()) },
);
}
res