@ -285,7 +285,14 @@ fn http2_frame_header_static(
} ) ;
} else {
//use dynamic table
if dyn_headers . len ( ) + HTTP2_STATIC_HEADERS_NUMBER < n as usize {
if n = = 0 {
return Some ( HTTP2FrameHeaderBlock {
name : Vec ::new ( ) ,
value : Vec ::new ( ) ,
error : HTTP2HeaderDecodeStatus ::HTTP2HeaderDecodeIndex0 ,
sizeupdate : 0 ,
} ) ;
} else if dyn_headers . len ( ) + HTTP2_STATIC_HEADERS_NUMBER < n as usize {
return Some ( HTTP2FrameHeaderBlock {
name : Vec ::new ( ) ,
value : Vec ::new ( ) ,
@ -313,6 +320,7 @@ pub enum HTTP2HeaderDecodeStatus {
HTTP2HeaderDecodeError = 0x80 ,
HTTP2HeaderDecodeNotIndexed = 0x81 ,
HTTP2HeaderDecodeIntegerOverflow = 0x82 ,
HTTP2HeaderDecodeIndex0 = 0x83 ,
}
impl fmt ::Display for HTTP2HeaderDecodeStatus {
@ -949,6 +957,21 @@ mod tests {
panic! ( "Result should not be an error: {:?}." , err ) ;
}
}
let buf4 : & [ u8 ] = & [ 0x80 ] ;
let r4 = http2_parse_headers_block ( buf4 , & mut dynh ) ;
match r4 {
Ok ( ( remainder , hd ) ) = > {
assert_eq! ( hd . error , HTTP2HeaderDecodeStatus ::HTTP2HeaderDecodeIndex0 ) ;
assert_eq! ( remainder . len ( ) , 0 ) ;
assert_eq! ( dynh . len ( ) , 2 ) ;
}
Err ( Err ::Incomplete ( _ ) ) = > {
panic! ( "Result should not have been incomplete." ) ;
}
Err ( Err ::Error ( err ) ) | Err ( Err ::Failure ( err ) ) = > {
panic! ( "Result should not be an error: {:?}." , err ) ;
}
}
let buf2 : & [ u8 ] = & [
0x04 , 0x94 , 0x62 , 0x43 , 0x91 , 0x8a , 0x47 , 0x55 , 0xa3 , 0xa1 , 0x89 , 0xd3 , 0x4d , 0x0c ,
0x1a , 0xa9 , 0x0b , 0xe5 , 0x79 , 0xd3 , 0x4d , 0x1f ,