Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: fix family autoselection SSL connection handling #48189

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');

const net = require('net');
Expand Down Expand Up @@ -52,7 +52,7 @@ function makeHttp10Request(cb) {

setTimeout(function() {
cb(socket);
}, 10);
}, common.platformTimeout(50));
});
}

Expand Down