From aaecd755d70746b4b2daf9c694108360603d493d Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Thu, 21 Mar 2024 12:59:39 +0000 Subject: net/http: update bundled x/net/http2 Keep ReadTimeout, ReadHeaderTimeout, IdleTimeout and WriteTimeout in sync Change-Id: I32b43884c0078eca86f20ec363f1d702ba298d1c Reviewed-on: https://go-review.googlesource.com/c/go/+/573315 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Reviewed-by: David Chase --- src/net/http/h2_bundle.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/net/http') diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 168405e15f..af839dd1bf 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -3916,6 +3916,7 @@ type http2Server struct { // IdleTimeout specifies how long until idle clients should be // closed with a GOAWAY frame. PING frames are not considered // activity for the purposes of IdleTimeout. + // If zero or negative, there is no timeout. IdleTimeout time.Duration // MaxUploadBufferPerConnection is the size of the initial flow @@ -4719,7 +4720,7 @@ func (sc *http2serverConn) serve() { sc.setConnState(StateActive) sc.setConnState(StateIdle) - if sc.srv.IdleTimeout != 0 { + if sc.srv.IdleTimeout > 0 { sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) defer sc.idleTimer.Stop() } @@ -5434,7 +5435,7 @@ func (sc *http2serverConn) closeStream(st *http2stream, err error) { delete(sc.streams, st.id) if len(sc.streams) == 0 { sc.setConnState(StateIdle) - if sc.srv.IdleTimeout != 0 { + if sc.srv.IdleTimeout > 0 { sc.idleTimer.Reset(sc.srv.IdleTimeout) } if http2h1ServerKeepAlivesDisabled(sc.hs) { -- cgit v1.3-6-g1900