http: reuse existing StorageObject
PR-URL: https://github.com/nodejs/node/pull/10941 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
parent
b377034359
commit
8243ca0e0e
@ -20,10 +20,6 @@ var RE_FIELDS = new RegExp('^(?:Connection|Transfer-Encoding|Content-Length|' +
|
|||||||
var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
|
var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
|
||||||
var RE_TE_CHUNKED = common.chunkExpression;
|
var RE_TE_CHUNKED = common.chunkExpression;
|
||||||
|
|
||||||
// Used to store headers returned by getHeaders()
|
|
||||||
function OutgoingHeaders() {}
|
|
||||||
OutgoingHeaders.prototype = Object.create(null);
|
|
||||||
|
|
||||||
var dateCache;
|
var dateCache;
|
||||||
function utcDate() {
|
function utcDate() {
|
||||||
if (!dateCache) {
|
if (!dateCache) {
|
||||||
@ -510,7 +506,7 @@ OutgoingMessage.prototype.getHeaderNames = function getHeaderNames() {
|
|||||||
// Returns a shallow copy of the current outgoing headers.
|
// Returns a shallow copy of the current outgoing headers.
|
||||||
OutgoingMessage.prototype.getHeaders = function getHeaders() {
|
OutgoingMessage.prototype.getHeaders = function getHeaders() {
|
||||||
const headers = this[outHeadersKey];
|
const headers = this[outHeadersKey];
|
||||||
const ret = new OutgoingHeaders();
|
const ret = new StorageObject();
|
||||||
if (headers) {
|
if (headers) {
|
||||||
const keys = Object.keys(headers);
|
const keys = Object.keys(headers);
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user