Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/netPublic

Commitea63359

Browse files
AlexanderYastrebovgopherbot
authored andcommitted
http2: check stream body is present on read timeout
Check stream body is not nil in the handler to cover all callsitesForgolang/go#58237Change-Id: Ibeb19f2597f12da71b8dfb73718e230b4b316d06GitHub-Last-Rev:dc87befGitHub-Pull-Request:#162Reviewed-on:https://go-review.googlesource.com/c/net/+/464936Reviewed-by: Bryan Mills <bcmills@google.com>Reviewed-by: Matthew Dempsky <mdempsky@google.com>Run-TryBot: Damien Neil <dneil@google.com>TryBot-Result: Gopher Robot <gobot@golang.org>Reviewed-by: Damien Neil <dneil@google.com>Auto-Submit: Bryan Mills <bcmills@google.com>Commit-Queue: Bryan Mills <bcmills@google.com>
1 parentddd8598 commitea63359

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎http2/server.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,9 +1892,11 @@ func (st *stream) copyTrailersToHandlerRequest() {
18921892
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
18931893
// when the stream's ReadTimeout has fired.
18941894
func (st*stream)onReadTimeout() {
1895-
// Wrap the ErrDeadlineExceeded to avoid callers depending on us
1896-
// returning the bare error.
1897-
st.body.CloseWithError(fmt.Errorf("%w",os.ErrDeadlineExceeded))
1895+
ifst.body!=nil {
1896+
// Wrap the ErrDeadlineExceeded to avoid callers depending on us
1897+
// returning the bare error.
1898+
st.body.CloseWithError(fmt.Errorf("%w",os.ErrDeadlineExceeded))
1899+
}
18981900
}
18991901

19001902
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
@@ -2012,9 +2014,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
20122014
// (in Go 1.8), though. That's a more sane option anyway.
20132015
ifsc.hs.ReadTimeout!=0 {
20142016
sc.conn.SetReadDeadline(time.Time{})
2015-
ifst.body!=nil {
2016-
st.readDeadline=time.AfterFunc(sc.hs.ReadTimeout,st.onReadTimeout)
2017-
}
2017+
st.readDeadline=time.AfterFunc(sc.hs.ReadTimeout,st.onReadTimeout)
20182018
}
20192019

20202020
gosc.runHandler(rw,req,handler)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp