diff options
Diffstat (limited to 'lib/tls.js')
-rw-r--r-- | lib/tls.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/tls.js b/lib/tls.js index 80ea0d7697..695edd8c5a 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -1,6 +1,7 @@ 'use strict'; -require('internal/util').assertCrypto(exports); +const internalUtil = require('internal/util'); +internalUtil.assertCrypto(exports); const net = require('net'); const url = require('url'); @@ -21,16 +22,9 @@ exports.DEFAULT_CIPHERS = exports.DEFAULT_ECDH_CURVE = 'prime256v1'; -exports.getCiphers = function() { - const names = binding.getSSLCiphers(); - // Drop all-caps names in favor of their lowercase aliases, - var ctx = {}; - names.forEach(function(name) { - if (/^[0-9A-Z\-]+$/.test(name)) name = name.toLowerCase(); - ctx[name] = true; - }); - return Object.getOwnPropertyNames(ctx).sort(); -}; +exports.getCiphers = internalUtil.cachedResult(() => { + return internalUtil.filterDuplicateStrings(binding.getSSLCiphers(), true); +}); // Convert protocols array into valid OpenSSL protocols list // ("\x06spdy/2\x08http/1.1\x08http/1.0") |