-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(s2n-tls-hyper): Add support for negotiating HTTP/2 #4924
Changes from all commits
e87a725
0220444
a6cf75a
b8d25ba
8d090e9
0afa5ba
2900429
a90e03a
35f900d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,15 @@ where | |
{ | ||
fn connected(&self) -> Connected { | ||
match self { | ||
MaybeHttpsStream::Https(stream) => stream.inner().get_ref().connected(), | ||
MaybeHttpsStream::Https(stream) => { | ||
let connected = stream.inner().get_ref().connected(); | ||
let conn = stream.inner().as_ref(); | ||
match conn.application_protocol() { | ||
// Inform hyper that HTTP/2 was negotiated in the ALPN. | ||
Some(b"h2") => connected.negotiated_h2(), | ||
_ => connected, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we could assert that the negotiated application protocol was something we expected here. However, we can't return an error since this function doesn't return an error. We could panic, however misbehaved servers could technically return whatever ALPN value they want, whether or not the client attempted to negotiate it. So panicking here seems wrong, since it's outside of the user's control. It seemed better to just attempt HTTP/1 if an unexpected protocol was negotiated. |
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!