#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>)
{
}
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);
}
}
#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"
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;
Timeout
-------
-For Rules related to timeed out queries:
+For Rules related to timed out queries:
.. function:: addTimeoutResponseAction(DNSRule, action [, options])
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.