From 6f0d1bab6f7cadb32d5f08b70ff1ec2c97a13a21 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Thu, 10 May 2018 11:39:31 -0700 Subject: [PATCH 1/3] Support for the newer node.js API. Since node v7 the old function no longer exists. --- src/_wrapper_shared.js | 5 ++++- src/http.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/_wrapper_shared.js b/src/_wrapper_shared.js index 62a87b7..5b251ea 100644 --- a/src/_wrapper_shared.js +++ b/src/_wrapper_shared.js @@ -156,7 +156,10 @@ function safeConnectionWrapper(fn, wrappingSafeConnect) { wrappingSafeConnect = (wrappingSafeConnect || false); return function safeConnectionWrappedFn() { // eslint-disable-line max-statements - const args = net._normalizeConnectArgs(arguments); + + const normalizeArgs = net._normalizeArgs ? net._normalizeArgs : net._normalizeConnectArgs; + + const args = normalizeArgs(arguments); const options = args[0]; // We smuggled our validator through localAddress diff --git a/src/http.js b/src/http.js index 1ffdd5e..c136669 100644 --- a/src/http.js +++ b/src/http.js @@ -25,7 +25,10 @@ import wrapperShared from './_wrapper_shared'; // Use our custom connection function that won't need a synchronous DNS lookup function safeConnectionFunc() { - const args = net._normalizeConnectArgs(arguments); + + const normalizeArgs = net._normalizeArgs ? net._normalizeArgs : net._normalizeConnectArgs; + const args = normalizeArgs(arguments); + const options = args[0]; const s = new net.Socket(args[0]); const newOptions = util._extend({}, options); From 5dc7da6f70f879a7c4879e8de800b0bf8a74d120 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Thu, 10 May 2018 11:44:26 -0700 Subject: [PATCH 2/3] Testing a later nodejs version. This should demonstrate that the library is currently broken --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index caea208..94b5ec1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,4 @@ language: node_js node_js: - "6.1" - "0.10" + - "lts/*" From 8e949dd3e0ca7ced1c47d1cdb32c0b96a2ee00d0 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Thu, 10 May 2018 11:46:52 -0700 Subject: [PATCH 3/3] Don't test node 0.10. It's pretty old and the tests won't even run. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index caea208..3424eb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ language: node_js node_js: - "6.1" - - "0.10"