Avoid abort when the response is finished

This commit is contained in:
Jarred Sumner
2024-10-14 06:48:07 -07:00
parent 240e795224
commit 3446bce092

View File

@@ -1277,7 +1277,9 @@ const IncomingMessagePrototype = {
if (nodeHTTPResponse) {
this[kHandle] = undefined;
nodeHTTPResponse.onabort = nodeHTTPResponse.ondata = undefined;
nodeHTTPResponse.abort();
if (!nodeHTTPResponse.finished) {
nodeHTTPResponse.abort();
}
const socket = this.socket;
if (socket && !socket.destroyed && this.aborted) {
socket.destroy(err);