GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: fix check for reused session · nodejs/node@581850b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _tls_wrap.js
  • test/parallel
    • test-https-resume-after-renew.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_tls_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_tls_wrap.js
+1-12Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -584,17 +584,6 @@ TLSSocket.prototype._start = function() {
584584
this._handle.start();
585585
};
586586

587-
TLSSocket.prototype._isSessionResumed = function _isSessionResumed(session) {
588-
if (!session)
589-
return false;
590-
591-
var next = this.getSession();
592-
if (!next)
593-
return false;
594-
595-
return next.equals(session);
596-
};
597-
598587
TLSSocket.prototype.setServername = function(name) {
599588
this._handle.setServername(name);
600589
};
@@ -1011,7 +1000,7 @@ exports.connect = function(/* [port, host], options, cb */) {
10111000

10121001
// Verify that server's identity matches it's certificate's names
10131002
// Unless server has resumed our existing session
1014-
if (!verifyError && !socket._isSessionResumed(options.session)) {
1003+
if (!verifyError && !socket.isSessionReused()) {
10151004
var cert = socket.getPeerCertificate();
10161005
verifyError = options.checkServerIdentity(hostname, cert);
10171006
}
Collapse file

‎test/parallel/test-https-resume-after-renew.js‎

Copy file name to clipboard
+56Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict';
2+
var common = require('../common');
3+
var fs = require('fs');
4+
var https = require('https');
5+
var crypto = require('crypto');
6+
7+
var options = {
8+
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
9+
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
10+
ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
11+
};
12+
13+
var server = https.createServer(options, function(req, res) {
14+
res.end('hello');
15+
});
16+
17+
var aes = new Buffer(16);
18+
aes.fill('S');
19+
var hmac = new Buffer(16);
20+
hmac.fill('H');
21+
22+
server._sharedCreds.context.enableTicketKeyCallback();
23+
server._sharedCreds.context.onticketkeycallback = function(name, iv, enc) {
24+
if (enc) {
25+
var newName = new Buffer(16);
26+
var newIV = crypto.randomBytes(16);
27+
newName.fill('A');
28+
} else {
29+
// Renew
30+
return [ 2, hmac, aes ];
31+
}
32+
33+
return [ 1, hmac, aes, newName, newIV ];
34+
};
35+
36+
server.listen(common.PORT, function() {
37+
var addr = this.address();
38+
39+
function doReq(callback) {
40+
https.request({
41+
method: 'GET',
42+
port: addr.port,
43+
servername: 'agent1',
44+
ca: options.ca
45+
}, function(res) {
46+
res.resume();
47+
res.once('end', callback);
48+
}).end();
49+
}
50+
51+
doReq(function() {
52+
doReq(function() {
53+
server.close();
54+
});
55+
});
56+
});

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.