From ae1960193c2b79b2ea0725557e25891aad33047d 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..36f4020e031 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'), () => { + client[kHTTPContext] = null + resume(client) + }) } if (client[kConnecting]) {