From 15d314fad58e990fbf2e5b14452de0a8b6dfcc01 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 27 Oct 2022 15:20:26 +0200 Subject: [PATCH 1/2] build,win: pass --debug-nghttp2 to configure --- vcbuild.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vcbuild.bat b/vcbuild.bat index 62334130f98abe..0bae0ea282aa10 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -197,6 +197,7 @@ if defined link_module set configure_flags=%configure_flags% %link_module% if defined i18n_arg set configure_flags=%configure_flags% --with-intl=%i18n_arg% if defined config_flags set configure_flags=%configure_flags% %config_flags% if defined target_arch set configure_flags=%configure_flags% --dest-cpu=%target_arch% +if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp2 if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose if "%target_arch%"=="x86" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set configure_flags=%configure_flags% --no-cross-compiling From 5d0b73d0665081723da75b1cecff552f41439022 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 27 Oct 2022 14:25:55 +0200 Subject: [PATCH 2/2] src: print nghttp2 logs when using --debug-nghttp2 --- node.gyp | 3 +++ src/node_http2.cc | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/node.gyp b/node.gyp index a3ae91c90124de..a22af3b479aadf 100644 --- a/node.gyp +++ b/node.gyp @@ -859,6 +859,9 @@ }, ], }], + [ 'debug_nghttp2==1', { + 'defines': [ 'NODE_DEBUG_NGHTTP2=1' ] + }], ], 'actions': [ { diff --git a/src/node_http2.cc b/src/node_http2.cc index f8f8af3a3dc2e6..fe66f9761d0c70 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -3179,6 +3179,12 @@ void SetCallbackFunctions(const FunctionCallbackInfo& args) { #undef SET_FUNCTION } +#ifdef NODE_DEBUG_NGHTTP2 +void NgHttp2Debug(const char* format, va_list args) { + vfprintf(stderr, format, args); +} +#endif + void Http2State::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("root_buffer", root_buffer); } @@ -3344,6 +3350,10 @@ void Initialize(Local target, #undef V target->Set(context, env->constants_string(), constants).Check(); + +#ifdef NODE_DEBUG_NGHTTP2 + nghttp2_set_debug_vprintf_callback(NgHttp2Debug); +#endif } } // namespace http2 } // namespace node