Преглед на файлове

http2: clear WriteTimeout in Server

Current handling of WriteTimeout for http2 does not
extend the timeout on new streams. Disable the WriteTimeout
in http2 for 1.8 release.

Fixes test added in https://golang.org/cl/34723

Updates golang/go#18437

Change-Id: I366899fb4ff2e740610cad71e004141d092699a2
Reviewed-on: https://go-review.googlesource.com/34724
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Kale Blankenship преди 9 години
родител
ревизия
8fd7f25955
променени са 1 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. 10 0
      http2/server.go

+ 10 - 0
http2/server.go

@@ -278,6 +278,16 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
 		pushEnabled:       true,
 		pushEnabled:       true,
 	}
 	}
 
 
+	// The net/http package sets the write deadline from the
+	// http.Server.WriteTimeout during the TLS handshake, but then
+	// passes the connection off to us with the deadline already
+	// set. Disarm it here so that it is not applied to additional
+	// streams opened on this connection.
+	// TODO: implement WriteTimeout fully. See Issue 18437.
+	if sc.hs.WriteTimeout != 0 {
+		sc.conn.SetWriteDeadline(time.Time{})
+	}
+
 	if s.NewWriteScheduler != nil {
 	if s.NewWriteScheduler != nil {
 		sc.writeSched = s.NewWriteScheduler()
 		sc.writeSched = s.NewWriteScheduler()
 	} else {
 	} else {