Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b9e372

Browse filesBrowse files
ronagtargos
authored andcommitted
http: follow symbol naming convention
PR-URL: #29091 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 0aa339e commit 6b9e372
Copy full SHA for 6b9e372

File tree

Expand file treeCollapse file tree

7 files changed

+32
-32
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

7 files changed

+32
-32
lines changed
Open diff view settings
Collapse file

‎lib/_http_client.js‎

Copy file name to clipboardExpand all lines: lib/_http_client.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Agent = require('_http_agent');
4040
const { Buffer } = require('buffer');
4141
const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
4242
const { URL, urlToOptions, searchParamsSymbol } = require('internal/url');
43-
const { outHeadersKey, ondrain } = require('internal/http');
43+
const { kOutHeaders, ondrain } = require('internal/http');
4444
const { connResetException, codes } = require('internal/errors');
4545
const {
4646
ERR_HTTP_HEADERS_SENT,
@@ -253,7 +253,7 @@ function ClientRequest(input, options, cb) {
253253
}
254254

255255
this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
256-
this[outHeadersKey]);
256+
this[kOutHeaders]);
257257
}
258258
} else {
259259
this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
@@ -308,7 +308,7 @@ ClientRequest.prototype._implicitHeader = function _implicitHeader() {
308308
throw new ERR_HTTP_HEADERS_SENT('render');
309309
}
310310
this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
311-
this[outHeadersKey]);
311+
this[kOutHeaders]);
312312
};
313313

