Skip to content
Permalink
Browse files
http2: comment on usage of Object.create(null)
Refs: #29829

PR-URL: #33183
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
rexagod authored and targos committed Jun 2, 2020
1 parent 7817b87 commit c972ce200e1fd7519e65bbcb978392d517871b5e
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/internal/http2/compat.js
@@ -287,6 +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.
this[kHeaders] = headers;
this[kRawHeaders] = rawHeaders;
this[kTrailers] = {};

0 comments on commit c972ce2

Please sign in to comment.