From e2dc13f45eead5aa405fec424c7369d8bfcb52b5 Mon Sep 17 00:00:00 2001 From: Yaroslav Chuhai Date: Sat, 21 Nov 2026 16:14:34 +0100 Subject: [PATCH] url: keep urlToHttpOptions() result in fast mode urlToHttpOptions() built its result with `__proto__: null` ahead of a spread, which makes V8 create the object in dictionary mode. Every http.request() and https.request() called with a string or URL goes through it, and ClientRequest immediately copies the result, so both the property stores and the copy took the slow path. Use `__proto__: kEmptyObject` instead, as ClientRequest already does for its option copies. The object stays in fast mode and still inherits nothing. Signed-off-by: Yaroslav Chuhai --- lib/internal/url.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index 95a43b1c53a7..9f36748df55c 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1475,7 +1475,7 @@ function urlToHttpOptions(url) { validateObject(url, 'url', kValidateObjectAllowObjects); const { hostname, pathname, port, username, password, search } = url; const options = { - __proto__: null, + __proto__: kEmptyObject, // Only spread own enumerable properties for genuine WHATWG URL instances so // that a URL object can still be extended with additional request options // (e.g. `url.headers = ...`). Arbitrary duck-typed objects accepted by