Backport (3-0-x) - fix: tls check shouldnt rely on an external service (#13338)

* fix: tls check shouldnt rely on an external service

* fix linting in the tls script'
This commit is contained in:
trop[bot] 2018-06-21 00:12:58 +10:00 committed by Samuel Attard
parent cdbd4792e3
commit 128a03450a
4 changed files with 89 additions and 4 deletions

18
script/tls.js Normal file
View file

@ -0,0 +1,18 @@
var fs = require('fs')
var https = require('https')
var path = require('path')
var server = https.createServer({
key: fs.readFileSync(path.resolve(__dirname, 'tls.key.pem')),
cert: fs.readFileSync(path.resolve(__dirname, 'tls.cert.pem'))
}, (req, res) => {
res.end(JSON.stringify({ protocol: req.socket.getProtocol() }))
setTimeout(() => {
server.close()
}, 0)
})
server.listen(0, () => {
console.log(server.address().port)
})