From 42a4093423884df50f57fa14c01acf1833b2647a Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 11 Feb 2021 14:37:26 -0800 Subject: [PATCH] send the specified hostname in the HTTP URI dig was not working with a server with offloaded TLS; this turned out to be because it was sending the URI as "https://
/dns-query", not "https:///dns-query". using userarg instead of servname fixes the problem. (incidentally also corrected logged output to use the hostname when available.) --- bin/dig/dig.c | 2 +- bin/dig/dighost.c | 2 +- lib/isc/netmgr/http.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 36922e3342..754a76ac10 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -359,7 +359,7 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) { } else { proto = "UDP"; } - printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->servname, + printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->userarg, proto); time(&tnow); (void)localtime_r(&tnow, &tmnow); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 450802a1d5..bbef16adc7 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2800,7 +2800,7 @@ start_tcp(dig_query_t *query) { } else if (query->lookup->https_mode) { char uri[4096] = { 0 }; snprintf(uri, sizeof(uri), "https://%s:%u%s", - query->servname, (uint16_t)port, + query->userarg, (uint16_t)port, query->lookup->https_path); if (!query->lookup->http_plain) { diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index c89a7b45d7..8b217a06a4 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -1846,7 +1846,7 @@ isc_nm_listenhttp(isc_nm_t *mgr, isc_nmiface_t *iface, int backlog, /* * In DoH we just need to intercept the request - the response can be sent * to the client code via the nmhandle directly as it's always just the - * http * content. + * http content. */ static void http_callback(isc_nmhandle_t *handle, isc_result_t result, isc_region_t *data,