From 655b327a4dfafa7a5a86ea9e98566e7662f475a5 Mon Sep 17 00:00:00 2001 From: mathis-west-1 Date: Mon, 8 Apr 2024 22:33:46 +0200 Subject: [PATCH] doc: call out http(s).globalAgent default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/52392 Reviewed-By: Luigi Pinca Reviewed-By: Paolo Insogna Reviewed-By: Matteo Collina Reviewed-By: Marco Ippolito Reviewed-By: Ulises Gascón Reviewed-By: Moshe Atlow --- doc/api/http.md | 9 ++++----- doc/api/https.md | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 30fb7cd030f51e..abcae04adddbee 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -180,9 +180,6 @@ changes: `options` in [`socket.connect()`][] are also supported. -The default [`http.globalAgent`][] that is used by [`http.request()`][] has all -of these values set to their respective defaults. - To configure any of them, a custom [`http.Agent`][] instance must be created. ```mjs @@ -3654,13 +3651,15 @@ changes: - version: - v19.0.0 pr-url: https://github.com/nodejs/node/pull/43522 - description: The agent now uses HTTP Keep-Alive by default. + description: The agent now uses HTTP Keep-Alive and a 5 second timeout by + default. --> * {http.Agent} Global instance of `Agent` which is used as the default for all HTTP client -requests. +requests. Diverges from a default `Agent` configuration by having `keepAlive` +enabled and a `timeout` of 5 seconds. ## `http.maxHeaderSize` diff --git a/doc/api/https.md b/doc/api/https.md index 8ae80d28b61654..c3dfe3466643e7 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -327,10 +327,13 @@ changes: - version: - v19.0.0 pr-url: https://github.com/nodejs/node/pull/43522 - description: The agent now uses HTTP Keep-Alive by default. + description: The agent now uses HTTP Keep-Alive and a 5 second timeout by + default. --> -Global instance of [`https.Agent`][] for all HTTPS client requests. +Global instance of [`https.Agent`][] for all HTTPS client requests. Diverges +from a default [`https.Agent`][] configuration by having `keepAlive` enabled and +a `timeout` of 5 seconds. ## `https.request(options[, callback])`