Skip to content

Commit 5ddca72

Browse files
ShogunPandatargos
authored andcommitted
net: fix family autoselection SSL connection handling
PR-URL: #48189 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent 96e54dd commit 5ddca72

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

lib/_tls_wrap.js

Lines changed: 2 additions & 2 deletions
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;
Lines changed: 20 additions & 0 deletions
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();

test/parallel/test-http-remove-connection-header-persists-connection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44

55
const net = require('net');
@@ -52,7 +52,7 @@ function makeHttp10Request(cb) {
5252

5353
setTimeout(function() {
5454
cb(socket);
55-
}, 10);
55+
}, common.platformTimeout(50));
5656
});
5757
}
5858

0 commit comments

Comments
 (0)