From 594797cd3ab934a61e70373331f0f042b17d4df6 Mon Sep 17 00:00:00 2001 From: tomholford Date: Tue, 5 May 2026 18:24:14 -0700 Subject: [PATCH] reverseproxy: drop nil-logger guard in runWebTransportPump Production and test callers both pass a non-nil *zap.Logger. The defensive nil check silently swapped in a no-op logger, which can mask a real bug at the call site. Document the precondition in the doc comment instead, per review. --- modules/caddyhttp/reverseproxy/webtransport_pump.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/webtransport_pump.go b/modules/caddyhttp/reverseproxy/webtransport_pump.go index 6c18305f2..d73944014 100644 --- a/modules/caddyhttp/reverseproxy/webtransport_pump.go +++ b/modules/caddyhttp/reverseproxy/webtransport_pump.go @@ -28,6 +28,7 @@ import ( // runWebTransportPump bridges two WebTransport sessions so that every // bidirectional stream, unidirectional stream, and datagram opened on one // side is mirrored onto the other. It blocks until both sessions end. +// logger must be non-nil; callers pass either h.logger or zap.NewNop(). // // Close propagation: when either session ends with a SessionError, the // error code and message are forwarded to the peer via CloseWithError. @@ -38,9 +39,6 @@ import ( // EXPERIMENTAL: this helper is an internal building block for the // WebTransport reverse-proxy transport and may change. func runWebTransportPump(clientSess, upstreamSess *webtransport.Session, logger *zap.Logger) { - if logger == nil { - logger = zap.NewNop() - } p := &webtransportPump{ client: clientSess, upstream: upstreamSess,