Skip to content

Commit

Permalink
http2: comment on usage of Object.create(null)
Browse files Browse the repository at this point in the history
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 codebytere committed Jun 9, 2020
1 parent 5eed20b commit fa4a37c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/http2/compat.js
Expand Up @@ -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] = {};
Expand Down

0 comments on commit fa4a37c

Please sign in to comment.