print a hint when using SNI features in node <0.12

This commit is contained in:
OttoMao 2015-06-18 20:23:42 +08:00
parent 200226807c
commit 3e679f0834
5 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
18 June: anyproxy 3.5.1:
* print a hint when using SNI features in node <0.12
* Ref : https://github.com/alibaba/anyproxy/issues/25
18 June: anyproxy 3.5.0: 18 June: anyproxy 3.5.0:
* it's a formal release of 3.4.0@beta. * it's a formal release of 3.4.0@beta.

View File

@ -48,7 +48,7 @@ function SNIPrepareCert(serverName,SNICallback){
SNICallback(null,ctx); SNICallback(null,ctx);
}else{ }else{
logUtil.printLog("err occurred when prepare certs for SNI - " + err, logUtil.T_ERR); logUtil.printLog("err occurred when prepare certs for SNI - " + err, logUtil.T_ERR);
logUtil.printLog("you may upgrade your Node.js to the lastest version", logUtil.T_ERR); logUtil.printLog("you may upgrade your Node.js to >= v0.12", logUtil.T_ERR);
} }
}); });
} }

View File

@ -8,6 +8,7 @@ function printLog(content,type){
if(!ifPrint) return; if(!ifPrint) return;
var tip = content; var tip = content;
console.log(tip); console.log(tip);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "anyproxy", "name": "anyproxy",
"version": "3.5.0", "version": "3.5.1",
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.", "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
"main": "proxy.js", "main": "proxy.js",
"bin": { "bin": {

View File

@ -93,6 +93,12 @@ function proxyServer(option){
if(!!option.interceptHttps){ if(!!option.interceptHttps){
default_rule.setInterceptFlag(true); default_rule.setInterceptFlag(true);
//print a tip when using https features in Node < v0.12
var nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if(nodeVersion < 0.12){
logUtil.printLog(color.red("node >= v0.12 is required when trying to intercept HTTPS requests :("), logUtil.T_ERR);
}
} }
if(option.throttle){ if(option.throttle){