From 2c48dda109d213be0012743d8afb2d1f017ff878 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 13 Feb 2024 13:45:38 -0500 Subject: [PATCH] caddyhttp: Only attempt to enable full duplex for HTTP/1.x (#6102) --- modules/caddyhttp/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index 1dec6079..77af3136 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -301,11 +301,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // enable full-duplex for HTTP/1, ensuring the entire // request body gets consumed before writing the response - if s.EnableFullDuplex { + if s.EnableFullDuplex && r.ProtoMajor == 1 { //nolint:bodyclose err := http.NewResponseController(w).EnableFullDuplex() if err != nil { - s.accessLogger.Warn("failed to enable full duplex", zap.Error(err)) + s.logger.Warn("failed to enable full duplex", zap.Error(err)) } }