httpcore2: prefer h2 for ALPN protocol if requesting HTTP/2 - #1155
Open
benjarobin wants to merge 1 commit into
Open
httpcore2: prefer h2 for ALPN protocol if requesting HTTP/2#1155benjarobin wants to merge 1 commit into
benjarobin wants to merge 1 commit into
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
benjarobin
force-pushed
the
fix-alpn-protocol
branch
4 times, most recently
from
August 22, 2026 07:30
88e6a5c to
25a9d14
Compare
When building the list of ALPN protocols for negotiation in the SSL context: - If HTTP/2 is requested, prioritize "h2" first. This is critical, as some servers (e.g., lighttpd) select the first protocol in the list. - If HTTP/1.1 is not disabled, include "http/1.1". If HTTP/1.1 was disabled we do not want to advertise that, otherwise the server may select HTTP/1.1 as protocol in the SSL context, but the client (httpx2) is still going to send the request using HTTP/2, which is going to confuse the server. - If both HTTP/2 and HTTP/1.1 are disabled, still include "http/1.1" as a fallback. Signed-off-by: Benjamin Robin <benjamin.robin@bootlin.com>
benjarobin
force-pushed
the
fix-alpn-protocol
branch
from
August 22, 2026 07:38
25a9d14 to
368ff61
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When building the list of ALPN protocols for negotiation in the SSL context:
Checklist
- I was not able to find the test infrastructure to test against an server with TLS and HTTP/2.
- Maybe somebody could point me in the right direction.
- It does not seem necessary to update the documentation.
I will try to add test and to update the documentation if nobody is against this change :)