mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-03 02:14:07 +08:00
caddyhttp: Only attempt to enable full duplex for HTTP/1.x (#6102)
This commit is contained in:
parent
30d63648f5
commit
2c48dda109
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user