File tree Expand file tree Collapse file tree 5 files changed +55
-1
lines changed
Expand file tree Collapse file tree 5 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -2838,6 +2838,13 @@ Found'`.
28382838<!-- YAML
28392839added: v0.1.13
28402840changes:
2841+ - version: REPLACEME
2842+ pr-url: https://github.com/nodejs/node/pull/42163
2843+ description: The `noDelay` option now defaults to `true`.
2844+ - version: REPLACEME
2845+ pr-url: https://github.com/nodejs/node/pull/41310
2846+ description: The `noDelay`, `keepAlive` and `keepAliveInitialDelay`
2847+ options are supported now.
28412848 - version:
28422849 - v13.8.0
28432850 - v12.15.0
@@ -2871,7 +2878,7 @@ changes:
28712878 ** Default:** 16384 (16 KB).
28722879 * ` noDelay ` {boolean} If set to ` true ` , it disables the use of Nagle's
28732880 algorithm immediately after a new incoming connection is received.
2874- ** Default:** ` false ` .
2881+ ** Default:** ` true ` .
28752882 * ` keepAlive ` {boolean} If set to ` true ` , it enables keep-alive functionality
28762883 on the socket immediately after a new incoming connection is received,
28772884 similarly on what is done in \[ ` socket.setKeepAlive([enable][, initialDelay]) ` ] \[ ` socket.setKeepAlive(enable, initialDelay) ` ] .
Original file line number Diff line number Diff line change @@ -822,6 +822,10 @@ behavior.
822822<!-- YAML
823823added: v0.1.90
824824changes:
825+ - version: REPLACEME
826+ pr-url: https://github.com/nodejs/node/pull/41310
827+ description: The `noDelay`, `keepAlive` and `keepAliveInitialDelay`
828+ options are supported now.
825829 - version: v12.10.0
826830 pr-url: https://github.com/nodejs/node/pull/25436
827831 description: Added `onread` option.
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ function Agent(options) {
101101
102102 this . options = { __proto__ : null , ...options } ;
103103
104+ if ( this . options . noDelay === undefined )
105+ this . options . noDelay = true ;
106+
104107 // Don't confuse net and make it think that we're connecting to a pipe
105108 this . options . path = null ;
106109 this . requests = ObjectCreate ( null ) ;
Original file line number Diff line number Diff line change @@ -363,6 +363,9 @@ function storeHTTPOptions(options) {
363363 if ( insecureHTTPParser !== undefined )
364364 validateBoolean ( insecureHTTPParser , 'options.insecureHTTPParser' ) ;
365365 this . insecureHTTPParser = insecureHTTPParser ;
366+
367+ if ( options . noDelay === undefined )
368+ options . noDelay = true ;
366369}
367370
368371function Server ( options , requestListener ) {
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const common = require ( '../common' ) ;
4+ const assert = require ( 'assert' ) ;
5+ const http = require ( 'http' ) ;
6+ const net = require ( 'net' ) ;
7+
8+ const originalConnect = net . Socket . prototype . connect ;
9+
10+ net . Socket . prototype . connect = common . mustCall ( function ( args ) {
11+ assert . strictEqual ( args [ 0 ] . noDelay , true ) ;
12+ return originalConnect . call ( this , args ) ;
13+ } ) ;
14+
15+ const server = http . createServer ( common . mustCall ( ( req , res ) => {
16+ res . writeHead ( 200 ) ;
17+ res . end ( ) ;
18+ server . close ( ) ;
19+ } ) ) ;
20+
21+ server . listen ( 0 , common . mustCall ( ( ) => {
22+ assert . strictEqual ( server . noDelay , true ) ;
23+
24+ const req = http . request ( {
25+ method : 'GET' ,
26+ port : server . address ( ) . port
27+ } , common . mustCall ( ( res ) => {
28+ res . on ( 'end' , ( ) => {
29+ server . close ( ) ;
30+ res . req . socket . end ( ) ;
31+ } ) ;
32+
33+ res . resume ( ) ;
34+ } ) ) ;
35+
36+ req . end ( ) ;
37+ } ) ) ;
You can’t perform that action at this time.
0 commit comments