mirror of
https://github.com/actix/actix-web.git
synced 2025-01-03 13:58:44 +00:00
Fix http/2 date header generation
This commit is contained in:
parent
978091cedb
commit
c4f4cadb43
4 changed files with 10 additions and 4 deletions
|
@ -8,9 +8,11 @@
|
|||
|
||||
* Allow to set client websocket handshake timeout
|
||||
|
||||
* Refactor `TestServer` configuration
|
||||
|
||||
* Fix server websockets big payloads support
|
||||
|
||||
* Refactor `TestServer` configuration
|
||||
* Fix http/2 date header generation
|
||||
|
||||
|
||||
## 0.4.9 (2018-03-16)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -742,8 +742,8 @@ fn test_h2() {
|
|||
})
|
||||
})
|
||||
});
|
||||
let _res = core.run(tcp);
|
||||
// assert_eq!(res.unwrap(), Bytes::from_static(STR.as_ref()));
|
||||
let res = core.run(tcp);
|
||||
assert_eq!(res.unwrap(), Bytes::from_static(STR.as_ref()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue