mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-27 19:27:37 +02:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user