Commit c5341a67 authored by Alexandre's avatar Alexandre
Browse files

[DoT] Unbound Request object from Connection

parent d29bbd0c
......@@ -360,18 +360,22 @@ class ConnectionDoT(Connection):
length = len(data)
self.session.send(length.to_bytes(2, byteorder='big') + data)
def receive_data(self):
def receive_data(self, request):
buf = self.session.recv(2)
self.request.received = int.from_bytes(buf, byteorder='big')
buf = self.session.recv(self.request.received)
self.request.response = dns.message.from_wire(buf)
request.response_size = int.from_bytes(buf, byteorder='big')
buf = self.session.recv(request.response_size)
request.response = dns.message.from_wire(buf)
request.rcode = True
def send_and_receive(self, request):
self.send_data(request.data)
self.receive_data(request)
def do_test(self, qname, qtype=rtype):
self.request = RequestDoT(qname, qtype, want_dnssec=dnssec, use_edns=edns)
self.send_data(self.request.data)
self.receive_data()
self.request.check_response()
return (True, self.request.response, self.request.received)
request = RequestDoT(qname, qtype, want_dnssec=dnssec, use_edns=edns)
self.send_and_receive(request)
request.check_response()
return (request.rcode, request.response, request.response_size)
class ConnectionDoH(Connection):
......
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