Reputation: 29
I am running on Node v10.16.0 and I have a client and server both using HTTPS. I am trying to measure the performance of my network, in particular the https.request(GET) my client makes to the server. I have a question that I can't seem able to answer:
What version of TLS does Node v10.16.0 http.request run?
The getProtocol() is able to be called on a tls socket from tls.createServer(). I am trying to find the version of tls on a socket from https.createServer()
Upvotes: 0
Views: 1280
Reputation: 707148
https.request()
uses the TLS support built into node.js. When the socket is active, it appears you can call socket.getCipher()
and get a result such as:
{ name: 'AES256-SHA', version: 'TLSv1.2' }
So, presumably, you could call that function from one of the events that occurs during a request and use res.socket to get the live socket being used in the request and then use that socket to call socket.getCipher()
.
Here's an example:
const https = require('https');
const req = https.request("https://www.google.com", function(res) {
console.log(res.socket.getCipher());
res.on('data', function(data) {
// something here on incoming data
});
});
req.end();
I have node v12.13 installed and this outputs:
{ name: 'TLS_AES_256_GCM_SHA384', version: 'TLSv1.3' }
for me. You can run it on your own node version to see what you have.
Upvotes: 2