Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quic] add -v and -s to filter response headers #18

Merged
merged 3 commits into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions h2olog
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,12 @@ def handle_quic_event(cpu, data, size):
if allowed_quic_event and ev.type != allowed_quic_event:
return

if ev.type == "send_response_header": # HTTP-level events
if not verbose:
return
if allowed_res_header_name and ev.h2o_header_name != allowed_res_header_name:
return

res = OrderedDict()
load_common_fields(res, ev)

Expand Down Expand Up @@ -767,9 +773,12 @@ def handle_quic_event(cpu, data, size):
print(json.dumps(res, separators = (',', ':')))

def usage():
print ("USAGE: h2olog -p PID")
print (" h2olog quic -p PID")
print (" h2olog quic -t event_type -p PID")
print("""
USAGE: h2olog -p PID
h2olog quic -p PID
h2olog quic -t event_type -p PID
h2olog quic -v -s response_header_name -p PID
""".strip())
exit()

def trace_http():
Expand Down Expand Up @@ -802,12 +811,18 @@ if len(sys.argv) > 1 and sys.argv[1] == "quic":
try:
h2o_pid = 0
allowed_quic_event = None
opts, args = getopt.getopt(sys.argv[optidx:], 'p:t:')
allowed_res_header_name = None
verbose = False
opts, args = getopt.getopt(sys.argv[optidx:], 'vp:t:s:')
for opt, arg in opts:
if opt == "-p":
h2o_pid = arg
if opt == "-t":
elif opt == "-t":
allowed_quic_event = arg
elif opt == "-v":
verbose = True
elif opt == "-s": # reSponse
allowed_res_header_name = arg.lower()
except getopt.error as msg:
print(msg)
sys.exit(2)
Expand Down