Skip to content

feat: handle alt-svc port#30

Merged
mxinden merged 1 commit intomainfrom
alt-svc-port
Mar 12, 2026
Merged

feat: handle alt-svc port#30
mxinden merged 1 commit intomainfrom
alt-svc-port

Conversation

@mxinden
Copy link
Copy Markdown
Member

@mxinden mxinden commented Mar 6, 2026

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.

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for ConnectionAttemptHttpVersions to convert alt-svc HTTP versions
  • Adds test coverage for alt-svc port scenarios (alt_svc_with_port and https_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.

Comment thread src/lib.rs
Comment thread src/lib.rs
Copy link
Copy Markdown
Collaborator

@KershawChang KershawChang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mxinden mxinden merged commit eac1a3e into main Mar 12, 2026
10 checks passed
@larseggert larseggert deleted the alt-svc-port branch March 27, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants