Remove byteorder-dependency (#392)

This commit is contained in:
lukaslueg
2019-08-09 22:20:48 +02:00
committed by Carl Lerche
parent 0a9a26144f
commit 782f1f712c
3 changed files with 6 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ use crate::hpack;
use http::{uri, HeaderMap, Method, StatusCode, Uri};
use http::header::{self, HeaderName, HeaderValue};
use byteorder::{BigEndian, ByteOrder};
use bytes::{Bytes, BytesMut};
use string::String;
@@ -563,7 +562,9 @@ impl EncodingHeaderBlock {
let payload_len = (dst.len() - payload_pos) as u64;
// Write the frame length
BigEndian::write_uint(&mut dst[head_pos..head_pos + 3], payload_len, 3);
let payload_len_be = payload_len.to_be_bytes();
assert!(payload_len_be[0..5].iter().all(|b| *b == 0));
(&mut dst[head_pos..head_pos + 3]).copy_from_slice(&payload_len_be[5..]);
if continuation.is_some() {
// There will be continuation frames, so the `is_end_headers` flag