Skip to content

Reuse TLS sessions in HTTPS client #1499

@bajtos

Description

@bajtos

The HTTPS client created via require('https').request() should reuse TLS sessions by default.

Sample code:

var sessions = [];

get(function() {
  get(function() {
    require('assert').equal(sessions[0].toString('hex'), sessions[1].toString('hex'));
    console.log('PASS');
  });
});

function get(cb) {
  return new Promise(function(resolve, reject) {
    require('https').request(
      { host: 'github.com', headers: { connection: 'close' } },
      function(res) {
        sessions.push(res.connection.getSession());
        res.resume();
        res.on('end', cb);
      })
      .end();
    })
}

/cc @indutny

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.httpsIssues or PRs related to the https subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions