Happy Eyeballs: add resolution time delay

HEv3 describes conditions on when first connect attempts shall be
started.
https://www.ietf.org/archive/id/draft-ietf-happy-happyeyeballs-v3-01.html
Chapter 4.2

libcurl now waits 50ms for AAAA and HTTPS results (when requested) to
return before continuing with the connect.

Added HTTPS-RR to the "was resolved" information info message. Changed
logging of HTTPS-RR to a one-liner with RFC 9460 like formatting. This
way the user can see if/what was resolved and used in connecting.

Closes #21354
This commit is contained in:
Stefan Eissing 2026-04-17 10:26:25 +02:00 committed by Daniel Stenberg
parent 70a159527c
commit 809dda3a37
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 272 additions and 158 deletions

View file

@ -306,13 +306,8 @@ static enum alpnid cf_hc_get_httpsrr_alpn(struct Curl_cfilter *cf,
/* Do we have HTTPS-RR information? */
rr = Curl_conn_dns_get_https(data, cf->sockindex);
if(rr && !rr->no_def_alpn && /* ALPNs are defaults */
(!rr->target || /* for same host */
!rr->target[0] ||
(rr->target[0] == '.' &&
!rr->target[1])) &&
(!rr->port_set || /* for same port */
rr->port == cf->conn->remote_port)) {
/* We do not support `rr->no_def_alpn`. */
if(Curl_httpsrr_applicable(data, rr) && !rr->no_def_alpn) {
for(i = 0; i < CURL_ARRAYSIZE(rr->alpns); ++i) {
enum alpnid alpn_rr = (enum alpnid)rr->alpns[i];
if(alpn_rr == not_this_one) /* don't want this one */
@ -509,9 +504,6 @@ static CURLcode cf_hc_connect(struct Curl_cfilter *cf,
switch(ctx->state) {
case CF_HC_RESOLV:
/* Without any addressinfo, delay the start of balling. */
if(!Curl_conn_dns_has_any_ai(data, cf->sockindex))
return CURLE_OK;
ctx->state = CF_HC_INIT;
FALLTHROUGH();
@ -761,7 +753,7 @@ static void cf_hc_destroy(struct Curl_cfilter *cf, struct Curl_easy *data)
struct Curl_cftype Curl_cft_http_connect = {
"HTTPS-CONNECT",
CF_TYPE_SETUP,
CF_TYPE_SETUP | CF_TYPE_HTTPSRR,
CURL_LOG_LVL_NONE,
cf_hc_destroy,
cf_hc_connect,