Skip to content
Permalink
Browse files

net: use decodeStrings public API for writable stream

Instead of using an undocumented underscore-prefixed property to
configure the writable stream instance to not encode strings as buffers,
use the public API which is an options property passed to the
constructor.

Refs: #445

PR-URL: #25201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information...
Trott authored and targos committed Dec 24, 2018
1 parent 9ac8d41 commit c13e5be74014124caa428f05875b2df08f79bcd7
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/net.js
@@ -255,6 +255,8 @@ function Socket(options) {
options.allowHalfOpen = true;
// For backwards compat do not emit close on destroy.
options.emitClose = false;
// Handle strings directly.
options.decodeStrings = false;
stream.Duplex.call(this, options);

// Default to *not* allowing half open sockets.
@@ -308,9 +310,6 @@ function Socket(options) {
this._pendingData = null;
this._pendingEncoding = '';

// handle strings directly
this._writableState.decodeStrings = false;

// If we have a handle, then start the flow of data into the
// buffer. if not, then this will happen when we connect
if (this._handle && options.readable !== false) {

0 comments on commit c13e5be

Please sign in to comment.
You can’t perform that action at this time.