File tree 5 files changed +55
-1
lines changed
5 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -2838,6 +2838,13 @@ Found'`.
2838
2838
<!-- YAML
2839
2839
added: v0.1.13
2840
2840
changes:
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.
2841
2848
- version:
2842
2849
- v13.8.0
2843
2850
- v12.15.0
@@ -2871,7 +2878,7 @@ changes:
2871
2878
** Default:** 16384 (16 KB).
2872
2879
* ` noDelay ` {boolean} If set to ` true ` , it disables the use of Nagle's
2873
2880
algorithm immediately after a new incoming connection is received.
2874
- ** Default:** ` false ` .
2881
+ ** Default:** ` true ` .
2875
2882
* ` keepAlive ` {boolean} If set to ` true ` , it enables keep-alive functionality
2876
2883
on the socket immediately after a new incoming connection is received,
2877
2884
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.
822
822
<!-- YAML
823
823
added: v0.1.90
824
824
changes:
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.
825
829
- version: v12.10.0
826
830
pr-url: https://github.com/nodejs/node/pull/25436
827
831
description: Added `onread` option.
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ function Agent(options) {
101
101
102
102
this . options = { __proto__ : null , ...options } ;
103
103
104
+ if ( this . options . noDelay === undefined )
105
+ this . options . noDelay = true ;
106
+
104
107
// Don't confuse net and make it think that we're connecting to a pipe
105
108
this . options . path = null ;
106
109
this . requests = ObjectCreate ( null ) ;
Original file line number Diff line number Diff line change @@ -363,6 +363,9 @@ function storeHTTPOptions(options) {
363
363
if ( insecureHTTPParser !== undefined )
364
364
validateBoolean ( insecureHTTPParser , 'options.insecureHTTPParser' ) ;
365
365
this . insecureHTTPParser = insecureHTTPParser ;
366
+
367
+ if ( options . noDelay === undefined )
368
+ options . noDelay = true ;
366
369
}
367
370
368
371
function 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