314314
ClientRequest.prototype.abort = function abort() {
Collapse file

‎lib/_http_outgoing.js‎

Copy file name to clipboardExpand all lines: lib/_http_outgoing.js
+17-17Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const { getDefaultHighWaterMark } = require('internal/streams/state');
2727
const assert = require('internal/assert');
2828
const Stream = require('stream');
2929
const internalUtil = require('internal/util');
30-
const { outHeadersKey, utcDate } = require('internal/http');
30+
const { kOutHeaders, utcDate } = require('internal/http');
3131
const { Buffer } = require('buffer');
3232
const common = require('_http_common');
3333
const checkIsHttpToken = common._checkIsHttpToken;
@@ -104,7 +104,7 @@ function OutgoingMessage() {
104104
this.socket = null;
105105
this.connection = null;
106106
this._header = null;
107-
this[outHeadersKey] = null;
107+
this[kOutHeaders] = null;
108108

109109
this._onPendingData = noopPendingOutput;
110110
}
@@ -145,9 +145,9 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', {
145145
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
146146
set: internalUtil.deprecate(function(val) {
147147
if (val == null) {
148-
this[outHeadersKey] = null;
148+
this[kOutHeaders] = null;
149149
} else if (typeof val === 'object') {
150-
const headers = this[outHeadersKey] = Object.create(null);
150+
const headers = this[kOutHeaders] = Object.create(null);
151151
const keys = Object.keys(val);
152152
for (var i = 0; i < keys.length; ++i) {
153153
const name = keys[i];
@@ -159,7 +159,7 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', {
159159

160160
Object.defineProperty(OutgoingMessage.prototype, '_headerNames', {
161161
get: internalUtil.deprecate(function() {
162-
const headers = this[outHeadersKey];
162+
const headers = this[kOutHeaders];
163163
if (headers !== null) {
164164
const out = Object.create(null);
165165
const keys = Object.keys(headers);
@@ -174,7 +174,7 @@ Object.defineProperty(OutgoingMessage.prototype, '_headerNames', {
174174
}, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
175175
set: internalUtil.deprecate(function(val) {
176176
if (typeof val === 'object' && val !== null) {
177-
const headers = this[outHeadersKey];
177+
const headers = this[kOutHeaders];
178178
if (!headers)
179179
return;
180180
const keys = Object.keys(val);
@@ -193,7 +193,7 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
193193
throw new ERR_HTTP_HEADERS_SENT('render');
194194
}
195195

196-
const headersMap = this[outHeadersKey];
196+
const headersMap = this[kOutHeaders];
197197
const headers = {};
198198

199199
if (headersMap !== null) {
@@ -316,7 +316,7 @@ function _storeHeader(firstLine, headers) {
316316
};
317317

318318
if (headers) {
319-
if (headers === this[outHeadersKey]) {
319+
if (headers === this[kOutHeaders]) {
320320
for (const key in headers) {
321321
const entry = headers[key];
322322
processHeader(this, state, entry[0], entry[1], false);
@@ -486,9 +486,9 @@ OutgoingMessage.prototype.setHeader = function setHeader(name, value) {
486486
validateHeaderName(name);
487487
validateHeaderValue(name, value);
488488

489-
let headers = this[outHeadersKey];
489+
let headers = this[kOutHeaders];
490490
if (headers === null)
491-
this[outHeadersKey] = headers = Object.create(null);
491+
this[kOutHeaders] = headers = Object.create(null);
492492

493493
headers[name.toLowerCase()] = [name, value];
494494
};
@@ -497,7 +497,7 @@ OutgoingMessage.prototype.setHeader = function setHeader(name, value) {
497497
OutgoingMessage.prototype.getHeader = function getHeader(name) {
498498
validateString(name, 'name');
499499

500-
const headers = this[outHeadersKey];
500+
const headers = this[kOutHeaders];
501501
if (headers === null)
502502
return;
503503

@@ -508,13 +508,13 @@ OutgoingMessage.prototype.getHeader = function getHeader(name) {
508508

509509
// Returns an array of the names of the current outgoing headers.
510510
OutgoingMessage.prototype.getHeaderNames = function getHeaderNames() {
511-
return this[outHeadersKey] !== null ? Object.keys(this[outHeadersKey]) : [];
511+
return this[kOutHeaders] !== null ? Object.keys(this[kOutHeaders]) : [];
512512
};
513513

514514

515515
// Returns a shallow copy of the current outgoing headers.
516516
OutgoingMessage.prototype.getHeaders = function getHeaders() {
517-
const headers = this[outHeadersKey];
517+
const headers = this[kOutHeaders];
518518
const ret = Object.create(null);
519519
if (headers) {
520520
const keys = Object.keys(headers);
@@ -530,8 +530,8 @@ OutgoingMessage.prototype.getHeaders = function getHeaders() {
530530

531531
OutgoingMessage.prototype.hasHeader = function hasHeader(name) {
532532
validateString(name, 'name');
533-
return this[outHeadersKey] !== null &&
534-
!!this[outHeadersKey][name.toLowerCase()];
533+
return this[kOutHeaders] !== null &&
534+
!!this[kOutHeaders][name.toLowerCase()];
535535
};
536536

537537

@@ -559,8 +559,8 @@ OutgoingMessage.prototype.removeHeader = function removeHeader(name) {
559559
break;
560560
}
561561

562-
if (this[outHeadersKey] !== null) {
563-
delete this[outHeadersKey][key];
562+
if (this[kOutHeaders] !== null) {
563+
delete this[kOutHeaders][key];
564564
}
565565
};
566566

Collapse file

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const {
4040
} = require('_http_common');
4141
const { OutgoingMessage } = require('_http_outgoing');
4242
const {
43-
outHeadersKey,
43+
kOutHeaders,
4444
ondrain,
4545
nowDate,
4646
emitStatistics
@@ -255,7 +255,7 @@ function writeHead(statusCode, reason, obj) {
255255
this.statusCode = statusCode;
256256

257257
var headers;
258-
if (this[outHeadersKey]) {
258+
if (this[kOutHeaders]) {
259259
// Slow-case: when progressive API and header fields are passed.
260260
var k;
261261
if (obj) {
@@ -269,7 +269,7 @@ function writeHead(statusCode, reason, obj) {
269269
throw new ERR_HTTP_HEADERS_SENT('render');
270270
}
271271
// Only progressive api is used
272-
headers = this[outHeadersKey];
272+
headers = this[kOutHeaders];
273273
} else {
274274
// Only writeHead() called
275275
headers = obj;
Collapse file

‎lib/internal/http.js‎

Copy file name to clipboardExpand all lines: lib/internal/http.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function emitStatistics(statistics) {
4949
}
5050

5151
module.exports = {
52-
outHeadersKey: Symbol('outHeadersKey'),
52+
kOutHeaders: Symbol('kOutHeaders'),
5353
ondrain,
5454
nowDate,
5555
utcDate,
Collapse file

‎test/parallel/test-http-correct-hostname.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-correct-hostname.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common');
66
const assert = require('assert');
77

8-
const { outHeadersKey } = require('internal/http');
8+
const { kOutHeaders } = require('internal/http');
99

1010
const http = require('http');
1111
const modules = { http };
@@ -20,7 +20,7 @@ Object.keys(modules).forEach((module) => {
2020
`${module}.request should not connect to ${module}://example.com%60x.example.com`
2121
);
2222
const req = modules[module].request(`${module}://example.com%60x.example.com`, doNotCall);
23-
assert.deepStrictEqual(req[outHeadersKey].host, [
23+
assert.deepStrictEqual(req[kOutHeaders].host, [
2424
'Host',
2525
'example.com`x.example.com',
2626
]);
Collapse file

‎test/parallel/test-http-outgoing-internal-headers.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-outgoing-internal-headers.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const common = require('../common');
44
const assert = require('assert');
55

6-
const { outHeadersKey } = require('internal/http');
6+
const { kOutHeaders } = require('internal/http');
77
const { OutgoingMessage } = require('http');
88

99
const warn = 'OutgoingMessage.prototype._headers is deprecated';
@@ -25,7 +25,7 @@ common.expectWarning('DeprecationWarning', warn, 'DEP0066');
2525
};
2626

2727
assert.deepStrictEqual(
28-
Object.entries(outgoingMessage[outHeadersKey]),
28+
Object.entries(outgoingMessage[kOutHeaders]),
2929
Object.entries({
3030
host: ['host', 'risingstack.com'],
3131
origin: ['Origin', 'localhost']
Collapse file

‎test/parallel/test-http-outgoing-renderHeaders.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-outgoing-renderHeaders.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const common = require('../common');
55
const assert = require('assert');
66

7-
const outHeadersKey = require('internal/http').outHeadersKey;
7+
const kOutHeaders = require('internal/http').kOutHeaders;
88
const http = require('http');
99
const OutgoingMessage = http.OutgoingMessage;
1010

@@ -23,22 +23,22 @@ const OutgoingMessage = http.OutgoingMessage;
2323

2424
{
2525
const outgoingMessage = new OutgoingMessage();
26-
outgoingMessage[outHeadersKey] = null;
26+
outgoingMessage[kOutHeaders] = null;
2727
const result = outgoingMessage._renderHeaders();
2828
assert.deepStrictEqual(result, {});
2929
}
3030

3131

3232
{
3333
const outgoingMessage = new OutgoingMessage();
34-
outgoingMessage[outHeadersKey] = {};
34+
outgoingMessage[kOutHeaders] = {};
3535
const result = outgoingMessage._renderHeaders();
3636
assert.deepStrictEqual(result, {});
3737
}
3838

3939
{
4040
const outgoingMessage = new OutgoingMessage();
41-
outgoingMessage[outHeadersKey] = {
41+
outgoingMessage[kOutHeaders] = {
4242
host: ['host', 'nodejs.org'],
4343
origin: ['Origin', 'localhost']
4444
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.