]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Increase the HTTP/1.1 query counter when DoH with 1.1 ALPN
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Mar 2024 09:27:15 +0000 (10:27 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Mar 2024 09:30:01 +0000 (10:30 +0100)
This way we can keep track of how many HTTP/1.1 connections attempt
we see. We will not actually process the DNS over HTTP/1.1 payload
anyway when the `nghttp2` provider is used.

pdns/dnsdistdist/dnsdist-nghttp2-in.cc
pdns/dnsdistdist/docs/guides/webserver.rst

index f3f622b152fca5f8c238744993f93389f91f6851..3de909998996507301c2cb72e6c3650fc4fe5e7b 100644 (file)
@@ -272,6 +272,11 @@ bool IncomingHTTP2Connection::checkALPN()
     return true;
   }
 
+  constexpr std::array<uint8_t, 8> http11ALPN{'h','t','t','p','/','1','.','1'};
+  if (protocols.size() == http11ALPN.size() && memcmp(protocols.data(), http11ALPN.data(), http11ALPN.size()) == 0) {
+    ++d_ci.cs->dohFrontend->d_http1Stats.d_nbQueries;
+  }
+
   const std::string data("HTTP/1.1 400 Bad Request\r\nConnection: Close\r\n\r\n<html><body>This server implements RFC 8484 - DNS Queries over HTTP, and requires HTTP/2 in accordance with section 5.2 of the RFC.</body></html>\r\n");
   d_out.insert(d_out.end(), data.begin(), data.end());
   writeToSocket(false);
index 96cab46b8868385597809d149f1e81d61167ad9f..8ac3ec32f484e14207ac54a2c820b2f9ec2de504 100755 (executable)
@@ -838,7 +838,7 @@ JSON Objects
   :property integer error-responses: Number of HTTP responses sent with a non-200 code
   :property integer get-queries: Number of DoH queries received via the GET HTTP method
   :property integer http-connects: Number of DoH TCP connections established to this frontend
-  :property integer http1-queries: Number of DoH queries received over HTTP/1
+  :property integer http1-queries: Number of DoH queries received over HTTP/1 (or connection attempts with a HTTP/1.1 ALPN when the nghttp2 provider is used)
   :property integer http1-x00-responses: Number of DoH responses sent, over HTTP/1, per response code (200, 400, 403, 500, 502)
   :property integer http1-other-responses: Number of DoH responses sent, over HTTP/1, with another response code
   :property integer http2-queries: Number of DoH queries received over HTTP/2