From a5fd42da33e4bd966c8308d219afce85428f84a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=B6=9B?= Date: Tue, 25 Dec 2018 16:39:57 +0800 Subject: [PATCH 1/3] fix ECONNRESET error on node 10+ --- lib/requestHandler.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 7f664c870..0a7679032 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -527,6 +527,10 @@ function getConnectReqHandler(userRule, recorder, httpsServerMgr) { let resourceInfoId = -1; const requestStream = new CommonReadableStream(); + cltSocket.on('error', (e) => { + console.error(e) + }) + /* 1. write HTTP/1.1 200 to client 2. get request data From ba45e4f6674bc5a085ce5ee7a77a1cc9907ecaa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=B6=9B?= Date: Tue, 25 Dec 2018 16:59:47 +0800 Subject: [PATCH 2/3] just reject not show error message --- lib/requestHandler.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 0a7679032..0da2275fa 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -527,10 +527,6 @@ function getConnectReqHandler(userRule, recorder, httpsServerMgr) { let resourceInfoId = -1; const requestStream = new CommonReadableStream(); - cltSocket.on('error', (e) => { - console.error(e) - }) - /* 1. write HTTP/1.1 200 to client 2. get request data @@ -584,6 +580,7 @@ function getConnectReqHandler(userRule, recorder, httpsServerMgr) { resolve(); } }); + cltSocket.on('error', reject); cltSocket.on('end', () => { requestStream.push(null); }); From 5be158e45da6309eee47909807b2292c8c8d916d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=B6=9B?= Date: Mon, 7 Jan 2019 23:11:40 +0800 Subject: [PATCH 3/3] node-simhash not support node > 6.x --- package.json | 6 +++--- test/util/CommonUtil.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 30b857a52..3e3c4620c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "anyproxy", + "name": "@tuofeng/anyproxy", "version": "4.0.12", "description": "A fully configurable HTTP/HTTPS proxy in Node.js", "main": "proxy.js", @@ -40,6 +40,7 @@ "ws": "^5.1.0" }, "devDependencies": { + "@tuofeng/node-simhash": "^0.1.0", "antd": "^2.5.0", "autoprefixer": "^6.4.1", "babel-core": "^6.14.0", @@ -69,7 +70,6 @@ "koa-send": "^3.2.0", "less": "^2.7.1", "less-loader": "^2.2.3", - "node-simhash": "^0.1.0", "nodeunit": "^0.9.1", "phantom": "^4.0.0", "postcss-loader": "^0.13.0", @@ -95,7 +95,7 @@ "lint": "eslint .", "testserver": "node test/server/startServer.js", "testOutWeb": "jasmine test/spec_outweb/test_realweb_spec.js", - "buildweb": "NODE_ENV=production webpack --config web/webpack.config.js --colors", + "buildweb": "NODE_ENV=production npx webpack --config web/webpack.config.js --colors", "webserver": "NODE_ENV=test webpack --config web/webpack.config.js --colors --watch", "doc:serve": "node build_scripts/prebuild-doc.js && gitbook serve ./docs-src ./docs --log debug", "doc:build": "./build_scripts/build-doc-site.sh" diff --git a/test/util/CommonUtil.js b/test/util/CommonUtil.js index 1c4b7cf0b..2fa849ef5 100644 --- a/test/util/CommonUtil.js +++ b/test/util/CommonUtil.js @@ -228,7 +228,7 @@ function stringSimilarity(a, b, precision = 2) { * simhash similarity */ function simHasH(a, b) { - const simhash = require('node-simhash'); + const simhash = require('@tuofeng/node-simhash'); return (simhash.compare(a, b) * 100); }