]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Simplify match criteria for CookieHandler
authorMichał Kępień <michal@isc.org>
Thu, 21 May 2026 09:52:56 +0000 (11:52 +0200)
committerMichał Kępień <michal@isc.org>
Thu, 21 May 2026 10:02:20 +0000 (12:02 +0200)
The CookieHandler class handles all traffic for the "example." domain.
Make it a subclass of DomainHandler to simplify its definition.

(cherry picked from commit ba6eee2b80064c459d21bb7a8723bea0a3d208fd)

bin/tests/system/resend_loop/ans3/ans.py

index 89da4e204a07448f1673a1a1b0d3f3c40dd1b530..a1ee2a85c4ffb46c348ae4c3a3daef57067efbb3 100644 (file)
@@ -21,6 +21,7 @@ import dns.rrset
 from isctest.asyncserver import (
     AsyncDnsServer,
     DnsResponseSend,
+    DomainHandler,
     QnameQtypeHandler,
     QueryContext,
     ResponseHandler,
@@ -60,10 +61,8 @@ class RootNSHandler(QnameQtypeHandler, StaticResponseHandler):
     additional = [rrset("a.root-servers.nil.", dns.rdatatype.A, "10.53.0.3")]
 
 
-class CookieHandler(ResponseHandler):
-    def match(self, qctx: QueryContext) -> bool:
-        example = dns.name.from_text("example")
-        return qctx.qname.is_subdomain(example)
+class CookieHandler(DomainHandler):
+    domains = ["example."]
 
     async def get_responses(
         self, qctx: QueryContext