mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 15:51:25 +00:00
Merge branch 'master' of https://github.com/alipay-ct-wd/anyproxy
This commit is contained in:
commit
263cf2b0c6
@ -5,6 +5,7 @@ var http = require("http"),
|
|||||||
url = require("url"),
|
url = require("url"),
|
||||||
pathUtil = require("path"),
|
pathUtil = require("path"),
|
||||||
color = require("colorful"),
|
color = require("colorful"),
|
||||||
|
sleep = require("sleep"),
|
||||||
httpsServerMgr = require("./httpsServerMgr");
|
httpsServerMgr = require("./httpsServerMgr");
|
||||||
|
|
||||||
var httpsServerMgrInstance = new httpsServerMgr();
|
var httpsServerMgrInstance = new httpsServerMgr();
|
||||||
@ -77,6 +78,13 @@ function userRequestHandler(req,userRes){
|
|||||||
console.log("file not exist : " + targetLocalfile);
|
console.log("file not exist : " + targetLocalfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sleep for seconds if configed in the rule file
|
||||||
|
//see rule_sample.js
|
||||||
|
if(hostTest && pathTest && !!rule.sleep){
|
||||||
|
console.log(color.yellow('[' + req.url + '] will sleep for ' + rule.sleep + ' seconds.'));
|
||||||
|
sleep.sleep(rule.sleep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ifLocalruleMatched){
|
if(ifLocalruleMatched){
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"async": "~0.9.0",
|
"async": "~0.9.0",
|
||||||
"async-task-mgr": "^1.0.1",
|
"async-task-mgr": "^1.0.1",
|
||||||
"colorful": "^2.1.0",
|
"colorful": "^2.1.0",
|
||||||
"commander": "~2.3.0"
|
"commander": "~2.3.0",
|
||||||
|
"sleep": "~1.1.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tunnel": "0.0.3"
|
"tunnel": "0.0.3"
|
||||||
|
@ -17,6 +17,10 @@ var rules = {
|
|||||||
"path" :/tps/,
|
"path" :/tps/,
|
||||||
"localFile" :"",
|
"localFile" :"",
|
||||||
"localDir" :"/Users/Stella/tmp/"
|
"localDir" :"/Users/Stella/tmp/"
|
||||||
|
},{
|
||||||
|
"host" :/./,
|
||||||
|
"path" :/\.(js)/,
|
||||||
|
"sleep" :5//seconds
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
,"httpsConfig":{
|
,"httpsConfig":{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user