]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-https-connect: use the passed in dns struct pointer
authorDaniel Stenberg <daniel@haxx.se>
Thu, 17 Apr 2025 20:49:29 +0000 (22:49 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 18 Apr 2025 21:24:18 +0000 (23:24 +0200)
... instead of digging it out from the connection struct.

Plus: simplify struct referencing in the condition.

Closes #17092

lib/cf-https-connect.c

index 9b80d9003c73029bb94f97a3db5312472f25adc5..77507bcc4cb5684e232f236c9b2d487853d09a29 100644 (file)
@@ -664,22 +664,22 @@ CURLcode Curl_cf_https_setup(struct Curl_easy *data,
 
   if(conn->bits.tls_enable_alpn) {
 #ifdef USE_HTTPSRR
-    /* Is there a HTTPSRR and if so, do its ALPNs it apply here?
+    /* Is there a HTTPSRR use its ALPNs here.
      * We are here after having selected a connection to a host+port and
      * can no longer change that. Any HTTPSRR advice for other hosts and ports
      * we need to ignore. */
-    if(conn->dns_entry && conn->dns_entry->hinfo &&
-       !conn->dns_entry->hinfo->no_def_alpn &&  /* ALPNs are defaults */
-       (!conn->dns_entry->hinfo->target ||      /* for same host */
-        !conn->dns_entry->hinfo->target[0] ||
-        (conn->dns_entry->hinfo->target[0] == '.' &&
-         !conn->dns_entry->hinfo->target[1])) &&
-       (conn->dns_entry->hinfo->port < 0 ||    /* for same port */
-        conn->dns_entry->hinfo->port == conn->remote_port)) {
+    struct Curl_https_rrinfo *rr = remotehost ? remotehost->hinfo : NULL;
+    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 < 0 ||    /* for same port */
+        rr->port == conn->remote_port)) {
       size_t i;
-      for(i = 0; i < CURL_ARRAYSIZE(conn->dns_entry->hinfo->alpns) &&
+      for(i = 0; i < CURL_ARRAYSIZE(rr->alpns) &&
                  alpn_count < CURL_ARRAYSIZE(alpn_ids); ++i) {
-        enum alpnid alpn = conn->dns_entry->hinfo->alpns[i];
+        enum alpnid alpn = rr->alpns[i];
         if(cf_https_alpns_contain(alpn, alpn_ids, alpn_count))
           continue;
         switch(alpn) {