Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c13e5be

Browse filesBrowse files
Trotttargos
authored andcommitted
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>
1 parent 9ac8d41 commit c13e5be
Copy full SHA for c13e5be

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ function Socket(options) {
255255
options.allowHalfOpen = true;
256256
// For backwards compat do not emit close on destroy.
257257
options.emitClose = false;
258+
// Handle strings directly.
259+
options.decodeStrings = false;
258260
stream.Duplex.call(this, options);
259261

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

311-
// handle strings directly
312-
this._writableState.decodeStrings = false;
313-
314313
// If we have a handle, then start the flow of data into the
315314
// buffer. if not, then this will happen when we connect
316315
if (this._handle && options.readable !== false) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.