Add per-request DNS override API (curl --resolve / OkHttp Dns-style)
Could you please add support for a per-request DNS override that behaves like curl’s --resolve, or similar to OkHttp’s pluggable Dns interface (which lets you override host→IP resolution on a per-request basis)? At the moment HTTPClient.Configuration.dnsOverride is the only entry-point, so the mapping is effectively static for the lifetime of a client. In our workloads the host→IP mapping can change every minute, and paying the cost of creating and shutting down separate HTTPClient instances (each with its own connection pool) just to apply a new override is prohibitively expensive.
The capability we are looking for is:
- Let a single request supply a temporary host→IP mapping (or a resolver callback).
- Keep using the original host for SNI/certificate validation and logging.
- Route the actual TCP/TLS connection to the overridden address.
If the existing execute APIs exposed an optional per-request override, or allowed callers to provide a resolver closure (akin to overriding OkHttp’s Dns.resolve), we could keep the default behavior while enabling dynamic overrides. We’d greatly appreciate this enhancement.
This feels like a totally reasonable feature request. Right now it's not likely to be high enough up our priority list for us to tackle it immediately, but we'd welcome a contribution and I'd make sure we got it merged and across the line.