Skip to content

Commit

Permalink
net: fix family autoselection SSL connection handling
Browse files Browse the repository at this point in the history
PR-URL: #48189
Backport-PR-URL: #49183
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
ShogunPanda authored and ruyadorno committed Aug 17, 2023
1 parent 267439f commit b5f53d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_tls_wrap.js
Expand Up @@ -634,8 +634,8 @@ TLSSocket.prototype._wrapHandle = function(wrap, handle) {
};

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

this.handle = this._wrapHandle(null, handle);
this.ssl = this._handle;
Expand Down
20 changes: 20 additions & 0 deletions test/internet/test-https-autoselectfamily-slow-timeout.js
@@ -0,0 +1,20 @@
'use strict';

const common = require('../common');
const { addresses } = require('../common/internet');

if (!common.hasCrypto)
common.skip('missing crypto');

const assert = require('assert');
const { request } = require('https');

request(
`https://${addresses.INET_HOST}/en`,
// Purposely set this to false because we want all connection but the last to fail
{ autoSelectFamily: true, autoSelectFamilyAttemptTimeout: 10 },
(res) => {
assert.strictEqual(res.statusCode, 200);
res.resume();
},
).end();

0 comments on commit b5f53d9

Please sign in to comment.