]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
DoH: reduce excessive bad request logging
authorArtem Boldariev <artem@isc.org>
Thu, 18 Jul 2024 17:21:53 +0000 (20:21 +0300)
committerAndoni Duarte Pintado <andoni@isc.org>
Wed, 15 Jan 2025 15:50:13 +0000 (16:50 +0100)
We started using isc_nm_bad_request() more actively throughout
codebase. In the case of HTTP/2 it can lead to a large count of
useless "Bad Request" messages in the BIND log, as often we attempt to
send such request over effectively finished HTTP/2 sessions.

This commit fixes that.

(cherry picked from commit 937b5f8349a6a5e15af254a53a659e39c7c1d179)

lib/isc/netmgr/http.c

index d3e84b6602838851c050e9a56cca5846f5b69404..a00f4a722921f03cb92bcedc53097fdb35510e13 100644 (file)
@@ -2434,6 +2434,12 @@ isc__nm_http_bad_request(isc_nmhandle_t *handle) {
        REQUIRE(!atomic_load(&sock->client));
        REQUIRE(VALID_HTTP2_SESSION(sock->h2.session));
 
+       if (sock->h2.response_submitted ||
+           !http_session_active(sock->h2.session))
+       {
+               return;
+       }
+
        (void)server_send_error_response(ISC_HTTP_ERROR_BAD_REQUEST,
                                         sock->h2.session->ngsession, sock);
 }