aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-04-23 15:52:28 -0400
committerGopher Robot <gobot@golang.org>2025-04-23 15:34:39 -0700
commitfca5832607d7c1afa20b82ca00ba4a27e28c0d0a (patch)
treedbdb33a0d013f5f835114c5ccffdfd919f8e1cdd /src/net/http
parent71d9505998fe224ebb7380616392f71f7ebf26bf (diff)
downloadgo-fca5832607d7c1afa20b82ca00ba4a27e28c0d0a.tar.xz
cmd/vendor: update x/tools and x/text
This CL updates x/tools to 68e94bd and x/text to v0.24.0, updates the vendor tree, and re-runs the bundle step for net/http. Updates golang/go#28308 Change-Id: I4184f77547f535270ddc8e2ce6542377e3046ffd Reviewed-on: https://go-review.googlesource.com/c/go/+/667597 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/h2_bundle.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 7e2b914c89..a55fa8ac63 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -1794,6 +1794,11 @@ var http2fhBytes = sync.Pool{
},
}
+func http2invalidHTTP1LookingFrameHeader() http2FrameHeader {
+ fh, _ := http2readFrameHeader(make([]byte, http2frameHeaderLen), strings.NewReader("HTTP/1.1 "))
+ return fh
+}
+
// ReadFrameHeader reads 9 bytes from r and returns a FrameHeader.
// Most users should use Framer.ReadFrame instead.
func http2ReadFrameHeader(r io.Reader) (http2FrameHeader, error) {
@@ -2075,10 +2080,16 @@ func (fr *http2Framer) ReadFrame() (http2Frame, error) {
return nil, err
}
if fh.Length > fr.maxReadSize {
+ if fh == http2invalidHTTP1LookingFrameHeader() {
+ return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err)
+ }
return nil, http2ErrFrameTooLarge
}
payload := fr.getReadBuf(fh.Length)
if _, err := io.ReadFull(fr.r, payload); err != nil {
+ if fh == http2invalidHTTP1LookingFrameHeader() {
+ return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err)
+ }
return nil, err
}
f, err := http2typeFrameParser(fh.Type)(fr.frameCache, fh, fr.countError, payload)
@@ -5007,7 +5018,10 @@ func (sc *http2serverConn) serve(conf http2http2Config) {
func (sc *http2serverConn) handlePingTimer(lastFrameReadTime time.Time) {
if sc.pingSent {
- sc.vlogf("timeout waiting for PING response")
+ sc.logf("timeout waiting for PING response")
+ if f := sc.countErrorFunc; f != nil {
+ f("conn_close_lost_ping")
+ }
sc.conn.Close()
return
}