From 4913e7d3c2d82ff47ae0bdd7baf2d28cab59bcfd Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 14 Dec 2017 22:22:27 -0800 Subject: [PATCH] cleanup --- README.md | 2 +- src/h1.rs | 9 ++++----- src/h2writer.rs | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 74a799c4..6fbe080a 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Each result is best of five runs. All measurements are req/sec. Name | 1 thread | 1 pipeline | 3 thread | 3 pipeline | 8 thread | 8 pipeline ---- | -------- | ---------- | -------- | ---------- | -------- | ---------- -Actix | 81.400 | 710.200 | 121.000 | 1.684.000 | 106.300 | 2.206.000 +Actix | 87.200 | 813.200 | 122.100 | 1.877.000 | 107.400 | 2.390.000 Gotham | 61.000 | 178.000 | | | | Iron | | | | | 94.500 | 78.000 Rocket | | | | | 95.500 | failed diff --git a/src/h1.rs b/src/h1.rs index d326b19e..7687810c 100644 --- a/src/h1.rs +++ b/src/h1.rs @@ -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) => { diff --git a/src/h2writer.rs b/src/h2writer.rs index 1c19010c..5874d660 100644 --- a/src/h2writer.rs +++ b/src/h2writer.rs @@ -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(());