1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 02:19:22 +02:00

simplify h1 parse

This commit is contained in:
Nikolay Kim
2018-03-16 20:56:23 -07:00
parent 1fe4315c94
commit 6d792d9948
2 changed files with 27 additions and 19 deletions

View File

@ -145,7 +145,9 @@ impl HttpResponseParser {
// convert headers
let mut hdrs = HeaderMap::new();
for header in headers[..headers_len].iter() {
if let Ok(name) = HeaderName::try_from(header.name) {
let n_start = header.name.as_ptr() as usize - bytes_ptr;
let n_end = n_start + header.name.len();
if let Ok(name) = HeaderName::try_from(slice.slice(n_start, n_end)) {
let v_start = header.value.as_ptr() as usize - bytes_ptr;
let v_end = v_start + header.value.len();
let value = unsafe {