From 1fce18cfe972f1580e41289788efc22c4a25725f Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 25 Apr 2020 16:46:10 +0530 Subject: [PATCH 1/4] http2: comment on usage of `Object.create(null)` Refs: https://github.com/nodejs/node/issues/29829 --- lib/internal/http2/compat.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 3abe9ba2ac6f82..14c8083ee66161 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -287,6 +287,10 @@ class Http2ServerRequest extends Readable { closed: false, didRead: false, }; + // headers in HTTP/1 are not initialized using Object.create(null) + // which, although preferable, simply breaks too much code. + // Ergo, header initialization using Object.create(null) in HTTP/2 + // is intentional. this[kHeaders] = headers; this[kRawHeaders] = rawHeaders; this[kTrailers] = {}; From 9870173f6c99459808ce6f6d66bca4a38b675047 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 2 May 2020 11:46:41 +0530 Subject: [PATCH 2/4] nit --- lib/internal/http2/compat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 14c8083ee66161..a2d55474bddfe9 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -288,7 +288,7 @@ class Http2ServerRequest extends Readable { didRead: false, }; // headers in HTTP/1 are not initialized using Object.create(null) - // which, although preferable, simply breaks too much code. + // which, although preferable, would simply break too much code. // Ergo, header initialization using Object.create(null) in HTTP/2 // is intentional. this[kHeaders] = headers; From e617dd23edc6d1bcaad71c19806c3c3812987bd7 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 9 May 2020 18:06:32 +0530 Subject: [PATCH 3/4] fixup: lint error --- lib/internal/http2/compat.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index a2d55474bddfe9..f68bc2e498a5e0 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -287,10 +287,9 @@ class Http2ServerRequest extends Readable { closed: false, didRead: false, }; - // headers in HTTP/1 are not initialized using Object.create(null) - // which, although preferable, would simply break too much code. - // Ergo, header initialization using Object.create(null) in HTTP/2 - // is intentional. + // headers in HTTP/1 are not initialized using Object.create(null) which, + // although preferable, would simply break too much code. Ergo header + // initialization using Object.create(null) in HTTP/2 is intentional. this[kHeaders] = headers; this[kRawHeaders] = rawHeaders; this[kTrailers] = {}; From cacf9cd36f2fe8b168ed0eb5ea9d225f88877f81 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 9 May 2020 18:10:49 +0530 Subject: [PATCH 4/4] fixup: lint error --- lib/internal/http2/compat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index f68bc2e498a5e0..851fec4b3a6ae5 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -287,7 +287,7 @@ class Http2ServerRequest extends Readable { closed: false, didRead: false, }; - // headers in HTTP/1 are not initialized using Object.create(null) which, + // Headers in HTTP/1 are not initialized using Object.create(null) which, // although preferable, would simply break too much code. Ergo header // initialization using Object.create(null) in HTTP/2 is intentional. this[kHeaders] = headers;