From 8ffe389daa57c3ed8dfc4d9969fdaedc531432c2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 22 Sep 2017 18:12:20 +0900 Subject: [PATCH] h2load: Print out h2 header fields with --verbose option --- src/h2load_http2_session.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/h2load_http2_session.cc b/src/h2load_http2_session.cc index 4419fe8e..28ad456c 100644 --- a/src/h2load_http2_session.cc +++ b/src/h2load_http2_session.cc @@ -26,6 +26,7 @@ #include #include +#include #include "h2load.h" #include "util.h" @@ -52,6 +53,15 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, } client->on_header(frame->hd.stream_id, name, namelen, value, valuelen); client->worker->stats.bytes_head_decomp += namelen + valuelen; + + if (client->worker->config->verbose) { + std::cout << "[stream_id=" << frame->hd.stream_id << "] "; + std::cout.write(reinterpret_cast(name), namelen); + std::cout << ": "; + std::cout.write(reinterpret_cast(value), valuelen); + std::cout << "\n"; + } + return 0; } } // namespace