aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorAndy Pan <i@andypan.me>2024-03-21 12:59:39 +0000
committerEmmanuel Odeke <emmanuel@orijtech.com>2024-03-25 09:37:46 +0000
commitaaecd755d70746b4b2daf9c694108360603d493d (patch)
tree86bebaae9024b4a0ccc80616b91a738660593469 /src/net/http
parent3ede9415944a55242a1888598c4bda00cc05d4ab (diff)
downloadgo-aaecd755d70746b4b2daf9c694108360603d493d.tar.xz
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/h2_bundle.go5
1 files changed, 3 insertions, 2 deletions
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) {