fix(socketproxy): add Transfer-Encoding: chunked header

In goutils commit 5159888197c5a49605495be9b87525fde26c83d1 Copy with an http.ResponseWriter destination no longer flushes after every write unless Content-Type is text/event-stream, or Transfer-Encoding includes chunked without Content-Length.

This causes endpoints like /events not being flushed on write,
which delays notification like container creation/deletion.

This commit enforces flush on every write for socket proxy,
which also applies to agents
This commit is contained in:
yusing
2026-04-24 11:47:36 +08:00
parent 6bb56fea2b
commit 3e8298d1d4

View File

@@ -34,7 +34,10 @@ func dockerSocketHandler(socket string) http.HandlerFunc {
},
}
return rp.ServeHTTP
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Transfer-Encoding", "chunked")
rp.ServeHTTP(w, r)
}
}
func endpointNotAllowed(w http.ResponseWriter, _ *http.Request) {