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://<address>/dns-query", not "https://<name>/dns-query".
using userarg instead of servname fixes the problem. (incidentally
also corrected logged output to use the hostname when available.)
This commit is contained in:
Evan Hunt
2021-02-11 14:37:26 -08:00
parent d18a4d47f6
commit 42a4093423
3 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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,