Skip to content

Commit cc60766

Browse files
committed
net: fix pipe inference for adopted non-transport handles
Only trust the adopted handle's type when it came from a BoundSocket; a TLSSocket's _handle is a TLSWrap, not a Pipe, so TLS/HTTPS over pipes must still infer pipe-ness from the path option.
1 parent 1e5822c commit cc60766

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎lib/net.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,9 +1555,11 @@ Socket.prototype.connect = function(...args) {
15551555
}
15561556

15571557
const { path } = options;
1558-
// An adopted handle already fixes the transport; trust its type rather than
1559-
// inferring pipe-ness from a path option on the connect call.
1560-
const pipe = this._handle ? this._handle instanceof Pipe : !!path;
1558+
// An adopted BoundSocket handle already fixes the transport; trust its type
1559+
// rather than inferring pipe-ness from a path option on the connect call.
1560+
// Other pre-existing handles (e.g. a TLSWrap) are not transport handles, so
1561+
// fall back to the path option in that case.
1562+
const pipe = this[kBoundSource] ? this._handle instanceof Pipe : !!path;
15611563
debug('pipe', pipe, path);
15621564

15631565
if (!this._handle) {

0 commit comments

Comments
 (0)