https-rr: implementation improvements

- fold DoH and async HTTPS-RR handling into common code.
  have common cleanups, etc. Have a CURLcode result in async
  handling to allow HTTPS RR parsing to fail.
- keep target, ipv4hints, ipv6hints, port and echconfig also
  when resolving via cares. We need to know `target` and `port`
  when evaluating possible ALPN candidates to not go astray.
- add CURL_TRC_DNS for tracing DNS operations
- replace DoH specific tracing with DNS, use doh as alias
  for dns in curl_global_tracea()

Closes #16132
This commit is contained in:
Stefan Eissing 2025-01-30 15:31:16 +01:00 committed by Daniel Stenberg
parent db72b8d4d0
commit 1b710381ca
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 174 additions and 103 deletions

View file

@ -35,6 +35,8 @@
#define CURL_MAXLEN_host_name 253
#define MAX_HTTPSRR_ALPNS 4
struct Curl_easy;
struct Curl_https_rrinfo {
/*
* Fields from HTTPS RR. The only mandatory fields are priority and target.
@ -53,7 +55,15 @@ struct Curl_https_rrinfo {
uint16_t priority;
bool no_def_alpn; /* keytag = 2 */
};
#endif
CURLcode Curl_httpsrr_set(struct Curl_easy *data,
struct Curl_https_rrinfo *hi,
uint16_t rrkey, const uint8_t *val, size_t vlen);
struct Curl_https_rrinfo *
Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo);
void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo);
/*
* Code points for DNS wire format SvcParams as per RFC 9460
@ -68,9 +78,12 @@ struct Curl_https_rrinfo {
CURLcode Curl_httpsrr_decode_alpn(const unsigned char *cp, size_t len,
unsigned char *alpns);
#if defined(USE_ARES) && defined(USE_HTTPSRR)
#if defined(USE_ARES)
void Curl_dnsrec_done_cb(void *arg, ares_status_t status,
size_t timeouts,
const ares_dns_record_t *dnsrec);
#endif
#endif /* USE_ARES */
#endif /* USE_HTTPSRR */
#endif /* HEADER_CURL_HTTPSRR_H */