From 4d76d55338d173c9fbd572f30690de0ddf404383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E5=BD=93=E5=BD=93?= <donghua.yan@alipay.com> Date: Thu, 4 Sep 2014 22:21:51 +0800 Subject: [PATCH 1/2] GLOBAL.util --- proxy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy.js b/proxy.js index 2151eea..f4b762b 100644 --- a/proxy.js +++ b/proxy.js @@ -1,7 +1,8 @@ //mix some modules to global.util try{ - GLOBAL.util = {}; - GLOBAL.util['iconv-lite'] = require("iconv-lite"); + GLOBAL.util = require('./lib/util'); + GLOBAL.util['iconv-lite'] = require("iconv-lite"); + GLOBAL.util['colorful'] = require("colorful"); }catch(e){} var http = require('http'), From a83e9386e6041e5ae3496ae7d141c842d42ad555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E5=BD=93=E5=BD=93?= <donghua.yan@alipay.com> Date: Thu, 4 Sep 2014 22:41:29 +0800 Subject: [PATCH 2/2] rule_default --- proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy.js b/proxy.js index f4b762b..4387d78 100644 --- a/proxy.js +++ b/proxy.js @@ -43,7 +43,7 @@ function proxyServer(option){ proxyType = /https/i.test(option.type || DEFAULT_TYPE) ? T_TYPE_HTTPS : T_TYPE_HTTP , proxyPort = option.port || DEFAULT_PORT, proxyHost = option.hostname || DEFAULT_HOST, - proxyRules = option.rule; + proxyRules = option.rule || require('./lib/rule_default'); requestHandler.setRules(proxyRules); self.httpProxyServer = null;