electron/script/tls.js
trop[bot] 128a03450a 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'
2018-06-21 00:12:58 +10:00

18 lines
446 B
JavaScript

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)
})