Skip to content

Commit

Permalink
Merge pull request #173 from schummar/feature/builtkit-support
Browse files Browse the repository at this point in the history
Small changes for BuildKit support
  • Loading branch information
apocas authored Jan 3, 2025
2 parents dc8d82a + d985e28 commit d235469
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/modem.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Modem.prototype.dial = function (options, callback) {

if (options.hijack) {
optionsf.headers.Connection = 'Upgrade';
optionsf.headers.Upgrade = 'tcp';
optionsf.headers.Upgrade = optionsf.headers.Upgrade ?? 'tcp';
}

if (this.socketPath) {
Expand Down Expand Up @@ -300,6 +300,9 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
req.on('upgrade', function (res, sock, head) {
if (finished === false) {
finished = true;
if (head.length > 0) {
sock.unshift(head);
}
return callback(null, sock);
}
});
Expand Down Expand Up @@ -364,7 +367,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();
}
};
Expand Down

0 comments on commit d235469

Please sign in to comment.