aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/httputil/reverseproxy.go
diff options
context:
space:
mode:
authorJordan Liggitt <liggitt@google.com>2019-03-28 23:37:54 -0400
committerBrad Fitzpatrick <bradfitz@golang.org>2019-03-29 15:56:57 +0000
commit2cc347382f4df3fb40d8d81ec9331f0748b1c394 (patch)
tree888b1334275df0267aff500c56763ef748c50b5b /src/net/http/httputil/reverseproxy.go
parent70ea70ecfda68abbc5b3c7703dc671f75adde645 (diff)
downloadgo-2cc347382f4df3fb40d8d81ec9331f0748b1c394.tar.gz
go-2cc347382f4df3fb40d8d81ec9331f0748b1c394.zip
net/http/httputil: make ReverseProxy flush headers on FlushInterval
A regression was introduced in CL 137335 (5440bfc) that caused FlushInterval to not be honored until the first Write() call was encountered. This change starts the flush timer as part of setting up the maxLatencyWriter. Fixes #31125 Fixes #31126 Change-Id: I75325bd926652922219bd1457b2b00ac6d0d41b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/170066 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/httputil/reverseproxy.go')
-rw-r--r--src/net/http/httputil/reverseproxy.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
index 92d7f63af5..0e0731b08f 100644
--- a/src/net/http/httputil/reverseproxy.go
+++ b/src/net/http/httputil/reverseproxy.go
@@ -389,6 +389,11 @@ func (p *ReverseProxy) copyResponse(dst io.Writer, src io.Reader, flushInterval
latency: flushInterval,
}
defer mlw.stop()
+
+ // set up initial timer so headers get flushed even if body writes are delayed
+ mlw.flushPending = true
+ mlw.t = time.AfterFunc(flushInterval, mlw.delayedFlush)
+
dst = mlw
}
}