From: Remi Gacogne Date: Thu, 28 Mar 2024 09:27:15 +0000 (+0100) Subject: dnsdist: Increase the HTTP/1.1 query counter when DoH with 1.1 ALPN X-Git-Tag: rec-5.1.0-alpha1~74^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd0eadc3ae285266c781cbc4bfe53c78723587f;p=thirdparty%2Fpdns.git dnsdist: Increase the HTTP/1.1 query counter when DoH with 1.1 ALPN 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. --- diff --git a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc index f3f622b152..3de9099989 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc @@ -272,6 +272,11 @@ bool IncomingHTTP2Connection::checkALPN() return true; } + constexpr std::array 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\nThis server implements RFC 8484 - DNS Queries over HTTP, and requires HTTP/2 in accordance with section 5.2 of the RFC.\r\n"); d_out.insert(d_out.end(), data.begin(), data.end()); writeToSocket(false); diff --git a/pdns/dnsdistdist/docs/guides/webserver.rst b/pdns/dnsdistdist/docs/guides/webserver.rst index 96cab46b88..8ac3ec32f4 100755 --- a/pdns/dnsdistdist/docs/guides/webserver.rst +++ b/pdns/dnsdistdist/docs/guides/webserver.rst @@ -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