-
-
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
21aa817
commit de9432d
Showing
4 changed files
with
116 additions
and
36 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
38 changes: 38 additions & 0 deletions
38
crates/httpwg/src/rfc9113/_5_4_1_connection_error_handling.rs
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,38 @@ | ||
//! Section 5.4.1: Connection Error Handling | ||
use fluke_buffet::IntoHalves; | ||
|
||
use crate::{Conn, ErrorC}; | ||
|
||
/// After sending the GOAWAY frame for an error condition, | ||
/// the endpoint MUST close the TCP connection. | ||
pub async fn invalid_ping_frame_for_connection_close<IO: IntoHalves + 'static>( | ||
mut conn: Conn<IO>, | ||
) -> eyre::Result<()> { | ||
conn.handshake().await?; | ||
|
||
// PING frame with invalid stream ID | ||
conn.send(b"\x00\x00\x08\x06\x00\x00\x00\x00\x03").await?; | ||
conn.send(b"\x00\x00\x00\x00\x00\x00\x00\x00").await?; | ||
|
||
conn.verify_connection_close().await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
// An endpoint that encounters a connection error SHOULD first send | ||
// a GOAWAY frame (Section 6.8) with the stream identifier of the last | ||
// stream that it successfully received from its peer. | ||
pub async fn test_invalid_ping_frame_for_goaway<IO: IntoHalves + 'static>( | ||
mut conn: Conn<IO>, | ||
) -> eyre::Result<()> { | ||
conn.handshake().await?; | ||
|
||
// PING frame with invalid stream ID | ||
conn.send(b"\x00\x00\x08\x06\x00\x00\x00\x00\x03").await?; | ||
conn.send(b"\x00\x00\x00\x00\x00\x00\x00\x00").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