From: Oliver Chen Date: Fri, 4 Apr 2025 03:27:21 +0000 (+0000) Subject: Fix build errors with no DoH, address PR comments X-Git-Tag: dnsdist-2.0.0-alpha2~75^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93a997b0c821f397adba273d648c06340f9cf300;p=thirdparty%2Fpdns.git Fix build errors with no DoH, address PR comments --- diff --git a/pdns/dnsdistdist/dnsdist-doh-common.hh b/pdns/dnsdistdist/dnsdist-doh-common.hh index ae430e056a..6b54d9b4f7 100644 --- a/pdns/dnsdistdist/dnsdist-doh-common.hh +++ b/pdns/dnsdistdist/dnsdist-doh-common.hh @@ -207,9 +207,50 @@ class TCPQuerySender; #ifndef HAVE_DNS_OVER_HTTPS struct DOHUnitInterface { + std::string stubStr; + std::unordered_map stubHeaders; + virtual ~DOHUnitInterface() { } + + virtual std::string getHTTPPath() + { + return std::string(); + } + + virtual std::string getHTTPQueryString() + { + return std::string(); + } + + virtual const std::string& getHTTPHost() + { + return stubStr; + } + + virtual const std::string& getHTTPScheme() + { + return stubStr; + } + + virtual const std::unordered_map& getHTTPHeaders() + { + return stubHeaders; + } + + virtual std::shared_ptr getQuerySender() const + { + return nullptr; + } + + virtual void setHTTPResponse(uint16_t statusCode, PacketBuffer&& body, const std::string& contentType = "") + { + (void)statusCode; + (void)body; + (void)contentType; + } + static void handleTimeout(std::unique_ptr) { } diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index fdb05d8166..338858f913 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -189,7 +189,8 @@ void DoHConnectionToBackend::handleIOError() for (auto& request : d_currentStreams) { if (!d_healthCheckQuery && handleTimeoutResponseRules(timeoutRespRules, request.second.d_query.d_idstate, d_ds, request.second.d_sender)) { d_ds->reportTimeoutOrError(); - } else { + } + else { handleResponseError(std::move(request.second), now); } } diff --git a/pdns/dnsdistdist/dnsdist.cc b/pdns/dnsdistdist/dnsdist.cc index c068089db2..591eaf1544 100644 --- a/pdns/dnsdistdist/dnsdist.cc +++ b/pdns/dnsdistdist/dnsdist.cc @@ -66,6 +66,7 @@ #include "dnsdist-snmp.hh" #include "dnsdist-tcp.hh" #include "dnsdist-tcp-downstream.hh" +#include "dnsdist-tcp-upstream.hh" #include "dnsdist-web.hh" #include "dnsdist-xsk.hh" @@ -1572,11 +1573,14 @@ bool handleTimeoutResponseRules(const std::vector(sender); +#endif if (!dnsResponse.d_incomingTCPState || !sender || !sender->active()) { return false; } - } else if (protocol == dnsdist::Protocol::DoTCP || protocol == dnsdist::Protocol::DNSCryptTCP || protocol == dnsdist::Protocol::DoT) { + } + else if (protocol == dnsdist::Protocol::DoTCP || protocol == dnsdist::Protocol::DNSCryptTCP || protocol == dnsdist::Protocol::DoT) { dnsResponse.d_incomingTCPState = std::dynamic_pointer_cast(sender); if (!dnsResponse.d_incomingTCPState || !sender || !sender->active()) { return false; diff --git a/pdns/dnsdistdist/docs/reference/rules-management.rst b/pdns/dnsdistdist/docs/reference/rules-management.rst index 5efa9019d8..713236f600 100644 --- a/pdns/dnsdistdist/docs/reference/rules-management.rst +++ b/pdns/dnsdistdist/docs/reference/rules-management.rst @@ -514,7 +514,7 @@ Functions for manipulating Self-Answered Response Rules: Timeout ------- -For Rules related to timeed out queries: +For Rules related to timed out queries: .. function:: addTimeoutResponseAction(DNSRule, action [, options]) @@ -522,7 +522,7 @@ For Rules related to timeed out queries: Add a Rule and Action for timeout responses to the existing rules. - :param DNSrule rule: A :class:`DNSRule`, e.g. an :func:`AllRule`, or a compounded bunch of rules using e.g. :func:`AndRule`. Before 1.9.0 it was also possible to pass a string (or list of strings) but doing so is now deprecated. + :param DNSrule rule: A :class:`DNSRule`, e.g. an :func:`AllRule`, or a compounded bunch of rules using e.g. :func:`AndRule`. :param action: The action to take :param table options: A table with key: value pairs with options.