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
  • Loading branch information
rexagod committed May 2, 2020
1 parent e951825 commit 1fce18c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {};
Expand Down

0 comments on commit 1fce18c

Please sign in to comment.