Skip to content

Commit 25e32b3

Browse files
author
Tera
authored
aborted deprecated, switch to close/destroy
1 parent 4180efc commit 25e32b3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/proxy/passes/web.incoming.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,14 @@ export function stream(req: IncomingMessage, res: ServerResponse, options: Serve
131131
}
132132

133133
// Ensure we abort proxy if request is aborted
134-
req.on('aborted', function () {
135-
proxyReq.destroy();
134+
req.on('close', function () {
135+
if (req.destroyed) {
136+
proxyReq.destroy();
137+
}
136138
});
137139

138140
res.on('close', function () {
139-
if (res.destroyed) {
141+
if (!res.writableFinished) {
140142
proxyReq.destroy();
141143
}
142144
});
@@ -197,4 +199,4 @@ export function stream(req: IncomingMessage, res: ServerResponse, options: Serve
197199
}
198200
}
199201
});
200-
}
202+
}

0 commit comments

Comments
 (0)