http: use Symbol for outgoing headers

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:
Brian White committed 2017-03-09 05:50:22 -05:00
1 parent 86996c5838
commit 940b5303be
5 files changed
+26 -16

No files matched your search

+3 -2
View File
@@ -13,6 +13,7 @@ const continueExpression = common.continueExpression;
const chunkExpression = common.chunkExpression;
const httpSocketSetup = common.httpSocketSetup;
const OutgoingMessage = require('_http_outgoing').OutgoingMessage;
const outHeadersKey = require('internal/http').outHeadersKey;
const STATUS_CODES = exports.STATUS_CODES = {
100: 'Continue',
@@ -179,7 +180,7 @@ function writeHead(statusCode, reason, obj) {
this.statusCode = statusCode;
var headers;
if (this._headers) {
if (this[outHeadersKey]) {
// Slow-case: when progressive API and header fields are passed.
var k;
if (obj) {
@@ -196,7 +197,7 @@ function writeHead(statusCode, reason, obj) {
}
}
// only progressive api is used
headers = this._headers;
headers = this[outHeadersKey];
} else {
// only writeHead() called
headers = obj;