Skip to content

Commit

Permalink
do not use : in cookie EDNS text output
Browse files Browse the repository at this point in the history
  • Loading branch information
rthalley committed Apr 13, 2024
1 parent f92a370 commit bfd0919
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dns/edns.py
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_edns.py
Expand Up @@ -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()
Expand Down

0 comments on commit bfd0919

Please sign in to comment.