Repository navigation
feat(client): HttpClient::from_url_with_addresses for pre-resolved addresses - #14
Merged
casibbald merged 1 commit intoNov 3, 2026
Conversation
…olved addresses from_url resolves the URL's host with the operating system resolver (getaddrinfo), which blocks the whole worker thread rather than the calling coroutine, and it connects without a deadline. Callers that resolve names off the worker threads or from a cache had no public way to hand the result in: the resolved-address constructor was crate-private. from_url_with_addresses takes the addresses and an overall connect timeout; the URL's host still sets the Host header and the TLS server name. Tests connect to a .invalid host by address, and reject an empty address list.
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.
HttpClient::from_url resolves the host with the system resolver (getaddrinfo). That call blocks the worker OS thread, so every coroutine on that worker waits behind it, and from_url connects without a deadline.
This adds a public constructor that takes already-resolved addresses plus an overall connect timeout. The URL host is still used for the Host header and TLS SNI; https uses the given rustls config or the platform verifier.
Tests: connecting to a
.invalidhost by address (proves no lookup happens) and rejecting an empty address list.cargo test --features client --lib client_implpasses. Clippy's 4 existing drop_non_drop findings in rich.rs are untouched by this change.