]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/doh.hh
dnsdist: Add HTTPStatusAction to return a specific HTTP response
[thirdparty/pdns.git] / pdns / doh.hh
index b7b9bfe89fdf063ca6d69d11a4ce4a1925c594b6..cc16ccfb5abf15ec3088d4eca2a0740112f5bec8 100644 (file)
@@ -27,6 +27,7 @@ struct DOHFrontend
   std::atomic<uint64_t> d_postqueries;    // valid DNS queries received via POST
   std::atomic<uint64_t> d_badrequests;     // request could not be converted to dns query
   std::atomic<uint64_t> d_errorresponses; // dnsdist set 'error' on response
+    std::atomic<uint64_t> d_redirectresponses; // dnsdist set 'redirect' on response
   std::atomic<uint64_t> d_validresponses; // valid responses sent out
 
   struct HTTPVersionStats
@@ -73,20 +74,23 @@ struct DOHUnit
   ComboAddress dest;
   st_h2o_req_t* req{nullptr};
   DOHUnit** self{nullptr};
+  std::string reason;
+  std::string body;
   int rsock;
   uint16_t qtype;
-  /* the error and status_code are set from
+  /* the status_code is set from
      processDOHQuery() (which is executed in
      the DOH client thread) so that the correct
      response can be sent in on_dnsdist(),
      after the DOHUnit has been passed back to
      the main DoH thread.
   */
-  uint16_t status_code{0};
-  bool error{false};
+  uint16_t status_code{200};
   bool ednsAdded{false};
 };
 
+void DOHSetHTTPResponse(DOHUnit& du, uint16_t statusCode, const std::string& reason, const std::string& body);
+
 #endif /* HAVE_DNS_OVER_HTTPS  */
 
 void handleDOHTimeout(DOHUnit* oldDU);