-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de9432d
commit 0a9ab86
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Section 5.5: Extending HTTP/2 | ||
use fluke_buffet::IntoHalves; | ||
use fluke_h2_parse::{EncodedFrameType, Frame, FrameType, HeadersFlags, StreamId}; | ||
|
||
use crate::{Conn, ErrorC}; | ||
|
||
/// Extension frames that appear in the middle of a header block | ||
/// (Section 4.3) are not permitted; these MUST be treated as | ||
/// a connection error (Section 5.4.1) of type PROTOCOL_ERROR. | ||
pub async fn unknown_extension_frame_in_header_block<IO: IntoHalves + 'static>( | ||
mut conn: Conn<IO>, | ||
) -> eyre::Result<()> { | ||
let stream_id = StreamId(1); | ||
|
||
conn.handshake().await?; | ||
|
||
let headers = conn.common_headers(); | ||
let block_fragment = conn.encode_headers(&headers)?; | ||
|
||
conn.write_headers(stream_id, HeadersFlags::EndStream, block_fragment) | ||
.await?; | ||
|
||
conn.write_frame( | ||
Frame { | ||
frame_type: FrameType::Unknown(EncodedFrameType { | ||
ty: 0xff, | ||
flags: 0x0, | ||
}), | ||
..Default::default() | ||
}, | ||
b"0".repeat(8), | ||
) | ||
.await?; | ||
|
||
conn.verify_connection_error(ErrorC::ProtocolError).await?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters