ikeyan
cdb12ccbc6
doc: document ALPNCallback option for TLSSocket constructor
...
PR-URL: https://github.com/nodejs/node/pull/61331
Reviewed-By: Aviv Keller <me@aviv.sh >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 08:38:54 +01:00
Livia Medeiros
461c5e65c5
doc: update MDN links
...
PR-URL: https://github.com/nodejs/node/pull/61062
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2026-02-24 08:38:53 +01:00
Alireza Ebrahimkhani
dde45baeab
doc: add documentation for process.traceProcessWarnings
...
resolves #53514
PR-URL: https://github.com/nodejs/node/pull/53641
Reviewed-By: Aviv Keller <me@aviv.sh >
2026-02-24 08:38:47 +01:00
fisker Cheung
8e04327954
worker: update code examples for node:worker_threads module
...
PR-URL: https://github.com/nodejs/node/pull/58264
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2026-02-24 00:37:14 +01:00
mag123c
71dd46bd0c
doc: add reusePort error behavior to net module
...
PR-URL: https://github.com/nodejs/node/pull/61250
Fixes: https://github.com/nodejs/node/issues/61018
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:37:13 +01:00
Azad Gupta
9059d49d8c
doc: fix tls.connect() timeout documentation
...
PR-URL: https://github.com/nodejs/node/pull/61079
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:37:12 +01:00
Xavier Stouder and SimonSchick
e7b34b76b0
doc: missing passed, error and passed properties on TestContext
...
`passed` and `error` properties were left undocumented on `TextContext`
class
Fixes: https://github.com/nodejs/node/issues/59321
Refs: https://github.com/nodejs/node/pull/51485
Refs: https://github.com/nodejs/node/pull/59322
Co-authored-by: SimonSchick <demwizzy@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/61185
Reviewed-By: Aviv Keller <me@aviv.sh >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2026-02-24 00:37:11 +01:00
Xavier Stouder
9902331a7c
doc: correct options for net.Socket class and socket.connect
...
blockList, keepAlive, keepAliveInitialDelay and noDelay are wrongly
documented for socket.connect options and missing on net.Socket
constructor options documentation
Fixes: https://github.com/nodejs/node/issues/59823
PR-URL: https://github.com/nodejs/node/pull/61179
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2026-02-24 00:37:11 +01:00
Xavier Stouder
a80122d2fe
doc: document error event on readline InterfaceConstructor
...
Aims to document the error event introduced by cb3020d in v16.0.0.
Fixes: https://github.com/nodejs/node/issues/58289
PR-URL: https://github.com/nodejs/node/pull/61170
Fixes: https://github.com/nodejs/node/issues/61037
Reviewed-By: Aviv Keller <me@aviv.sh >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2026-02-24 00:37:10 +01:00
Joyee Cheung
6063d888fe
cli: mark --heapsnapshot-near-heap-limit as stable
...
This has not changed in the past 5 years and has been passing the tests
for 5 years. Mark it as stable.
PR-URL: https://github.com/nodejs/node/pull/60956
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:37:04 +01:00
Mohit Raj Saxena
4932322c29
doc: add File modes cross-references in fs methods
...
Adds links to the File modes section from fsPromises.open(),
fsPromises.mkdir(), and fs.mkdir() to improve discoverability
of file permission documentation.
PR-URL: https://github.com/nodejs/node/pull/60286
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2026-02-24 00:37:04 +01:00
Chengzhong Wu
f75ec19105
util: assert getCallSites does not invoke Error.prepareStackTrace
...
PR-URL: https://github.com/nodejs/node/pull/60922
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com >
2026-02-24 00:37:04 +01:00
Deokjin Kim
c84904e047
doc: add missing zstd to mjs example of zlib
...
cjs example already has `zstd` as compression encoding.
Refs: https://github.com/nodejs/node/pull/52100
PR-URL: https://github.com/nodejs/node/pull/60915
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2026-02-24 00:37:03 +01:00
Rafael Gonzaga
e615b9e2f2
doc: clarify fileURLToPath security considerations
...
Add clarification that fileURLToPath() decodes encoded
dot-segments (%2e%2e) which are normalized as path traversal.
Applications must perform their own path validation to
prevent directory traversal attacks.
Also applies to fileURLToPathBuffer().
PR-URL: https://github.com/nodejs/node/pull/60887
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-02-24 00:37:02 +01:00
Deokjin Kim
99e384e6d4
doc: replace column with columnNumber in example of util.getCallSites
...
`column` is deprecated in favor of `columnNumber`.
Refs: https://github.com/nodejs/node/pull/56584
PR-URL: https://github.com/nodejs/node/pull/60881
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:37:01 +01:00
xiaoyao
e1f6e7fc4d
doc: update debuglog examples to use 'foo-bar' instead of 'foo'
...
PR-URL: https://github.com/nodejs/node/pull/60867
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2026-02-24 00:37:01 +01:00
Chengzhong Wu
1cb2fe8b35
doc: mark module.register as active development
...
PR-URL: https://github.com/nodejs/node/pull/60849
Refs: https://github.com/nodejs/node/pull/60302
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2026-02-24 00:37:00 +01:00
PaulyBearCoding
ceeb4968a6
doc: add fullName property to SuiteContext
...
Add documentation for the missing fullName property in SuiteContext.
This property returns the name of the suite and each of its ancestors,
separated by '>'.
The property has been available since v22.3.0 but was missing from the
documentation.
Fixes: https://github.com/nodejs/node/issues/60757
PR-URL: https://github.com/nodejs/node/pull/60762
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2026-02-24 00:37:00 +01:00
Azad Gupta
6b637763d5
doc: correct concurrency wording in test() documentation
...
PR-URL: https://github.com/nodejs/node/pull/60773
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Xuguang Mei <meixuguang@gmail.com >
2026-02-24 00:36:59 +01:00
René
e0210c8f53
doc: correct tls ALPNProtocols types
...
PR-URL: https://github.com/nodejs/node/pull/60143
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2026-02-24 00:36:56 +01:00
René
e77ef94a51
doc: domain.add() does not accept timer objects
...
PR-URL: https://github.com/nodejs/node/pull/60675
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Xuguang Mei <meixuguang@gmail.com >
2026-02-24 00:36:55 +01:00
Antoine du Hamel
eece59b6ce
doc: fix linter issues
...
PR-URL: https://github.com/nodejs/node/pull/60636
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2026-02-24 00:36:43 +01:00
René
6e17e596e4
doc: correct values/references for buffer.kMaxLength
...
PR-URL: https://github.com/nodejs/node/pull/60305
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:36:42 +01:00
Dan Fabulich
ac327ae9a7
doc: recommend events.once to manage 'close' event
...
`events.once` is a great way to manage the `close` / `error` / `exit`
events of a child process. It creates a Promise that is fulfilled when
the EventEmitter emits the given event or that is rejected if the
EventEmitter emits 'error' while waiting.
I think a lot of people wrongly think that managing a spawned child
process requires writing boilerplate handlers for `close` and `error`,
and that there's no `promisify` solution for spawned child processes. In
fact, `events.once` is that solution. The docs should explicitly
recommend it in examples.
PR-URL: https://github.com/nodejs/node/pull/60017
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2026-02-24 00:36:42 +01:00
Ajay A
d9b149ea42
doc: highlight module loading difference between import and require
...
PR-URL: https://github.com/nodejs/node/pull/59815
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2026-02-24 00:36:42 +01:00
우혁
f6d62cb22c
doc: fix typo in process.unref documentation
...
PR-URL: https://github.com/nodejs/node/pull/59698
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:36:42 +01:00
JaeHo Jang
b0a5820dea
doc: improve agent.createConnection docs for http and https agents
...
PR-URL: https://github.com/nodejs/node/pull/58205
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-02-24 00:36:42 +01:00
chirsz
b5db02fe67
doc: fix pseudo code in modules.md
...
This problem was introduced in PR #38837 .
PR-URL: https://github.com/nodejs/node/pull/57677
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-02-24 00:36:42 +01:00
Koushil Mankali
e9b912d481
doc: add missing variable in code snippet
...
`node:http`' `request.reusedSocket` documentation sample code was
referencing an undeclared `agent` identifier.
PR-URL: https://github.com/nodejs/node/pull/55478
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:36:41 +01:00
Konstantin Tsabolov
44c06c7812
doc: add missing word in single-executable-applications.md
...
PR-URL: https://github.com/nodejs/node/pull/53864
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2026-02-24 00:36:41 +01:00
Michael Solomon
482b43f160
doc: fix typo in http.md
...
PR-URL: https://github.com/nodejs/node/pull/59354
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: theanarkh <theratliter@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-02-24 00:36:30 +01:00
dynst
04b8c4d14e
doc: clarify require(esm) description
...
PR-URL: https://github.com/nodejs/node/pull/60520
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2026-02-24 00:36:28 +01:00
Donghoon Nam
de382dc832
doc: instantiate resolver object
...
PR-URL: https://github.com/nodejs/node/pull/60476
Fixes: https://github.com/nodejs/node/issues/60455
Refs: https://nodejs.org/api/stream.html#readabletoarrayoptions
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:36:28 +01:00
Darshan Sen
d8ac368363
http2: add diagnostics channels for client stream request body
...
These would allow inspection of HTTP/2 client stream request bodies.
Signed-off-by: Darshan Sen <raisinten@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/60480
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2026-02-24 00:36:28 +01:00
Joyee Cheung
b6845ce460
doc: clarify --use-system-ca support status
...
Node.js only checks trust settings of additional certificates
from the system store.
It does not, however, support revocation/distrust of existing
certificates.
PR-URL: https://github.com/nodejs/node/pull/60340
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-24 00:36:26 +01:00
Jimmy Leung
0894dae9bc
doc: add missing CAA type to dns.resolveAny() & dnsPromises.resolveAny()
...
The AnyTraits::Parse() method in cares_wrap.cc will "Parse CAA records"
as the code comment suggests. The tables in doc should indicate this as
well.
PR-URL: https://github.com/nodejs/node/pull/58899
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-19 18:46:21 +01:00
Gerhard Stöbich
deb6d5deff
doc, module: change async customization hooks to experimental
...
There is ongoing work to replace async customization hooks by a
synchronous variant.
As a result bugs/design flaws or the async variant (thread leak,
overhead) are not addressed.
Adapt stability index to avoid wrong assumptions they might move to
stable.
Refs: https://github.com/nodejs/loaders/issues/201
Refs: https://github.com/nodejs/loaders/pull/198
PR-URL: https://github.com/nodejs/node/pull/60302
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2026-02-19 18:46:21 +01:00
Jonas Geiler
c86a69f692
doc: use any for worker_threads.Worker 'error' event argument err
...
A worker thread can throw anything via the `throw` keyword, which gets
passed directly to 'error' event listeners. The event listener should
not assume it is an `Error` object.
PR-URL: https://github.com/nodejs/node/pull/60300
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2026-02-19 18:46:03 +01:00
Muhammad Salman Aziz
0c5031e233
doc: update decorator documentation to reflect actual policy
...
- Remove misleading 'soon' language
- Remove 'temporary limitation' claim
- Clarify that Node.js will not provide polyfills
- Wait for native JavaScript engine support
Refs: https://github.com/nodejs/node/issues/60282
PR-URL: https://github.com/nodejs/node/pull/60288
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Richard Lau <richard.lau@ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2026-02-19 18:46:02 +01:00
Joyee Cheung
3f98b46716
vm: make vm.Module.evaluate() conditionally synchronous
...
- Make sure that the vm.Module.evaluate() method is conditionally
synchronous based on the specification. Previously, the returned
promise is unconditionally pending (even for synthetic modules and
source text modules without top-level await) instead of immediately
fulfilled, making it harder to debug as it deviates from the
specified behavior.
- Clarify the synchronicity of this method in the documentation
- Add more tests for the synchronicity of this method.
PR-URL: https://github.com/nodejs/node/pull/60205
Refs: https://github.com/nodejs/node/issues/59656
Refs: https://github.com/nodejs/node/issues/37648
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2026-02-19 18:46:01 +01:00
XTY
b4524dabcc
doc: fix blob.bytes() heading level
...
PR-URL: https://github.com/nodejs/node/pull/60252
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-19 18:45:55 +01:00
Artur Gawlik
5df02776e3
doc: fix not working code example in vm docs
...
PR-URL: https://github.com/nodejs/node/pull/60224
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2026-02-17 19:16:42 +01:00
Steven
6a4359a0b5
doc: improve code snippet alternative of url.parse() using WHATWG URL
...
PR-URL: https://github.com/nodejs/node/pull/60209
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-02-17 19:16:42 +01:00
René
de345ea3a3
doc: correct description of error.stack accessor behavior
...
PR-URL: https://github.com/nodejs/node/pull/61090
Refs: https://github.com/nodejs/node/issues/60862
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2026-02-17 15:39:30 +01:00
N. Bighetti
d8418d9de7
doc: fix link in --env-file=file section
...
PR-URL: https://github.com/nodejs/node/pull/60563
Fixes: https://github.com/nodejs/node/issues/60562
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2026-02-17 15:09:14 +01:00
Antoine du Hamel
c659add7d1
doc,src,lib: clarify experimental status of Web Storage support
...
PR-URL: https://github.com/nodejs/node/pull/60708
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2026-01-13 14:34:37 +01:00
Antoine du Hamel
42aab9469a
doc: add missing history entry for sqlite.md
...
PR-URL: https://github.com/nodejs/node/pull/60607
Fixes: https://github.com/nodejs/node/issues/60601
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2026-01-13 14:34:36 +01:00
Antoine du Hamel
54b94e13de
2025-10-20, Version 22.21.0 'Jod' (LTS)
...
Notable changes:
cli:
* (SEMVER-MINOR) add `--use-env-proxy` (Joyee Cheung) https://github.com/nodejs/node/pull/59151
http:
* (SEMVER-MINOR) support http proxy for fetch under `NODE_USE_ENV_PROXY` (Joyee Cheung) https://github.com/nodejs/node/pull/57165
* (SEMVER-MINOR) add `shouldUpgradeCallback` to let servers control HTTP upgrades (Tim Perry) https://github.com/nodejs/node/pull/59824
http,https:
* (SEMVER-MINOR) add built-in proxy support in `http`/`https.request` and `Agent` (Joyee Cheung) https://github.com/nodejs/node/pull/58980
src:
* (SEMVER-MINOR) add percentage support to `--max-old-space-size` (Asaf Federman) https://github.com/nodejs/node/pull/59082
PR-URL: https://github.com/nodejs/node/pull/60230
2025-10-19 00:35:43 +02:00
Joyee Cheung
1486fedea1
cli: add --use-env-proxy
...
This does the same as NODE_USE_ENV_PROXY. When both are set,
like other options that can be configured from both sides,
the CLI flag takes precedence.
PR-URL: https://github.com/nodejs/node/pull/59151
Fixes: https://github.com/nodejs/node/issues/59100
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2025-10-18 20:35:56 +02:00
Joyee Cheung
42102594b1
http,https: add built-in proxy support in http/https.request and Agent
...
This patch implements proxy support for HTTP and HTTPS clients and
agents in the `http` and `https` built-ins`. When NODE_USE_ENV_PROXY
is set to 1, the default global agent would parse the
HTTP_PROXY/http_proxy, HTTPS_PROXY/https_proxy, NO_PROXY/no_proxy
settings from the environment variables, and proxy the requests
sent through the built-in http/https client accordingly.
To support this, `http.Agent` and `https.Agent` now accept a few new
options:
- `proxyEnv`: when it's an object, the agent would read and parse
the HTTP_PROXY/http_proxy, HTTPS_PROXY/https_proxy, NO_PROXY/no_proxy
properties from it, and apply them based on the protocol it uses
to send requests. This option allows custom agents to
reuse built-in proxy support by composing options. Global agents
set this to `process.env` when NODE_USE_ENV_PROXY is 1.
- `defaultPort` and `protocol`: these allow setting of the default port
and protocol of the agents. We also need these when configuring
proxy settings and deciding whether a request should be proxied.
Implementation-wise, this adds a `ProxyConfig` internal class to handle
parsing and application of proxy configurations. The configuration
is parsed during agent construction. When requests are made,
the `createConnection()` methods on the agents would check whether
the request should be proxied. If yes, they either connect to the
proxy server (in the case of HTTP reqeusts) or establish a tunnel
(in the case of HTTPS requests) through either a TCP socket (if the
proxy uses HTTP) or a TLS socket (if the proxy uses HTTPS).
When proxying HTTPS requests through a tunnel, the connection listener
is invoked after the tunnel is established. Tunnel establishment uses
the timeout of the request options, if there is one. Otherwise it uses
the timeout of the agent.
If an error is encountered during tunnel establishment, an
ERR_PROXY_TUNNEL would be emitted on the returned socket. If the proxy
server sends a errored status code, the error would contain an
`statusCode` property. If the error is caused by timeout, the error
would contain a `proxyTunnelTimeout` property.
This implementation honors the built-in socket pool and socket limits.
Pooled sockets are still keyed by request endpoints, they are just
connected to the proxy server instead, and the persistence of the
connection can be maintained as long as the proxy server respects
connection/proxy-connection or persist by default (HTTP/1.1)
PR-URL: https://github.com/nodejs/node/pull/58980
Refs: https://github.com/nodejs/node/issues/57872
Refs: https://github.com/nodejs/node/issues/8381
Refs: https://github.com/nodejs/node/issues/15620
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2025-10-18 12:07:57 +02:00