| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 410e083 commit c841b5a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,7 @@ exports.convertNPNProtocols = function convertNPNProtocols(NPNProtocols, out) { | |||
| 52 | 52 | ||
| 53 | 53 | // If it's already a Buffer - store it | |
| 54 | 54 | if (NPNProtocols instanceof Buffer) { | |
| 55 | - out.NPNProtocols = NPNProtocols; | ||
| 55 | + out.NPNProtocols = Buffer.from(NPNProtocols); | ||
| 56 | 56 | } | |
| 57 | 57 | }; | |
| 58 | 58 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + if (!common.hasCrypto) { | ||
| 5 | + common.skip('missing crypto'); | ||
| 6 | + return; | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + const assert = require('assert'); | ||
| 10 | + const tls = require('tls'); | ||
| 11 | + | ||
| 12 | + { | ||
| 13 | + const buffer = Buffer.from('abcd'); | ||
| 14 | + const out = {}; | ||
| 15 | + tls.convertNPNProtocols(buffer, out); | ||
| 16 | + out.NPNProtocols.write('efgh'); | ||
| 17 | + assert(buffer.equals(Buffer.from('abcd'))); | ||
| 18 | + assert(out.NPNProtocols.equals(Buffer.from('efgh'))); | ||
| 19 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments