From efc019a9fe361082d40bee77317018c3b80451a3 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 8 Oct 2020 17:31:27 -0300 Subject: [PATCH] separate condition Signed-off-by: Ignacio Hagopian --- src/net/http/httputil/reverseproxy.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index 1d45e4c49f1..46e5f68a843 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -402,11 +402,15 @@ func (p *ReverseProxy) flushInterval(res *http.Response) time.Duration { // For Server-Sent Events responses, flush immediately. // The MIME type is defined in https://www.w3.org/TR/eventsource/#text-event-stream - // We might have the case of streaming for which Content-Length might be unset. - if resCT == "text/event-stream" || res.ContentLength == -1 { + if resCT == "text/event-stream" { return -1 // negative means immediately } + // We might have the case of streaming for which Content-Length might be unset. + if res.ContentLength == -1 { + return -1 + } + return p.FlushInterval }