@@ -230,34 +230,7 @@ func (h *UpgradeAwareHandler) ServeHTTP(w http.ResponseWriter, req *http.Request
230
230
proxy := httputil .NewSingleHostReverseProxy (& url.URL {Scheme : h .Location .Scheme , Host : h .Location .Host })
231
231
proxy .Transport = h .Transport
232
232
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 )
261
234
}
262
235
263
236
// tryUpgrade returns true if the request was handled.
0 commit comments