]> 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 09:52:56 +0000 (11:52 +0200)
The CookieHandler class handles all traffic for the "example." domain.
Make it a subclass of DomainHandler to simplify its definition.

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

index b5a1e75463767fcab91a2d5fef57b169eeef7d22..18074bcfb87a2e69a310a445f4c42b1c7d18fc71 100644 (file)
@@ -21,6 +21,7 @@ import dns.rrset
 from isctest.asyncserver import (
     AsyncDnsServer,
     DnsResponseSend,
+    DomainHandler,
     QnameQtypeHandler,
     QueryContext,
     ResponseHandler,
@@ -67,10 +68,8 @@ class ExampleNSHandler(QnameQtypeHandler, StaticResponseHandler):
     additional = [rrset("ns.example.", 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