Skip to content

Commit 2c48dda

Browse files
caddyhttp: Only attempt to enable full duplex for HTTP/1.x (#6102)
1 parent 30d6364 commit 2c48dda

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/caddyhttp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
301301

302302
// enable full-duplex for HTTP/1, ensuring the entire
303303
// request body gets consumed before writing the response
304-
if s.EnableFullDuplex {
304+
if s.EnableFullDuplex && r.ProtoMajor == 1 {
305305
//nolint:bodyclose
306306
err := http.NewResponseController(w).EnableFullDuplex()
307307
if err != nil {
308-
s.accessLogger.Warn("failed to enable full duplex", zap.Error(err))
308+
s.logger.Warn("failed to enable full duplex", zap.Error(err))
309309
}
310310
}
311311

0 commit comments

Comments
 (0)