From 0403ca1ac242dbaa550f3faf0cfae6dbb25310f8 Mon Sep 17 00:00:00 2001 From: Artem Boldariev Date: Thu, 12 Aug 2021 10:18:26 +0300 Subject: [PATCH] Make dig generate DoH URI using isc_nm_http_makeuri() This commit replaces ad-hoc code for DoH connect URI construction with isc_nm_http_makeuri(), making it handle IPv6 adresses properly (among other things). --- bin/dig/dighost.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 14859ed74c..0b27baefe6 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2799,9 +2799,10 @@ start_tcp(dig_query_t *query) { #if HAVE_LIBNGHTTP2 } else if (query->lookup->https_mode) { char uri[4096] = { 0 }; - snprintf(uri, sizeof(uri), "https://%s:%u%s", - query->userarg, (uint16_t)port, - query->lookup->https_path); + isc_nm_http_makeuri(!query->lookup->http_plain, + &query->sockaddr, query->userarg, + port, query->lookup->https_path, + uri, sizeof(uri)); if (!query->lookup->http_plain) { result =