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 7, 2020
1 parent 4776746 commit 5da952f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
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 5da952f

Please sign in to comment.