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: support Uint8Arrays for protocol list buffers #11984

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
9 participants
@addaleax
Copy link
Member

addaleax commented Mar 22, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

@addaleax addaleax force-pushed the addaleax:tls-uint8array branch Mar 22, 2017

@mscdex

This comment has been minimized.

Copy link
Contributor

mscdex commented Mar 22, 2017

Why is this one semver-minor when the others are labeled as semver-major?

@jasnell

This comment has been minimized.

Copy link
Member

jasnell commented Mar 22, 2017

@mscdex .. the other PRs had error message changes, this one does not.

test/parallel/test-tls-basic-validations.js Outdated
@@ -56,3 +56,17 @@ assert.throws(() => tls.createSecurePair({}),
assert(buffer.equals(Buffer.from('abcd')));
assert(out.NPNProtocols.equals(Buffer.from('efgh')));
}

{
const buffer = new Uint8Array([...Buffer.from('abcd')]);

This comment has been minimized.

@lpinca

lpinca Mar 23, 2017

Member

Why using the spread operator? If I'm not wrong passing a buffer to the Uint8Array constructor (new Uint8Array(Buffer.from('abcd'))) works.

This comment has been minimized.

@TimothyGu

TimothyGu Mar 23, 2017

Member

For this case, indeed it would work. Passing a Buffer to Uint8Array makes the Uint8Array use the identical underlying ArrayBuffer, which at times may not be desirable. But in this case we are creating a new Buffer every time so it should be fine.

This comment has been minimized.

@lpinca

lpinca Mar 23, 2017

Member

@TimothyGu AFAIK memory is copied to the TypedArray not shared.

This comment has been minimized.

@TimothyGu

TimothyGu Mar 23, 2017

Member

@lpinca, heh I was mistaken. In that case, yeah there's no reason to use spread syntax...

This comment has been minimized.

@addaleax

addaleax Mar 24, 2017

Author Member

@lpinca @TimothyGu right, thanks for pointing out. fixed!

@addaleax addaleax force-pushed the addaleax:tls-uint8array branch to dd07fc0 Mar 24, 2017

@lpinca

lpinca approved these changes Mar 24, 2017

@addaleax

This comment has been minimized.

Copy link
Member Author

addaleax commented Mar 27, 2017

Landed in c3efe72

@addaleax addaleax closed this Mar 27, 2017

@addaleax addaleax deleted the addaleax:tls-uint8array branch Mar 27, 2017

addaleax added a commit that referenced this pull request Mar 27, 2017

tls: support Uint8Arrays for protocol list buffers
PR-URL: #11984
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins

This comment has been minimized.

Copy link
Member

MylesBorins commented Mar 28, 2017

This needs to be manually backported to v7.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment