From d82f064c74dcaa21993f55e0a028abfd20528ec4 Mon Sep 17 00:00:00 2001 From: XadillaX Date: Thu, 10 Aug 2017 11:16:44 +0800 Subject: [PATCH 1/2] doc, tls: mark parseCertString() as deprecated `tls.parseCertString()` was made public by mistack. So mark it as deprecated. Refs: https://github.com/nodejs/node/issues/14193 Refs: https://github.com/nodejs/node/commit/af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7#diff-cc32376ce1eaf679ec2298cd483f15c7R188 --- doc/api/deprecations.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c34f4e04d97923..e8b9ca4149f602 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -660,6 +660,28 @@ Type: Runtime `REPLServer.parseREPLKeyword()` was removed from userland visibility. + +### DEP00XX: tls.parseCertString() + +Type: Documentation-only + +`tls.parseCertString()` is a trivial parsing helper that was made public by +mistake. This function can usually be replaced with: + +```js +const querystring = require('querystring'); +querystring.parse(str, '\n', '='); +``` + +*Note*: This function is not completely equivalent to `querystring.parse()`. One +difference is that `querystring.parse()` does URLDecoding: + +```sh +> querystring.parse("%E5%A5%BD=1", "\n", "="); +{ '好': '1' } +> tls.parseCertString("%E5%A5%BD=1"); +{ '%E5%A5%BD': '1' } +``` [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array From 66d7e5911760f2a6a50dbc47cc3dde98c7a3b464 Mon Sep 17 00:00:00 2001 From: XadillaX Date: Fri, 1 Sep 2017 14:49:10 +0800 Subject: [PATCH 2/2] update after reviewing --- doc/api/deprecations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e8b9ca4149f602..0934cdcff2de1d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -674,12 +674,12 @@ querystring.parse(str, '\n', '='); ``` *Note*: This function is not completely equivalent to `querystring.parse()`. One -difference is that `querystring.parse()` does URLDecoding: +difference is that `querystring.parse()` does url encoding: ```sh -> querystring.parse("%E5%A5%BD=1", "\n", "="); +> querystring.parse('%E5%A5%BD=1', '\n', '='); { '好': '1' } -> tls.parseCertString("%E5%A5%BD=1"); +> tls.parseCertString('%E5%A5%BD=1'); { '%E5%A5%BD': '1' } ```