Skip to content

Commit c979e13

Browse files
committed
Revert "internal/build, rpc: add missing HTTP response body Close() calls (ethereum#29223)"
This reverts commit 8580388.
1 parent bb10ff7 commit c979e13

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

internal/build/download.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
8484
resp, err := http.Get(url)
8585
if err != nil {
8686
return fmt.Errorf("download error: %v", err)
87-
}
88-
defer resp.Body.Close()
89-
90-
if resp.StatusCode != http.StatusOK {
87+
} else if resp.StatusCode != http.StatusOK {
9188
return fmt.Errorf("download error: status %d", resp.StatusCode)
9289
}
90+
defer resp.Body.Close()
9391
if err := os.MkdirAll(filepath.Dir(dstPath), 0755); err != nil {
9492
return err
9593
}

rpc/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
236236
if _, err := buf.ReadFrom(resp.Body); err == nil {
237237
body = buf.Bytes()
238238
}
239-
resp.Body.Close()
239+
240240
return nil, HTTPError{
241241
Status: resp.Status,
242242
StatusCode: resp.StatusCode,

0 commit comments

Comments
 (0)