Skip to content

Commit 655b327

Browse files
doc: call out http(s).globalAgent default
Despite the `http.Agent` stating: > The default `http.globalAgent` that is used by `http.request()` has > all of these values set to their respective defaults. this isn't true anymore since node.js 19. Both, the http as well as the https `globalAgent` now set `{ keepAlive: true, scheduling: 'lifo', timeout: 5000 }` as options. `'lifo'` is the default anyway, but `keepAlive` is turned off and no `timeout` is set on `new Agent()`. Document the diverging behaviour in the `globalAgent` sections, remove the false statement from `http.Agent` section, and extend the changelog to call out the timeout change as well. PR-URL: #52392 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent db17461 commit 655b327

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

doc/api/http.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ changes:
180180

181181
`options` in [`socket.connect()`][] are also supported.
182182

183-
The default [`http.globalAgent`][] that is used by [`http.request()`][] has all
184-
of these values set to their respective defaults.
185-
186183
To configure any of them, a custom [`http.Agent`][] instance must be created.
187184

188185
```mjs
@@ -3654,13 +3651,15 @@ changes:
36543651
- version:
36553652
- v19.0.0
36563653
pr-url: https://github.com/nodejs/node/pull/43522
3657-
description: The agent now uses HTTP Keep-Alive by default.
3654+
description: The agent now uses HTTP Keep-Alive and a 5 second timeout by
3655+
default.
36583656
-->
36593657

36603658
* {http.Agent}
36613659

36623660
Global instance of `Agent` which is used as the default for all HTTP client
3663-
requests.
3661+
requests. Diverges from a default `Agent` configuration by having `keepAlive`
3662+
enabled and a `timeout` of 5 seconds.
36643663

36653664
## `http.maxHeaderSize`
36663665

doc/api/https.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,13 @@ changes:
327327
- version:
328328
- v19.0.0
329329
pr-url: https://github.com/nodejs/node/pull/43522
330-
description: The agent now uses HTTP Keep-Alive by default.
330+
description: The agent now uses HTTP Keep-Alive and a 5 second timeout by
331+
default.
331332
-->
332333

333-
Global instance of [`https.Agent`][] for all HTTPS client requests.
334+
Global instance of [`https.Agent`][] for all HTTPS client requests. Diverges
335+
from a default [`https.Agent`][] configuration by having `keepAlive` enabled and
336+
a `timeout` of 5 seconds.
334337

335338
## `https.request(options[, callback])`
336339

0 commit comments

Comments
 (0)