Skip to content

Commit 2caf436

Browse files
authored
Merge pull request kubernetes#77222 from liggitt/drop-proxy-workaround
Remove proxy workaround fixed in go 1.12.4
2 parents a2afe45 + c91cb1c commit 2caf436

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

staging/src/k8s.io/apimachinery/pkg/util/proxy/upgradeaware.go

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -230,34 +230,7 @@ func (h *UpgradeAwareHandler) ServeHTTP(w http.ResponseWriter, req *http.Request
230230
proxy := httputil.NewSingleHostReverseProxy(&url.URL{Scheme: h.Location.Scheme, Host: h.Location.Host})
231231
proxy.Transport = h.Transport
232232
proxy.FlushInterval = h.FlushInterval
233-
proxy.ServeHTTP(maybeWrapFlushHeadersWriter(w), newReq)
234-
}
235-
236-
// maybeWrapFlushHeadersWriter wraps the given writer to force flushing headers prior to writing the response body.
237-
// if the given writer does not support http.Flusher, http.Hijacker, and http.CloseNotifier, the original writer is returned.
238-
// TODO(liggitt): drop this once https://github.com/golang/go/issues/31125 is fixed
239-
func maybeWrapFlushHeadersWriter(w http.ResponseWriter) http.ResponseWriter {
240-
flusher, isFlusher := w.(http.Flusher)
241-
hijacker, isHijacker := w.(http.Hijacker)
242-
closeNotifier, isCloseNotifier := w.(http.CloseNotifier)
243-
// flusher, hijacker, and closeNotifier are all used by the ReverseProxy implementation.
244-
// if the given writer can't support all three, return the original writer.
245-
if !isFlusher || !isHijacker || !isCloseNotifier {
246-
return w
247-
}
248-
return &flushHeadersWriter{w, flusher, hijacker, closeNotifier}
249-
}
250-
251-
type flushHeadersWriter struct {
252-
http.ResponseWriter
253-
http.Flusher
254-
http.Hijacker
255-
http.CloseNotifier
256-
}
257-
258-
func (w *flushHeadersWriter) WriteHeader(code int) {
259-
w.ResponseWriter.WriteHeader(code)
260-
w.Flusher.Flush()
233+
proxy.ServeHTTP(w, newReq)
261234
}
262235

263236
// tryUpgrade returns true if the request was handled.

0 commit comments

Comments
 (0)