Handle more H2 details

This commit is contained in:
Carl Lerche
2017-08-10 21:08:57 -07:00
parent e2fac3e823
commit c439232ed2
5 changed files with 64 additions and 4 deletions

View File

@@ -36,6 +36,7 @@ pub enum DecoderError {
IntegerOverflow,
StringUnderflow,
RepeatedPseudo,
UnexpectedEndOfStream,
}
enum Representation {
@@ -277,6 +278,10 @@ impl Decoder {
fn decode_string(&mut self, buf: &mut Cursor<Bytes>) -> Result<Bytes, DecoderError> {
const HUFF_FLAG: u8 = 0b10000000;
if !buf.has_remaining() {
return Err(DecoderError::UnexpectedEndOfStream);
}
// The first bit in the first byte contains the huffman encoded flag.
let huff = peek_u8(buf) & HUFF_FLAG == HUFF_FLAG;