mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-23 17:52:26 -04:00
reverseproxy: Revert #4952 - don't ignore context cancellation in stream mode
Some checks failed
Tests / test (./cmd/caddy/caddy, ~1.22.3, macos-14, 0, 1.22, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.23.0, macos-14, 0, 1.23, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.22.3, windows-latest, True, 1.22, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.23.0, windows-latest, True, 1.23, windows) (push) Waiting to run
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.22.3, ubuntu-latest, 0, 1.22, linux) (push) Failing after 1m32s
Tests / test (./cmd/caddy/caddy, ~1.23.0, ubuntu-latest, 0, 1.23, linux) (push) Failing after 2m31s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Cross-Build / build (~1.22.3, 1.22, aix) (push) Successful in 1m27s
Cross-Build / build (~1.22.3, 1.22, darwin) (push) Successful in 1m29s
Cross-Build / build (~1.22.3, 1.22, dragonfly) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, freebsd) (push) Successful in 1m55s
Cross-Build / build (~1.22.3, 1.22, illumos) (push) Successful in 1m26s
Cross-Build / build (~1.22.3, 1.22, linux) (push) Successful in 1m41s
Cross-Build / build (~1.22.3, 1.22, netbsd) (push) Successful in 1m44s
Cross-Build / build (~1.22.3, 1.22, openbsd) (push) Successful in 1m48s
Cross-Build / build (~1.22.3, 1.22, solaris) (push) Successful in 1m36s
Cross-Build / build (~1.22.3, 1.22, windows) (push) Successful in 1m24s
Cross-Build / build (~1.23.0, 1.23, aix) (push) Successful in 3m14s
Cross-Build / build (~1.23.0, 1.23, darwin) (push) Successful in 1m53s
Cross-Build / build (~1.23.0, 1.23, dragonfly) (push) Successful in 1m56s
Cross-Build / build (~1.23.0, 1.23, freebsd) (push) Successful in 1m51s
Cross-Build / build (~1.23.0, 1.23, illumos) (push) Successful in 1m59s
Cross-Build / build (~1.23.0, 1.23, linux) (push) Successful in 1m53s
Cross-Build / build (~1.23.0, 1.23, netbsd) (push) Successful in 1m51s
Cross-Build / build (~1.23.0, 1.23, openbsd) (push) Successful in 1m48s
Cross-Build / build (~1.23.0, 1.23, solaris) (push) Successful in 1m54s
Cross-Build / build (~1.23.0, 1.23, windows) (push) Successful in 1m55s
Lint / lint (ubuntu-latest, linux) (push) Failing after 1m52s
Lint / govulncheck (push) Successful in 2m44s
Some checks failed
Tests / test (./cmd/caddy/caddy, ~1.22.3, macos-14, 0, 1.22, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.23.0, macos-14, 0, 1.23, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.22.3, windows-latest, True, 1.22, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.23.0, windows-latest, True, 1.23, windows) (push) Waiting to run
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.22.3, ubuntu-latest, 0, 1.22, linux) (push) Failing after 1m32s
Tests / test (./cmd/caddy/caddy, ~1.23.0, ubuntu-latest, 0, 1.23, linux) (push) Failing after 2m31s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Cross-Build / build (~1.22.3, 1.22, aix) (push) Successful in 1m27s
Cross-Build / build (~1.22.3, 1.22, darwin) (push) Successful in 1m29s
Cross-Build / build (~1.22.3, 1.22, dragonfly) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, freebsd) (push) Successful in 1m55s
Cross-Build / build (~1.22.3, 1.22, illumos) (push) Successful in 1m26s
Cross-Build / build (~1.22.3, 1.22, linux) (push) Successful in 1m41s
Cross-Build / build (~1.22.3, 1.22, netbsd) (push) Successful in 1m44s
Cross-Build / build (~1.22.3, 1.22, openbsd) (push) Successful in 1m48s
Cross-Build / build (~1.22.3, 1.22, solaris) (push) Successful in 1m36s
Cross-Build / build (~1.22.3, 1.22, windows) (push) Successful in 1m24s
Cross-Build / build (~1.23.0, 1.23, aix) (push) Successful in 3m14s
Cross-Build / build (~1.23.0, 1.23, darwin) (push) Successful in 1m53s
Cross-Build / build (~1.23.0, 1.23, dragonfly) (push) Successful in 1m56s
Cross-Build / build (~1.23.0, 1.23, freebsd) (push) Successful in 1m51s
Cross-Build / build (~1.23.0, 1.23, illumos) (push) Successful in 1m59s
Cross-Build / build (~1.23.0, 1.23, linux) (push) Successful in 1m53s
Cross-Build / build (~1.23.0, 1.23, netbsd) (push) Successful in 1m51s
Cross-Build / build (~1.23.0, 1.23, openbsd) (push) Successful in 1m48s
Cross-Build / build (~1.23.0, 1.23, solaris) (push) Successful in 1m54s
Cross-Build / build (~1.23.0, 1.23, windows) (push) Successful in 1m55s
Lint / lint (ubuntu-latest, linux) (push) Failing after 1m52s
Lint / govulncheck (push) Successful in 2m44s
i.e. Revert commit f5dce84a7028d1b116db7fead27ff8b2506baf78 Two years ago, the patch in #4952 was a seemingly necessary way to fix an issue (sort of an edge case), but it broke other more common use cases (see #6666). Now, as of #6669, it seems like the original issue can no longer be replicated, so we are reverting that patch, because it was incorrect anyway. If it turns out the original issue returns, a more proper patch may be in #6669 (even if used as a baseline for a future fix). A potential future fix could be an opt-in setting.
This commit is contained in:
parent
b183aec83c
commit
238f1108e6
@ -108,11 +108,6 @@ type Handler struct {
|
||||
// response is recognized as a streaming response, or if its
|
||||
// content length is -1; for such responses, writes are flushed
|
||||
// to the client immediately.
|
||||
//
|
||||
// Normally, a request will be canceled if the client disconnects
|
||||
// before the response is received from the backend. If explicitly
|
||||
// set to -1, client disconnection will be ignored and the request
|
||||
// will be completed to help facilitate low-latency streaming.
|
||||
FlushInterval caddy.Duration `json:"flush_interval,omitempty"`
|
||||
|
||||
// A list of IP ranges (supports CIDR notation) from which
|
||||
@ -833,15 +828,6 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
|
||||
}
|
||||
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
|
||||
|
||||
// if FlushInterval is explicitly configured to -1 (i.e. flush continuously to achieve
|
||||
// low-latency streaming), don't let the transport cancel the request if the client
|
||||
// disconnects: user probably wants us to finish sending the data to the upstream
|
||||
// regardless, and we should expect client disconnection in low-latency streaming
|
||||
// scenarios (see issue #4922)
|
||||
if h.FlushInterval == -1 {
|
||||
req = req.WithContext(context.WithoutCancel(req.Context()))
|
||||
}
|
||||
|
||||
// do the round-trip
|
||||
start := time.Now()
|
||||
res, err := h.Transport.RoundTrip(req)
|
||||
|
Loading…
x
Reference in New Issue
Block a user