@marcel91200 / caddy Mirror · read-only / commits / 0da7b08e
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 10, 23:45 UTC

reverseproxy: remove unreachable isBidirectionalStream (#8366)

Suganraj committed Nov 6, 2026 at 16:16 UTC 0da7b08e81281d444228741c203de90bfcc755b5
1 file changed -22
modules/caddyhttp/reverseproxy/streaming.go
-22
@@ -413,31 +413,9 @@ func (h Handler) flushInterval(req *http.Request, res *http.Response, incrementa
413 return -1
414 }
415
416 - // for h2 and h2c upstream streaming data to client (issues #3556 and #3606)
417 - if h.isBidirectionalStream(req, res) {
418 - return -1
419 - }
420 -
416 return time.Duration(h.FlushInterval)
417 }
418
424 -// isBidirectionalStream returns whether we should work in bi-directional stream mode.
425 -//
426 -// See https://github.com/caddyserver/caddy/pull/3620 for discussion of nuances.
427 -func (h Handler) isBidirectionalStream(req *http.Request, res *http.Response) bool {
428 - // We have to check the encoding here; only flush headers with identity encoding.
429 - // Non-identity encoding might combine with "encode" directive, and in that case,
430 - // if body size larger than enc.MinLength, upper level encode handle might have
431 - // Content-Encoding header to write.
432 - // (see https://github.com/caddyserver/caddy/issues/3606 for use case)
433 - ae := req.Header.Get("Accept-Encoding")
434 -
435 - return req.ProtoMajor == 2 &&
436 - res.ProtoMajor == 2 &&
437 - res.ContentLength == -1 &&
438 - (ae == "identity" || ae == "")
439 -}
440 -
419 func (h Handler) copyResponse(dst http.ResponseWriter, src io.Reader, flushInterval time.Duration, logger *zap.Logger) error {
420 var w io.Writer = dst
421