]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tweak the _get_cookie() method
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 "len(cookie.server) == 0" condition is superfluous for the
"resend_loop" system test, so remove it.  Add a return type annotation
to the _get_cookie() function.

(cherry picked from commit 5fa2bd7e53e1d6ee6ebcc04b0bf5f303d3e85570)

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

index 1378dd7ea5294efaddae1430169db004a6ccd77b..8cd94fbfee1fb4ff62bab32b69096c9255bdeeda 100644 (file)
@@ -28,13 +28,11 @@ from isctest.asyncserver import (
 )
 
 
-def _get_cookie(qctx: QueryContext):
+def _get_cookie(qctx: QueryContext) -> dns.edns.CookieOption | None:
     for o in qctx.query.options:
         if o.otype == dns.edns.OptionType.COOKIE:
             cookie = o
-            if len(cookie.server) == 0:
-                cookie.server = b"\x11\x22\x33\x44\x55\x66\x77\x88"
-
+            cookie.server = b"\x11\x22\x33\x44\x55\x66\x77\x88"
             return cookie
 
     return None