Commit 0678053
authored
fix(transport): close response body on 404 in sendHTTP (#849)
When sendHTTP receives a 404 (session terminated), it returns
(nil, ErrSessionTerminated) without closing resp.Body. All four
callers (SendRequest, SendNotification, createGETConnectionToServer,
sendResponseToServer) defer resp.Body.Close() only after checking
err == nil, so the body is never closed.
Under listenForever retry loops, each 404 leaks one TCP connection.
On long-running clients this eventually exhausts file descriptors.
Fix: close resp.Body before returning on the 404 path.1 parent 083b8ac commit 0678053
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
681 | 682 | | |
682 | 683 | | |
683 | 684 | | |
| |||
0 commit comments