Skip to content

Commit b5f53d9

Browse files
ShogunPandaruyadorno
authored andcommittedAug 17, 2023
net: fix family autoselection SSL connection handling
PR-URL: #48189 Backport-PR-URL: #49183 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 267439f commit b5f53d9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed
 

‎lib/_tls_wrap.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ TLSSocket.prototype._wrapHandle = function(wrap, handle) {
634634
};
635635

636636
TLSSocket.prototype[kReinitializeHandle] = function reinitializeHandle(handle) {
637-
const originalServername = this._handle.getServername();
638-
const originalSession = this._handle.getSession();
637+
const originalServername = this.ssl ? this._handle.getServername() : null;
638+
const originalSession = this.ssl ? this._handle.getSession() : null;
639639

640640
this.handle = this._wrapHandle(null, handle);
641641
this.ssl = this._handle;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const { addresses } = require('../common/internet');
5+
6+
if (!common.hasCrypto)
7+
common.skip('missing crypto');
8+
9+
const assert = require('assert');
10+
const { request } = require('https');
11+
12+
request(
13+
`https://${addresses.INET_HOST}/en`,
14+
// Purposely set this to false because we want all connection but the last to fail
15+
{ autoSelectFamily: true, autoSelectFamilyAttemptTimeout: 10 },
16+
(res) => {
17+
assert.strictEqual(res.statusCode, 200);
18+
res.resume();
19+
},
20+
).end();

0 commit comments

Comments
 (0)
Please sign in to comment.