diff --git a/README.md b/README.md index a78182a..e415642 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,12 @@ anyproxy ========== A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly. -(Chinese in this doc is nothing but translation of some key points. Be relax if you dont understand.) +[wiki - 代理服务器的新轮子](https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy) ,介绍我们为什么要再造一个代理服务器,anyproxy与众不同的结构与功能。  +(Chinese in this doc is nothing but translation of some key points. Be relax if you dont understand.) + Feature ------------ * work as http or https proxy @@ -22,7 +24,8 @@ Usage ### step 1 - install * install [NodeJS](http://nodejs.org/) -* ``tnpm install -g anyproxy`` , may require ``sudo`` +* ``npm install -g anyproxy`` , may require ``sudo`` +* python is optional, it will be OK if you get some error about it during installing. ### step 2 - start server @@ -209,6 +212,7 @@ Using https features * root certs and temperary certs are stored at ``path.join(util.getUserHome(),"/.anyproxy_certs/")`` * to get the rootCA.crt file , you may either find it in local dir or download it via anyproxy web interface * to clear all the temperary certificates ``anyproxy --clear`` +* https features may be unstable in windows Others ----------------- diff --git a/lib/certMgr.js b/lib/certMgr.js index 1c2b159..c115be3 100644 --- a/lib/certMgr.js +++ b/lib/certMgr.js @@ -14,12 +14,17 @@ var certDir = path.join(util.getUserHome(),"/.anyproxy_certs/"), cmd_genCert = path.join(cmdDir,"./gen-cer"), asyncTaskMgr = new asyncTask(); - if(!fs.existsSync(certDir)){ - fs.mkdirSync(certDir,0777); + try{ + fs.mkdirSync(certDir,0777); //may fail in windows + }catch(e){ + console.log("==========="); + console.log("failed to create cert dir ,please create one by yourself - " + certDir); + console.log("this error will not block main thread unless you use https-related features in anyproxy"); + console.log("==========="); + } } - function getCertificate(hostname,cb){ var keyFile = path.join(certDir , "__hostname.key".replace(/__hostname/,hostname) ), crtFile = path.join(certDir , "__hostname.crt".replace(/__hostname/,hostname) ); diff --git a/package.json b/package.json index 3b5896d..0c817c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "2.8.7", + "version": "2.8.9", "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.", "main": "proxy.js", "bin": { diff --git a/proxy.js b/proxy.js index 73a6f95..0e42d7a 100644 --- a/proxy.js +++ b/proxy.js @@ -56,8 +56,8 @@ if(!fs.existsSync(anyproxyHome)){ if(fs.existsSync(path.join(anyproxyHome,"rule_default.js"))){ default_rule = require(path.join(anyproxyHome,"rule_default")); } -if(fs.existsSync(process.cwd() + '/rule.js')){ - default_rule = require(process.cwd() + '/rule'); +if(fs.existsSync(path.join(process.cwd(),'rule.js'))){ + default_rule = require(path.join(process.cwd(),'rule')); } //option