From e1950a00268c47c1cafbc2072002c260fb9ddce3 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 7 Apr 2024 13:15:21 +0200 Subject: [PATCH] fix: bad client destroy on servername change Fixes: https://github.com/nodejs/undici/issues/3065 --- lib/dispatcher/client.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/dispatcher/client.js b/lib/dispatcher/client.js index 60e68135549..996ecd7ad2d 100644 --- a/lib/dispatcher/client.js +++ b/lib/dispatcher/client.js @@ -581,7 +581,10 @@ function _resume (client, sync) { } client[kServerName] = request.servername - client[kHTTPContext]?.destroy(new InformationalError('servername changed')) + client[kHTTPContext]?.destroy(new InformationalError('servername changed'), () => { + // TODO (fix): What to do? + }) + client[kHTTPContext] = null } if (client[kConnecting]) {