Commit 3f197e0d authored by Alexandre's avatar Alexandre
Browse files

Returns a Request object in do_test

parent 35e1483e
......@@ -268,15 +268,14 @@ class Connection:
self.family = 0
def do_test(self, qname, qtype=rtype):
# Routine doing one actual test. Returns a tuple, first member is a
# result (boolean indicating success for DoT, HTTP status code for
# DoH), second member is a DNS message (or a string if there is an
# error), third member is the size of the DNS message (or None if no
# proper response).
# Routine doing one actual test. Returns a Request object
pass
def print_result(self, rcode, msg, size):
def print_result(self, request):
ok = True
rcode = request.rcode
msg = request.response
size = request.response_size
if (self.dot and rcode) or (not self.dot and rcode == 200):
if not monitoring:
print(msg)
......@@ -380,7 +379,7 @@ class ConnectionDoT(Connection):
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)
return request
class ConnectionDoH(Connection):
......@@ -483,7 +482,7 @@ class ConnectionDoH(Connection):
request.post = post
self.send_and_receive(request)
request.check_response()
return (request.rcode, request.response, request.response_size)
return request
def get_next_domain(input_file):
......@@ -657,12 +656,12 @@ for i in range (0, tests):
if ifile is not None:
name, rtype = get_next_domain(input)
try:
(rcode, msg, size) = conn.do_test(name, rtype)
request = conn.do_test(name, rtype)
except (OpenSSL.SSL.Error, CustomException) as e:
ok = False
error(e)
break
if not conn.print_result(rcode, msg, size):
if not conn.print_result(request):
ok = False
if tests > 1 and i == 0:
start2 = time.time()
......
Supports Markdown
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