diff --git a/dns/edns.py b/dns/edns.py index ef79b5f0..af90827a 100644 --- a/dns/edns.py +++ b/dns/edns.py @@ -455,7 +455,7 @@ def to_text(self) -> str: server = binascii.hexlify(self.server).decode() else: server = "" - return f"COOKIE {client}:{server}" + return f"COOKIE {client}{server}" @classmethod def from_wire_parser( diff --git a/tests/test_edns.py b/tests/test_edns.py index 8e63b21d..74b16c5c 100644 --- a/tests/test_edns.py +++ b/tests/test_edns.py @@ -222,11 +222,11 @@ def testCookieOption(self): opt.to_wire(io) data = io.getvalue() self.assertEqual(data, b"12345678") - self.assertEqual(str(opt), "COOKIE 3132333435363738:") + self.assertEqual(str(opt), "COOKIE 3132333435363738") opt = dns.edns.CookieOption(b"12345678", b"abcdefgh") data = opt.to_wire() self.assertEqual(data, b"12345678abcdefgh") - self.assertEqual(str(opt), "COOKIE 3132333435363738:6162636465666768") + self.assertEqual(str(opt), "COOKIE 31323334353637386162636465666768") # maximal server opt = dns.edns.CookieOption(b"12345678", b"abcdefghabcdefghabcdefghabcdefgh") io = BytesIO()