Commit 9bf9dc22 authored by Alexandre's avatar Alexandre
Browse files

Option --sync for mutlistreams

With HTTP/2 streams, multiple transfers occur simultaneously.
The received data is stored in the corresponding handle as it
is received. Then the data is parsed, checked and displayed.
With the --sync option, the data is only parsed after the last
transfer is completed. Therefore all the received data are
parsed, checked and displayed synchronously.
However the data is still received asynchronously.
parent cd2a40c3
......@@ -53,6 +53,7 @@ forceIPv4 = False
forceIPv6 = False
connectTo = None
multistreams = False
sync = False
check = False
mandatory_level = None
check_additional = True
......@@ -528,9 +529,10 @@ class ConnectionDoH(Connection):
continue
while 1:
ret, num_handles = self.multi.perform()
n, handle_pass, handle_fail = self.multi.info_read()
for handle in handle_pass:
self.read_result_handle(handle)
if not sync:
n, handle_pass, handle_fail = self.multi.info_read()
for handle in handle_pass:
self.read_result_handle(handle)
if ret != pycurl.E_CALL_MULTI_PERFORM:
break
......@@ -790,7 +792,7 @@ if not monitoring:
try:
optlist, args = getopt.getopt (sys.argv[1:], "hvPkeV:r:f:d:t46",
["help", "verbose", "dot", "head",
"insecure", "POST", "vhost=", "multistreams",
"insecure", "POST", "vhost=", "multistreams", "sync",
"dnssec", "noedns", "ecs", "repeat=", "file=", "delay=",
"key=", "nosni",
"v4only", "v6only",
......@@ -813,6 +815,8 @@ if not monitoring:
insecure = True
elif option == "--multistreams":
multistreams = True
elif option == "--sync":
sync = True
elif option == "--dnssec":
dnssec = True
elif option == "--nosni":
......@@ -867,6 +871,9 @@ if not monitoring:
# TODO: use multistreams with --check
usage("Multi-streams requires an input file")
sys.exit(1)
if sync and not multistreams:
usage("--sync cannot be used without --multistreams")
sys.exit(1)
if not edns and not no_ecs:
usage("ECS requires EDNS")
sys.exit(1)
......@@ -1050,7 +1057,7 @@ for connectTo in ip_set:
time.sleep(delay)
if multistreams:
conn.perform_multi()
if False:
if sync:
print()
conn.read_results()
else:
......
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