From 4d00cd4ce7388893405a833531b56542f206c9e4 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 14 May 2018 18:15:30 -0700 Subject: [PATCH] tls: move convertNPNProtocols to End-of-Life MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was deprecated in 10.0.0 because NPN support was removed. It does not make sense to keep this around longer than 10.x PR-URL: https://github.com/nodejs/node/pull/20736 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Yuta Hiroto Reviewed-By: Ben Noordhuis Reviewed-By: Tobias Nießen Reviewed-By: Michaël Zasso Reviewed-By: Matteo Collina Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Ali Ijaz Sheikh --- benchmark/tls/convertprotocols.js | 4 ++-- doc/api/deprecations.md | 2 +- lib/tls.js | 10 ---------- test/parallel/test-tls-basic-validations.js | 16 ---------------- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/benchmark/tls/convertprotocols.js b/benchmark/tls/convertprotocols.js index 9f4969344d1bcd..0ba6c6dd0873b5 100644 --- a/benchmark/tls/convertprotocols.js +++ b/benchmark/tls/convertprotocols.js @@ -12,11 +12,11 @@ function main({ n }) { var m = {}; // First call dominates results if (n > 1) { - tls.convertNPNProtocols(input, m); + tls.convertALPNProtocols(input, m); m = {}; } bench.start(); for (var i = 0; i < n; i++) - tls.convertNPNProtocols(input, m); + tls.convertALPNProtocols(input, m); bench.end(n); } diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 8ac5f098bb632d..4b922045556695 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -977,7 +977,7 @@ objects respectively. ### DEP0107: tls.convertNPNProtocols() -Type: Runtime +Type: End-of-Life This was an undocumented helper function not intended for use outside Node.js core and obsoleted by the removal of NPN (Next Protocol Negotiation) support. diff --git a/lib/tls.js b/lib/tls.js index 28cd302674b04c..dc8a6a29c71b76 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -76,16 +76,6 @@ function convertProtocols(protocols) { return buff; } -exports.convertNPNProtocols = internalUtil.deprecate(function(protocols, out) { - // If protocols is Array - translate it into buffer - if (Array.isArray(protocols)) { - out.NPNProtocols = convertProtocols(protocols); - } else if (isUint8Array(protocols)) { - // Copy new buffer not to be modified by user. - out.NPNProtocols = Buffer.from(protocols); - } -}, 'tls.convertNPNProtocols() is deprecated.', 'DEP0107'); - exports.convertALPNProtocols = function(protocols, out) { // If protocols is Array - translate it into buffer if (Array.isArray(protocols)) { diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index 3840acc0243898..f2cf82b859dd0a 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -93,25 +93,9 @@ common.expectsError( assert(out.ALPNProtocols.equals(Buffer.from('efgh'))); } -{ - const buffer = Buffer.from('abcd'); - const out = {}; - tls.convertNPNProtocols(buffer, out); - out.NPNProtocols.write('efgh'); - assert(buffer.equals(Buffer.from('abcd'))); - assert(out.NPNProtocols.equals(Buffer.from('efgh'))); -} - { const buffer = new Uint8Array(Buffer.from('abcd')); const out = {}; tls.convertALPNProtocols(buffer, out); assert(out.ALPNProtocols.equals(Buffer.from('abcd'))); } - -{ - const buffer = new Uint8Array(Buffer.from('abcd')); - const out = {}; - tls.convertNPNProtocols(buffer, out); - assert(out.NPNProtocols.equals(Buffer.from('abcd'))); -}