1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00
This commit is contained in:
Nikolay Kim
2017-12-14 22:22:27 -08:00
parent d77156c16c
commit 4913e7d3c2
3 changed files with 7 additions and 7 deletions

View File

@ -539,13 +539,12 @@ impl Reader {
}
// Parse http message
let mut headers_indices = [HeaderIndices {
name: (0, 0),
value: (0, 0)
}; MAX_HEADERS];
let mut headers_indices: [HeaderIndices; MAX_HEADERS] =
unsafe{std::mem::uninitialized()};
let (len, method, path, version, headers_len) = {
let mut headers = [httparse::EMPTY_HEADER; MAX_HEADERS];
let mut headers: [httparse::Header; MAX_HEADERS] =
unsafe{std::mem::uninitialized()};
let mut req = httparse::Request::new(&mut headers);
match try!(req.parse(buf)) {
httparse::Status::Complete(len) => {

View File

@ -131,7 +131,8 @@ impl Writer for H2Writer {
if !msg.headers().contains_key(DATE) {
let mut bytes = BytesMut::with_capacity(29);
helpers::date(&mut bytes);
msg.headers_mut().insert(DATE, HeaderValue::try_from(&bytes[..]).unwrap());
msg.headers_mut().insert(
DATE, HeaderValue::try_from(bytes.freeze()).unwrap());
}
let mut resp = Response::new(());