Skip to content

Commit

Permalink
h2load: Print out h2 header fields with --verbose option
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Sep 22, 2017
1 parent 2576855 commit 8ffe389
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/h2load_http2_session.cc
Expand Up @@ -26,6 +26,7 @@

#include <cassert>
#include <cerrno>
#include <iostream>

#include "h2load.h"
#include "util.h"
Expand All @@ -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<const char *>(name), namelen);
std::cout << ": ";
std::cout.write(reinterpret_cast<const char *>(value), valuelen);
std::cout << "\n";
}

return 0;
}
} // namespace
Expand Down

0 comments on commit 8ffe389

Please sign in to comment.