]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix build errors with no DoH, address PR comments
authorOliver Chen <oliver.chen@nokia-sbell.com>
Fri, 4 Apr 2025 03:27:21 +0000 (03:27 +0000)
committerOliver Chen <oliver.chen@nokia-sbell.com>
Fri, 4 Apr 2025 03:29:20 +0000 (03:29 +0000)
pdns/dnsdistdist/dnsdist-doh-common.hh
pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/dnsdist.cc
pdns/dnsdistdist/docs/reference/rules-management.rst

index ae430e056a357a595fdf1af0c2974b6ea4db9180..6b54d9b4f7bbc37c38ce3d4a91304f7eb7fd04f0 100644 (file)
@@ -207,9 +207,50 @@ class TCPQuerySender;
 #ifndef HAVE_DNS_OVER_HTTPS
 struct DOHUnitInterface
 {
+  std::string stubStr;
+  std::unordered_map<std::string, std::string> 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<std::string, std::string>& getHTTPHeaders()
+  {
+    return stubHeaders;
+  }
+
+  virtual std::shared_ptr<TCPQuerySender> 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<DOHUnitInterface>)
   {
   }
index fdb05d816606635e8f92b47f72d6905e26136d12..338858f9138bb4ac0223714383315c0b766296a2 100644 (file)
@@ -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);
     }
   }
index c068089db23bb875de850217780b15efcb29400e..591eaf1544b20420d74354e2aa36ef73ee58dead 100644 (file)
@@ -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<dnsdist::rules::ResponseRuleAc
 
   vinfolog("Handling timeout response rules for incoming protocol = %s", protocol.toString());
   if (protocol == dnsdist::Protocol::DoH) {
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     dnsResponse.d_incomingTCPState = std::dynamic_pointer_cast<IncomingHTTP2Connection>(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<IncomingTCPConnectionState>(sender);
     if (!dnsResponse.d_incomingTCPState || !sender || !sender->active()) {
       return false;
index 5efa9019d810a48b0a16fdeafbd524b99d9fa2ca..713236f60065e03a6b7d1679aeaad18782b264b5 100644 (file)
@@ -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.