Skip to content
Permalink
Browse files

http: http_outgoing rename var to let and const

PR-URL: #30284
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
telenord authored and BridgeAR committed Nov 6, 2019
1 parent a6c2502 commit 4a54f304a73b0768eeb5faa9b9627acf472f6584
Showing with 14 additions and 14 deletions.
  1. +14 −14 lib/_http_outgoing.js
@@ -168,7 +168,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headers', {
const keys = ObjectKeys(val);
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < keys.length; ++i) {
for (let i = 0; i < keys.length; ++i) {
const name = keys[i];
headers[name.toLowerCase()] = [name, val[name]];
}
@@ -193,7 +193,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
const keys = ObjectKeys(headers);
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < keys.length; ++i) {
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
const val = headers[key][0];
out[key] = val;
@@ -210,7 +210,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
const keys = ObjectKeys(val);
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < keys.length; ++i) {
for (let i = 0; i < keys.length; ++i) {
const header = headers[keys[i]];
if (header)
header[0] = val[keys[i]];
@@ -232,7 +232,7 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
const keys = ObjectKeys(headersMap);
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0, l = keys.length; i < l; i++) {
for (let i = 0, l = keys.length; i < l; i++) {
const key = keys[i];
headers[headersMap[key][0]] = headersMap[key][1];
}
@@ -297,7 +297,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) {
(encoding === 'utf8' || encoding === 'latin1' || !encoding)) {
data = this._header + data;
} else {
var header = this._header;
const header = this._header;
if (this.outputData.length === 0) {
this.outputData = [{
data: header,
@@ -468,7 +468,7 @@ function processHeader(self, state, key, value, validate) {
if (value.length < 2 || !isCookieField(key)) {
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < value.length; i++)
for (let i = 0; i < value.length; i++)
storeHeader(self, state, key, value[i], validate);
return;
}
@@ -571,7 +571,7 @@ OutgoingMessage.prototype.getHeaders = function getHeaders() {
const keys = ObjectKeys(headers);
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < keys.length; ++i) {
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
const val = headers[key][1];
ret[key] = val;
@@ -676,8 +676,9 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
process.nextTick(connectionCorkNT, msg.socket);
}

var len, ret;
let ret;
if (msg.chunkedEncoding && chunk.length !== 0) {
let len;
if (typeof chunk === 'string')
len = Buffer.byteLength(chunk, encoding);
else
@@ -711,11 +712,11 @@ OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
this._trailer = '';
const keys = ObjectKeys(headers);
const isArray = ArrayIsArray(headers);
var field, value;
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
for (let i = 0, l = keys.length; i < l; i++) {
let field, value;
const key = keys[i];
if (isArray) {
field = headers[key][0];
value = headers[key][1];
@@ -839,11 +840,10 @@ OutgoingMessage.prototype._finish = function _finish() {
// to attempt to flush any pending messages out to the socket.
OutgoingMessage.prototype._flush = function _flush() {
const socket = this.socket;
var ret;

if (socket && socket.writable) {
// There might be remaining data in this.output; write it out
ret = this._flushOutput(socket);
const ret = this._flushOutput(socket);

if (this.finished) {
// This is a queue to the server or client to bring in the next this.
@@ -870,7 +870,7 @@ OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) {
let ret;
// Retain for(;;) loop for performance reasons
// Refs: https://github.com/nodejs/node/pull/30958
for (var i = 0; i < outputLength; i++) {
for (let i = 0; i < outputLength; i++) {
const { data, encoding, callback } = outputData[i];
ret = socket.write(data, encoding, callback);
}

0 comments on commit 4a54f30

Please sign in to comment.
You can’t perform that action at this time.