src: Print header emission with stream_id
Since all headers are not always longer available on one nghttp2_session_mem_recv call, received headers may be interleaved with transmission log of the other frames. To make it clear that each header belongs to which stream, each header is printed with stream_id.
This commit is contained in:
parent
1382067976
commit
ce434d56a7
|
@ -780,6 +780,7 @@ int on_header_callback(nghttp2_session *session,
|
||||||
{
|
{
|
||||||
auto hd = static_cast<Http2Handler*>(user_data);
|
auto hd = static_cast<Http2Handler*>(user_data);
|
||||||
if(hd->get_config()->verbose) {
|
if(hd->get_config()->verbose) {
|
||||||
|
print_session_id(hd->session_id());
|
||||||
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
||||||
user_data);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,10 +161,13 @@ const char* ansi_escend()
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void print_nv(nghttp2_nv *nva, size_t nvlen)
|
namespace {
|
||||||
|
void print_nv(nghttp2_nv *nva, size_t nvlen, bool indent = true)
|
||||||
{
|
{
|
||||||
for(auto& nv : http2::sort_nva(nva, nvlen)) {
|
for(auto& nv : http2::sort_nva(nva, nvlen)) {
|
||||||
|
if(indent) {
|
||||||
print_frame_attr_indent();
|
print_frame_attr_indent();
|
||||||
|
}
|
||||||
printf("%s", ansi_esc("\033[1;34m"));
|
printf("%s", ansi_esc("\033[1;34m"));
|
||||||
fwrite(nv.name, nv.namelen, 1, stdout);
|
fwrite(nv.name, nv.namelen, 1, stdout);
|
||||||
printf("%s: ", ansi_escend());
|
printf("%s: ", ansi_escend());
|
||||||
|
@ -172,6 +175,7 @@ void print_nv(nghttp2_nv *nva, size_t nvlen)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namelen
|
||||||
|
|
||||||
void print_timer()
|
void print_timer()
|
||||||
{
|
{
|
||||||
|
@ -351,7 +355,9 @@ int verbose_on_header_callback(nghttp2_session *session,
|
||||||
const_cast<uint8_t*>(name), const_cast<uint8_t*>(value),
|
const_cast<uint8_t*>(name), const_cast<uint8_t*>(value),
|
||||||
static_cast<uint16_t>(namelen), static_cast<uint16_t>(valuelen)
|
static_cast<uint16_t>(namelen), static_cast<uint16_t>(valuelen)
|
||||||
};
|
};
|
||||||
print_nv(&nv, 1);
|
print_timer();
|
||||||
|
printf(" (stream_id=%d) ", frame->hd.stream_id);
|
||||||
|
print_nv(&nv, 1, false /* no indent */);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue