http2: add command line arguments

This commit is contained in:
Thomas Kriechbaumer 2015-06-01 18:14:21 +02:00
parent 7b4e50bb68
commit 16361439c4
2 changed files with 22 additions and 1 deletions

View File

@ -65,6 +65,17 @@ def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
"-t", dest="timeout", type=int, default=None,
help="Connection timeout"
)
parser.add_argument(
"--http2", dest="use_http2", action="store_true", default=False,
help='Perform all requests over a single HTTP/2 connection.'
)
parser.add_argument(
"--http2-skip-connection-preface",
dest="http2_skip_connection_preface",
action="store_true",
default=False,
help='Skips the HTTP/2 connection preface before sending requests.')
parser.add_argument(
'host', type=str,
metavar = "host[:port]",
@ -77,6 +88,7 @@ def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
specifcations
"""
)
group = parser.add_argument_group(
'SSL',
)
@ -189,7 +201,7 @@ def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
data = open(r).read()
r = data
try:
reqs.append(language.parse_pathoc(r))
reqs.append(language.parse_pathoc(r, args.use_http2))
except language.ParseException as v:
print >> stderr, "Error parsing request spec: %s" % v.msg
print >> stderr, v.marked()

View File

@ -150,6 +150,10 @@ class Pathoc(tcp.TCPClient):
clientcert=None,
ciphers=None,
# HTTP/2
use_http2=False,
http2_skip_connection_preface=False,
# Websockets
ws_read_limit = None,
@ -189,6 +193,9 @@ class Pathoc(tcp.TCPClient):
self.ciphers = ciphers
self.sslinfo = None
self.use_http2 = use_http2
self.http2_skip_connection_preface = http2_skip_connection_preface
self.ws_read_limit = ws_read_limit
self.timeout = timeout
@ -407,6 +414,8 @@ def main(args): # pragma: nocover
sslversion = args.sslversion,
clientcert = args.clientcert,
ciphers = args.ciphers,
use_http2 = args.use_http2,
http2_skip_connection_preface = args.http2_skip_connection_preface,
showreq = args.showreq,
showresp = args.showresp,
explain = args.explain,