From 63f58037b932c1543798d79d49ce7e3c0bc55048 Mon Sep 17 00:00:00 2001 From: Marco Schumacher Date: Thu, 13 Jun 2024 15:16:05 +0200 Subject: [PATCH] preserve Upgrade header end request in hijack mode --- lib/modem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modem.js b/lib/modem.js index 6e60587..12d88f4 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -227,7 +227,7 @@ Modem.prototype.dial = function (options, callback) { if (options.hijack) { optionsf.headers.Connection = 'Upgrade'; - optionsf.headers.Upgrade = 'tcp'; + optionsf.headers.Upgrade ??= 'tcp'; } if (this.socketPath) { @@ -366,7 +366,7 @@ Modem.prototype.buildRequest = function (options, context, data, callback) { data.pipe(req); } - if (!context.hijack && !context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) { + if (!context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) { req.end(); } };