mirror of https://github.com/caddyserver/caddy.git
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
|
// enable full-duplex for HTTP/1, ensuring the entire
|
||||||
// request body gets consumed before writing the response
|
// request body gets consumed before writing the response
|
||||||
if s.EnableFullDuplex {
|
if s.EnableFullDuplex && r.ProtoMajor == 1 {
|
||||||
//nolint:bodyclose
|
//nolint:bodyclose
|
||||||
err := http.NewResponseController(w).EnableFullDuplex()
|
err := http.NewResponseController(w).EnableFullDuplex()
|
||||||
if err != nil {
|
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…
Reference in New Issue