Skip to content

Commit 9ace223

Browse files
committed
websocket: add missing call to resp.Body.Close
Within hybiClientHandshake, after getting a response from http.ReadResponse, the body is never closed. When running a debugger with all of our test cases, this seems to not matter usually since the body is typically a http.noBody, whose Close just returns nil. However, this is not always the case. Therefore, this CL adds the missing resp.Body.Close call. Fixes golang/go#76952 Change-Id: I292d6ccc8eb101b806738aa7fc3e5446b623d861 Reviewed-on: https://go-review.googlesource.com/c/net/+/734240 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
1 parent 7d3dbb0 commit 9ace223

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

websocket/hybi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (er
440440
if err != nil {
441441
return err
442442
}
443+
defer resp.Body.Close()
443444
if resp.StatusCode != 101 {
444445
return ErrBadStatus
445446
}

0 commit comments

Comments
 (0)