diff --git a/src/app_helper.cc b/src/app_helper.cc index 92b5b8d1..cfdc5820 100644 --- a/src/app_helper.cc +++ b/src/app_helper.cc @@ -443,10 +443,11 @@ int verbose_on_header_callback(nghttp2_session *session, }; print_timer(); - fprintf(outfile, " (stream_id=%d, noind=%d) ", frame->hd.stream_id, + fprintf(outfile, " recv (stream_id=%d, noind=%d) ", frame->hd.stream_id, (flags & NGHTTP2_NV_FLAG_NO_INDEX) != 0); print_nv(&nv); + fflush(outfile); return 0; } @@ -509,6 +510,23 @@ int verbose_on_frame_send_callback return 0; } +int verbose_on_data_chunk_recv_callback +(nghttp2_session *session, uint8_t flags, int32_t stream_id, + const uint8_t *data, size_t len, void *user_data) +{ + print_timer(); + auto srecv = nghttp2_session_get_stream_effective_recv_data_length + (session, stream_id); + auto crecv = nghttp2_session_get_effective_recv_data_length(session); + + fprintf(outfile, + " recv (stream_id=%d, length=%zu, srecv=%d, crecv=%d) DATA\n", + stream_id, len, srecv, crecv); + fflush(outfile); + + return 0; +} + namespace { std::chrono::steady_clock::time_point base_tv; } // namespace diff --git a/src/app_helper.h b/src/app_helper.h index 90375992..269ddc7f 100644 --- a/src/app_helper.h +++ b/src/app_helper.h @@ -63,6 +63,10 @@ int verbose_on_unknown_frame_recv_callback(nghttp2_session *session, int verbose_on_frame_send_callback (nghttp2_session *session, const nghttp2_frame *frame, void *user_data); +int verbose_on_data_chunk_recv_callback +(nghttp2_session *session, uint8_t flags, int32_t stream_id, + const uint8_t *data, size_t len, void *user_data); + // Returns difference between |a| and |b| in milliseconds, assuming // |a| is more recent than |b|. template diff --git a/src/nghttp.cc b/src/nghttp.cc index b6d7fca7..0658e060 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -1135,6 +1135,11 @@ int on_data_chunk_recv_callback return 0; } + if(config.verbose) { + verbose_on_data_chunk_recv_callback(session, flags, stream_id, data, len, + user_data); + } + if(req->status == 0) { nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, stream_id, NGHTTP2_PROTOCOL_ERROR);