Skip to content

Commit

Permalink
http: destructure primordials in lib/_http_server.js
Browse files Browse the repository at this point in the history
PR-URL: #30315
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
artmaks authored and addaleax committed Nov 30, 2019
1 parent 3b169f1 commit 8256d38
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

'use strict';

const { Object } = primordials;
const {
Object: {
setPrototypeOf: ObjectSetPrototypeOf,
keys: ObjectKeys,
}
} = primordials;

const net = require('net');
const assert = require('internal/assert');
Expand Down Expand Up @@ -162,8 +167,8 @@ function ServerResponse(req) {
};
}
}
Object.setPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype);
Object.setPrototypeOf(ServerResponse, OutgoingMessage);
ObjectSetPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype);
ObjectSetPrototypeOf(ServerResponse, OutgoingMessage);

ServerResponse.prototype._finish = function _finish() {
DTRACE_HTTP_SERVER_RESPONSE(this.socket);
Expand Down Expand Up @@ -254,8 +259,8 @@ function writeHead(statusCode, reason, obj) {
// Slow-case: when progressive API and header fields are passed.
let k;
if (obj) {
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const keys = ObjectKeys(obj);
for (var i = 0; i < keys.length; i++) {
k = keys[i];
if (k) this.setHeader(k, obj[k]);
}
Expand Down Expand Up @@ -337,8 +342,8 @@ function Server(options, requestListener) {
this.maxHeadersCount = null;
this.headersTimeout = 40 * 1000; // 40 seconds
}
Object.setPrototypeOf(Server.prototype, net.Server.prototype);
Object.setPrototypeOf(Server, net.Server);
ObjectSetPrototypeOf(Server.prototype, net.Server.prototype);
ObjectSetPrototypeOf(Server, net.Server);


Server.prototype.setTimeout = function setTimeout(msecs, callback) {
Expand Down

0 comments on commit 8256d38

Please sign in to comment.