Skip to content

Instantly share code, notes, and snippets.

@also
Created September 15, 2020 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save also/c3c825d35493f0bd398d524e64132c66 to your computer and use it in GitHub Desktop.
Save also/c3c825d35493f0bd398d524e64132c66 to your computer and use it in GitHub Desktop.
function testVersion(v) {
const prefix = process.version + ': 1.' + v;
const https = require('https');
const req = https.request(
{
host: 'tls-v1-' + v + '.badssl.com',
port: '101' + v,
path: '/',
method: 'GET',
},
function(res) {
res.on('data', function() {
console.log(prefix + ' supported');
});
}
);
req.end();
req.on('error', function(err) {
if (err.code === 'ECONNRESET' || err.code === 'EPROTO') {
console.log(prefix + ' NOT supported');
} else {
console.log(prefix + ' Unknown error');
}
});
}
[0, 1, 2].forEach(testVersion);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment