Commit f3c80073 authored by Stephane Bortzmeyer's avatar Stephane Bortzmeyer
Browse files

Tests the message ID. Closes #17

parent 639d2e15
......@@ -303,11 +303,14 @@ def do_test(connection, qname, qtype=rtype):
if connection.dot:
messagew = message.to_wire()
length = len(messagew)
id = message.id
n = connection.session.send(length.to_bytes(2, byteorder='big') + messagew)
buf = connection.session.recv(2)
received = int.from_bytes(buf, byteorder='big')
buf = connection.session.recv(received)
response = dns.message.from_wire(buf)
response = dns.message.from_wire(buf)
if response.id != message.id:
raise Exception("The ID in the answer does not match the one in the query")
return (True, response, received)
else: # DoH
message.id = 0 # DoH requests that
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment