mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 02:19:22 +02:00
Fix http/2 date header generation
This commit is contained in:
@ -90,7 +90,7 @@ impl<H: 'static> Writer for H2Writer<H> {
|
||||
// using helpers::date is quite a lot faster
|
||||
if !msg.headers().contains_key(DATE) {
|
||||
let mut bytes = BytesMut::with_capacity(29);
|
||||
self.settings.set_date(&mut bytes);
|
||||
self.settings.set_date_simple(&mut bytes);
|
||||
msg.headers_mut().insert(DATE, HeaderValue::try_from(bytes.freeze()).unwrap());
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,10 @@ impl<H> WorkerSettings<H> {
|
||||
buf[35..].copy_from_slice(b"\r\n\r\n");
|
||||
dst.extend_from_slice(&buf);
|
||||
}
|
||||
|
||||
pub fn set_date_simple(&self, dst: &mut BytesMut) {
|
||||
dst.extend_from_slice(&(unsafe{&*self.date.get()}.bytes));
|
||||
}
|
||||
}
|
||||
|
||||
struct Date {
|
||||
|
Reference in New Issue
Block a user