Skip to content

Commit

Permalink
http: reduce usage of public util
Browse files Browse the repository at this point in the history
PR-URL: nodejs#26548
Refs: nodejs#26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
ZYSzys authored and refack committed Mar 14, 2019
1 parent b581bb0 commit cd77811
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
'use strict';

const net = require('net');
const util = require('util');
const EventEmitter = require('events');
const debug = util.debuglog('http');
const debug = require('internal/util/debuglog').debuglog('http');
const { async_id_symbol } = require('internal/async_hooks').symbols;

// New Agent code.
Expand Down Expand Up @@ -106,7 +105,8 @@ function Agent(options) {
});
}

util.inherits(Agent, EventEmitter);
Object.setPrototypeOf(Agent.prototype, EventEmitter.prototype);
Object.setPrototypeOf(Agent, EventEmitter);

Agent.defaultMaxSockets = Infinity;

Expand Down
2 changes: 1 addition & 1 deletion lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {
readStop
} = incoming;

const debug = require('util').debuglog('http');
const debug = require('internal/util/debuglog').debuglog('http');

const kIncomingMessage = Symbol('IncomingMessage');
const kOnHeaders = HTTPParser.kOnHeaders | 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

const assert = require('internal/assert');
const Stream = require('stream');
const util = require('util');
const internalUtil = require('internal/util');
const { outHeadersKey, utcDate } = require('internal/http');
const { Buffer } = require('buffer');
Expand Down Expand Up @@ -104,7 +103,8 @@ function OutgoingMessage() {

this._onPendingData = noopPendingOutput;
}
util.inherits(OutgoingMessage, Stream);
Object.setPrototypeOf(OutgoingMessage.prototype, Stream.prototype);
Object.setPrototypeOf(OutgoingMessage, Stream);


Object.defineProperty(OutgoingMessage.prototype, '_headers', {
Expand Down
7 changes: 4 additions & 3 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

'use strict';

const util = require('util');
const net = require('net');
const assert = require('internal/assert');
const {
Expand Down Expand Up @@ -136,7 +135,8 @@ function ServerResponse(req) {
this.shouldKeepAlive = false;
}
}
util.inherits(ServerResponse, OutgoingMessage);
Object.setPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype);
Object.setPrototypeOf(ServerResponse, OutgoingMessage);

ServerResponse.prototype._finish = function _finish() {
DTRACE_HTTP_SERVER_RESPONSE(this.connection);
Expand Down Expand Up @@ -306,7 +306,8 @@ function Server(options, requestListener) {
this.maxHeadersCount = null;
this.headersTimeout = 40 * 1000; // 40 seconds
}
util.inherits(Server, net.Server);
Object.setPrototypeOf(Server.prototype, net.Server.prototype);
Object.setPrototypeOf(Server, net.Server);


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

0 comments on commit cd77811

Please sign in to comment.