diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 3c488c7f05f976..353fa44f7eee75 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -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. diff --git a/lib/_http_common.js b/lib/_http_common.js index a83c82c9d4b292..bf885161571be1 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -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; diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 60ed6779c47979..d6e830e3f35770 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -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'); @@ -109,10 +108,10 @@ Object.setPrototypeOf(OutgoingMessage, Stream); Object.defineProperty(OutgoingMessage.prototype, '_headers', { - get: util.deprecate(function() { + get: internalUtil.deprecate(function() { return this.getHeaders(); }, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'), - set: util.deprecate(function(val) { + set: internalUtil.deprecate(function(val) { if (val == null) { this[outHeadersKey] = null; } else if (typeof val === 'object') { @@ -127,7 +126,7 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', { }); Object.defineProperty(OutgoingMessage.prototype, '_headerNames', { - get: util.deprecate(function() { + get: internalUtil.deprecate(function() { const headers = this[outHeadersKey]; if (headers !== null) { const out = Object.create(null); @@ -141,7 +140,7 @@ Object.defineProperty(OutgoingMessage.prototype, '_headerNames', { } return null; }, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'), - set: util.deprecate(function(val) { + set: internalUtil.deprecate(function(val) { if (typeof val === 'object' && val !== null) { const headers = this[outHeadersKey]; if (!headers) diff --git a/lib/_http_server.js b/lib/_http_server.js index 44af558b55f063..95f08fa5d6ace9 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -21,7 +21,6 @@ 'use strict'; -const util = require('util'); const net = require('net'); const assert = require('internal/assert'); const { @@ -310,7 +309,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) {