-
-
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
425a058
commit 21aa817
Showing
4 changed files
with
109 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
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,59 @@ | ||
//! Section 5.3: Stream Dependencies | ||
use fluke_buffet::IntoHalves; | ||
use fluke_h2_parse::{HeadersFlags, PrioritySpec, StreamId}; | ||
|
||
use crate::{Conn, ErrorC}; | ||
|
||
/// A stream cannot depend on itself. An endpoint MUST treat this | ||
/// as a stream error (Section 5.4.2) of type PROTOCOL_ERROR. | ||
pub async fn headers_frame_depends_on_itself<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_with_priority( | ||
stream_id, | ||
HeadersFlags::EndHeaders | HeadersFlags::EndStream, | ||
PrioritySpec { | ||
stream_dependency: stream_id, | ||
exclusive: false, | ||
weight: 255, | ||
}, | ||
block_fragment, | ||
) | ||
.await?; | ||
|
||
conn.verify_stream_error(ErrorC::ProtocolError).await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
/// A stream cannot depend on itself. An endpoint MUST treat this | ||
/// as a stream error (Section 5.4.2) of type PROTOCOL_ERROR. | ||
pub async fn priority_frame_depends_on_itself<IO: IntoHalves + 'static>( | ||
mut conn: Conn<IO>, | ||
) -> eyre::Result<()> { | ||
let stream_id = StreamId(1); | ||
|
||
conn.handshake().await?; | ||
|
||
conn.write_priority( | ||
stream_id, | ||
PrioritySpec { | ||
stream_dependency: stream_id, | ||
exclusive: false, | ||
weight: 255, | ||
}, | ||
) | ||
.await?; | ||
|
||
conn.verify_stream_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