Skip to content

Commit

Permalink
caddyhttp: Only attempt to enable full duplex for HTTP/1.x (caddyserv…
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie authored Feb 13, 2024
1 parent 30d6364 commit 2c48dda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/caddyhttp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit 2c48dda

Please sign in to comment.