diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index d5db06c4404c98..05c5a2fe65cb53 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -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; diff --git a/test/internet/test-https-autoselectfamily-slow-timeout.js b/test/internet/test-https-autoselectfamily-slow-timeout.js new file mode 100644 index 00000000000000..ea8f1374c01a23 --- /dev/null +++ b/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(); diff --git a/test/parallel/test-http-remove-connection-header-persists-connection.js b/test/parallel/test-http-remove-connection-header-persists-connection.js index 6d05874272df03..df7e39ae94375f 100644 --- a/test/parallel/test-http-remove-connection-header-persists-connection.js +++ b/test/parallel/test-http-remove-connection-header-persists-connection.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const net = require('net'); @@ -52,7 +52,7 @@ function makeHttp10Request(cb) { setTimeout(function() { cb(socket); - }, 10); + }, common.platformTimeout(50)); }); }