Created
September 15, 2020 18:05
-
-
Save also/c3c825d35493f0bd398d524e64132c66 to your computer and use it in GitHub Desktop.
test node tls versions. based on https://support.stripe.com/questions/upgrade-your-node-integration-from-tls-1-0-to-tls-1-2 and https://badssl.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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