diff options
author | XadillaX <admin@xcoder.in> | 2017-09-08 15:58:54 +0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2017-09-13 16:54:35 -0300 |
commit | 468110b3276007f445741b41c36beb0ef62d751c (patch) | |
tree | 20dad9aa50d6ec82a19100a12cff79bcd884d8a7 /test/parallel/test-tls-parse-cert-string.js | |
parent | f68ab39f8e7d21b9689ac1f9978758a4393c2072 (diff) | |
download | android-node-v8-468110b3276007f445741b41c36beb0ef62d751c.tar.gz android-node-v8-468110b3276007f445741b41c36beb0ef62d751c.tar.bz2 android-node-v8-468110b3276007f445741b41c36beb0ef62d751c.zip |
tls: deprecate parseCertString & move to internal
`tls.parseCertString()` exposed by accident. Now move this function to
`internal/tls` and mark the original one as deprecated.
PR-URL: https://github.com/nodejs/node/pull/14249
Refs: https://github.com/nodejs/node/issues/14193
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-parse-cert-string.js')
-rw-r--r-- | test/parallel/test-tls-parse-cert-string.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index 165e45cb9a..78e570d088 100644 --- a/test/parallel/test-tls-parse-cert-string.js +++ b/test/parallel/test-tls-parse-cert-string.js @@ -1,16 +1,22 @@ /* eslint-disable no-proto */ 'use strict'; + const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); +// Flags: --expose_internals +const internalTLS = require('internal/tls'); const tls = require('tls'); +const noOutput = common.mustNotCall(); +common.hijackStderr(noOutput); + { const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\n' + 'CN=ca1\nemailAddress=ry@clouds.org'; - const singlesOut = tls.parseCertString(singles); + const singlesOut = internalTLS.parseCertString(singles); assert.deepStrictEqual(singlesOut, { __proto__: null, C: 'US', @@ -26,7 +32,7 @@ const tls = require('tls'); { const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' + 'CN=*.nodejs.org'; - const doublesOut = tls.parseCertString(doubles); + const doublesOut = internalTLS.parseCertString(doubles); assert.deepStrictEqual(doublesOut, { __proto__: null, OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], @@ -36,7 +42,7 @@ const tls = require('tls'); { const invalid = 'fhqwhgads'; - const invalidOut = tls.parseCertString(invalid); + const invalidOut = internalTLS.parseCertString(invalid); assert.deepStrictEqual(invalidOut, { __proto__: null }); } @@ -45,5 +51,16 @@ const tls = require('tls'); const expected = Object.create(null); expected.__proto__ = 'mostly harmless'; expected.hasOwnProperty = 'not a function'; - assert.deepStrictEqual(tls.parseCertString(input), expected); + assert.deepStrictEqual(internalTLS.parseCertString(input), expected); +} + +common.restoreStderr(); + +{ + common.expectWarning('DeprecationWarning', + 'tls.parseCertString() is deprecated. ' + + 'Please use querystring.parse() instead.'); + + const ret = tls.parseCertString('foo=bar'); + assert.deepStrictEqual(ret, { __proto__: null, foo: 'bar' }); } |