Skip to content

Alternative services client support#5841

Merged
vietj merged 25 commits into
masterfrom
alt-svc-support
Jan 7, 2026
Merged

Alternative services client support#5841
vietj merged 25 commits into
masterfrom
alt-svc-support

Conversation

@vietj
Copy link
Copy Markdown
Member

@vietj vietj commented Dec 9, 2025

Implementation of client HTTP Alternative Services (RFC 7838)

Implementation is based on the HTTP client address resolver which provides already client service discovery. Alternative services can be considered as a discovery mechanism that is populated by the interactions the client has with servers.

Origin resolver

The OriginResolver resolves Origin address to an OriginEndpoint.

An origin is the triplet (scheme,host,port) described by The Web Origin Concept.

An OriginEndpoint maintains

  • a primary OriginServer resulting from DNS resolution and for which we cannot really make an assumption on the HTTP protocol it can handle (although it is TCP based).
  • a list of OriginServer alternatives for which the HTTP protocol is determined by the alternative services discovery

The initial resolution uses the classic A/AAAA DNS resolution and thus initially an origin endpoint is the list of DNS resolved socket addresses.

When the client considers a connection could send alt-svc events, it sets an alt-svc event handler on the connection and relays those events to the origin resolver: an origin endpoint is looked up and when the endpoint is found, it is updated with the alternative services and potentially considered stale.

When an origin endpoint is stale, the resolver updates it on the next resolver lookup and we use the DNS resolver to obtain the alternative services adresses and keep only the ones we can DNS resolve.

Address resolver modifications

Several modifications have been made to the address resolver.

An endpoint is now capable of maintaining a filtered view of the server, which allows to create views for a given protocol and perform load balancing on this view.

HTTP modifications

The HTTP client relies on the origin resolver to obtain an origin endpoint. When the request

  • does not mandate a specific HTTP version, the endpoint is used as is.
  • mandates a specific HTTP version, a view of the endpoint for a given protocol is obtained and used for load balancing

The HttpConnectOptions now has a protocolVersion field that allows to set a desired HTTP version of the protocol instead of the version defined by HttpClientOptions.

A new HttpProtocol enum has been added to describe more precisely the HTTP protocol used as defined by https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids .

TLS changes

The SslContextManager and SslContextProvider have been updated to cache ssl contexts with the application protocols it supports. When a request is made to resolve an ssl context, the list of application protocols is passed instead of using an initial list provided at build time of the resolver.

Parser

A bunch of parsers have been added to parse alt-svc header strings.

DNS load balancing

The internal resolver for load balancing with DNS A/AAAA records is merged into the new origin resolver since this is pretty much the same thing.

Further work: SVCB and HTTPS Resource Records

The implementation of SVCB and HTTPS Resource Records will piggy back on this PR when the DNS resolver will support it. The origin resolver will obtain HTTPS resource records and directly populate the alternative services for a given origin.

@vietj vietj added this to the 5.1.0 milestone Dec 9, 2025
@vietj vietj marked this pull request as draft December 9, 2025 23:47
@vietj vietj self-assigned this Dec 9, 2025
@vietj vietj linked an issue Dec 9, 2025 that may be closed by this pull request
@vietj vietj force-pushed the alt-svc-support branch 4 times, most recently from 67ffd2a to e9a7edc Compare December 16, 2025 08:30
vietj added 17 commits January 5, 2026 18:26
…ns parsing code specifc to RFC3986 production rules.
…ed content matches IPv6address or IPvFuture production rules.

Motivation:

The HostAndPort IP-literal parser attempts to find content between square brackets, it should ensure that the enclosed content matches production rule.

Changes:

Implement IPv6address and IPvFuture parsing and use it when parsing IP-literal.
Motivation:

Implement Alt-Svc ABNF production parsing into a proper AltSvc object representing the parsed string.

This is required to implement alternative services.
Motivation:

The HTTP client request protocol is selected by the HttpClientOptions. With the advent of alternative services we should support specifying the protocol per request instead since a server might indicate an alternative server for a given protocol.

Changes:

HttpConnectOptions is added a protocol property that defines the desired protocol for the request, which is by default null, when null the client default protocol is used.

HTTP protocol is added to the client pool key so we distinguish a connection by its desired version, allowing the client to maintain connections to a given server for different versions of the protocol.
@vietj vietj changed the title Alternative services support Alternative services client support Jan 6, 2026
@vietj vietj marked this pull request as ready for review January 6, 2026 15:41
@vietj vietj merged commit c99a0f7 into master Jan 7, 2026
7 checks passed
@vietj vietj deleted the alt-svc-support branch January 7, 2026 14:11
tsegismont added a commit to tsegismont/vertx-sql-client that referenced this pull request Jan 8, 2026
Follows-up on eclipse-vertx/vert.x#5841

io.vertx.core.internal.net.SslChannelProvider.createClientSslHandler changed signature

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to eclipse-vertx/vertx-sql-client that referenced this pull request Jan 8, 2026
Follows-up on eclipse-vertx/vert.x#5841

io.vertx.core.internal.net.SslChannelProvider.createClientSslHandler changed signature

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to tsegismont/vertx-web that referenced this pull request Jan 8, 2026
Follows-up on eclipse-vertx/vert.x#5841

FakeEndpointResolver moved to FakeAddressResolver
New methods declared in HttpClientInternal

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to vert-x3/vertx-web that referenced this pull request Jan 8, 2026
Follows-up on eclipse-vertx/vert.x#5841

FakeEndpointResolver moved to FakeAddressResolver
New methods declared in HttpClientInternal

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alternative services HTTP client support

1 participant