Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: move convertNPNProtocols to End-of-Life #20736

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/tls/convertprotocols.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ objects respectively.
<a id="DEP0107"></a>
### 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.
Expand Down
10 changes: 0 additions & 10 deletions lib/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
16 changes: 0 additions & 16 deletions test/parallel/test-tls-basic-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')));
}