diff --git a/lib/_http_client.js b/lib/_http_client.js index f293e3e6486f72..e2049da5725df7 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -46,7 +46,6 @@ const assert = require('internal/assert'); const { once } = require('internal/util'); const { _checkIsHttpToken: checkIsHttpToken, - debug, freeParser, parsers, HTTPParser, @@ -78,6 +77,10 @@ const { const { addAbortSignal, finished } = require('stream'); +let debug = require('internal/util/debuglog').debuglog('http', (fn) => { + debug = fn; +}); + const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/; const kError = Symbol('kError'); diff --git a/lib/_http_common.js b/lib/_http_common.js index 0d4bdcff05f56b..229353ec735288 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -269,7 +269,6 @@ module.exports = { chunkExpression: /(?:^|\W)chunked(?:$|\W)/i, continueExpression: /(?:^|\W)100-continue(?:$|\W)/i, CRLF: '\r\n', - debug, freeParser, methods, parsers, diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 74e011d0ca9b21..70acdffbee91ca 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -81,8 +81,12 @@ const { validateString } = require('internal/validators'); const { isUint8Array } = require('internal/util/types'); const { construct, destroy } = require('internal/streams/destroy'); +let debug = require('internal/util/debuglog').debuglog('http', (fn) => { + debug = fn; +}); + const HIGH_WATER_MARK = getDefaultHighWaterMark(); -const { CRLF, debug } = common; +const { CRLF } = common; const kCorked = Symbol('kCorked'); diff --git a/lib/_http_server.js b/lib/_http_server.js index ff6ad0b1897deb..59d6845d15edbb 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -45,7 +45,6 @@ const assert = require('internal/assert'); const { parsers, freeParser, - debug, CRLF, continueExpression, chunkExpression, @@ -90,6 +89,10 @@ const { } = require('internal/dtrace'); const { setTimeout, clearTimeout } = require('timers'); +let debug = require('internal/util/debuglog').debuglog('http', (fn) => { + debug = fn; +}); + const dc = require('diagnostics_channel'); const onRequestStartChannel = dc.channel('http.server.request.start'); const onResponseFinishChannel = dc.channel('http.server.response.finish');