Merged
Conversation
When alt-svc specifies a port, generate connection attempt endpoints at that port using the origin domain's resolved addresses. HTTPS record endpoints take precedence over alt-svc by virtue of ordering.
There was a problem hiding this comment.
Pull request overview
This PR implements handling of the port field in AltSvc entries. When alt-svc specifies a custom port, connection attempts are now generated at that port using the origin domain's resolved addresses. HTTPS record endpoints take precedence by virtue of ordering in the next_endpoint_to_attempt function.
Changes:
- Adds endpoint generation for alt-svc entries with custom ports (a new "alt-svc bucket" inserted between the HTTPS record bucket and the fallback bucket)
- Adds a
From<HttpVersion>implementation forConnectionAttemptHttpVersionsto convert alt-svc HTTP versions - Adds test coverage for alt-svc port scenarios (
alt_svc_with_portandhttps_port_takes_precedence_over_alt_svc_port)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/lib.rs |
Core logic: adds alt-svc port bucket in next_endpoint_to_attempt, relaxes debug_assert in connection_attempt_http_versions, and adds From<HttpVersion> for ConnectionAttemptHttpVersions |
tests/network_config.rs |
New test alt_svc_with_port verifying alt-svc port generates endpoints at both the custom port and the origin port |
tests/https_records.rs |
New test https_port_takes_precedence_over_alt_svc_port verifying HTTPS record ports take priority over alt-svc ports |
tests/common/mod.rs |
New out_attempt helper for constructing flexible AttemptConnection outputs with arbitrary IP, port, and HTTP version |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
When alt-svc specifies a port, generate connection attempt endpoints at that port using the origin domain's resolved addresses. HTTPS record endpoints take precedence over alt-svc by virtue of ordering.
Discussed in #24.
CC @zirngibl. Note that this is a first version only, though in line with your suggestion to still use and prioritize HTTPS RR.