mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 04:31:27 +00:00
fix conflict
This commit is contained in:
commit
dfab8c97ed
@ -360,7 +360,7 @@ function setRules(newRule){
|
||||
}
|
||||
async.series(functions,function(errors,result){
|
||||
if(!errors){
|
||||
console.log(color.green('Anyproxy rules initialize finished, have a fun!'));
|
||||
console.log(color.green('Anyproxy rules initialize finished, have fun!'));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -19,9 +19,11 @@
|
||||
"stream-throttle": "^0.1.3",
|
||||
"ws": "^0.4.32"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"proxy-eval": "^1.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test.js"
|
||||
"test": "node test.js"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"underscore": "^1.7.0",
|
||||
|
83
test.js
83
test.js
@ -1,78 +1,13 @@
|
||||
var https = require("https"),
|
||||
http = require("http"),
|
||||
proxy = require("./proxy"),
|
||||
tunnel= require('tunnel'),
|
||||
tls = require("tls");
|
||||
var tester = require("proxy-eval"),
|
||||
proxy = require("./proxy.js");
|
||||
|
||||
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
|
||||
|
||||
module.exports.httpOverHttp = function(test){
|
||||
var testDesc = "httpOverHttp",
|
||||
proxyServer = new proxy.proxyServer("http","8004");
|
||||
|
||||
try{
|
||||
var test_option_http_over_http = {
|
||||
host: "localhost",
|
||||
port: 8004,
|
||||
path: "/",
|
||||
headers: {
|
||||
Host: "www.baidu.com"
|
||||
}
|
||||
};
|
||||
|
||||
http.get(test_option_http_over_http, function(res) {
|
||||
var data = "";
|
||||
res.on("data",function(chunk){
|
||||
data += chunk;
|
||||
});
|
||||
res.on("end",function(){
|
||||
proxyServer.close();
|
||||
test.ok(data.length > 50, testDesc);
|
||||
test.done();
|
||||
});
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
test.ok(false,testDesc);
|
||||
test.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports.testHttpsOverHttp = function(test){
|
||||
var testDesc = "httpsOverHttp";
|
||||
var proxyServer = new proxy.proxyServer("http","8004");
|
||||
|
||||
try{
|
||||
var tunnelingAgent = tunnel.httpsOverHttp({
|
||||
proxy: {
|
||||
host: 'localhost',
|
||||
port: 8004
|
||||
}
|
||||
new proxy.proxyServer({
|
||||
type:"http"
|
||||
});
|
||||
|
||||
var req = https.request({
|
||||
host: 'www.gotofail.com',
|
||||
port: 443,
|
||||
agent: tunnelingAgent
|
||||
},function(res){
|
||||
var data = "";
|
||||
res.on("data",function(chunk){
|
||||
data += chunk;
|
||||
setTimeout(function(){
|
||||
tester.test( {proxy : 'http://127.0.0.1:8001',reqTimeout:3000} ,function(results){
|
||||
tester.printResult(results);
|
||||
process.exit();
|
||||
});
|
||||
|
||||
res.on("end",function(){
|
||||
proxyServer.close();
|
||||
test.ok(data.length > 50, testDesc);
|
||||
test.done();
|
||||
});
|
||||
});
|
||||
|
||||
req.end();
|
||||
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
test.ok(false,testDesc);
|
||||
test.done();
|
||||
}
|
||||
}
|
||||
},2000);
|
Loading…
x
Reference in New Issue
Block a user