Skip to content

Commit d235469

Browse files
authored
Merge pull request #173 from schummar/feature/builtkit-support
Small changes for BuildKit support
2 parents dc8d82a + d985e28 commit d235469

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/modem.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Modem.prototype.dial = function (options, callback) {
227227

228228
if (options.hijack) {
229229
optionsf.headers.Connection = 'Upgrade';
230-
optionsf.headers.Upgrade = 'tcp';
230+
optionsf.headers.Upgrade = optionsf.headers.Upgrade ?? 'tcp';
231231
}
232232

233233
if (this.socketPath) {
@@ -300,6 +300,9 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
300300
req.on('upgrade', function (res, sock, head) {
301301
if (finished === false) {
302302
finished = true;
303+
if (head.length > 0) {
304+
sock.unshift(head);
305+
}
303306
return callback(null, sock);
304307
}
305308
});
@@ -364,7 +367,7 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
364367
data.pipe(req);
365368
}
366369

367-
if (!context.hijack && !context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) {
370+
if (!context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) {
368371
req.end();
369372
}
370373
};

0 commit comments

Comments
 (0)