conflict resolved for README

This commit is contained in:
OttoMao 2015-03-16 14:29:13 +08:00
commit 6b231cbf26
5 changed files with 43 additions and 18 deletions

View File

@ -67,7 +67,6 @@ Rule module
Https features
----------------
After configuring rootCA, AnyProxy could help to decrypt https requests, whose approach is also called Man-In-The-Middle(MITM).
A guide about configuring https features is here : [https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy](https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy)
@ -75,6 +74,15 @@ A guide about configuring https features is here : [https://github.com/alibaba/a
Others
-----------------
#### to install node modules
* to install node modules for supporting rules development, use ``` anyproxy install ```
* for example ``` anyproxy install underscore ```
* and in rule file
```
var base = path.join(process.env.NODE_PATH,'anyproxy','node_modules');
var underscore = require(path.join(base,'underscore'));
```
#### to save request data
* to save request data to local file, use ``` anyproxy --file /path/to/file ```

14
bin.js
View File

@ -1,10 +1,10 @@
#!/usr/bin/env node
var program = require('commander'),
proxy = require("./proxy.js"),
color = require('colorful'),
fs = require("fs"),
path = require("path"),
npm = require("npm"),
packageInfo = require("./package.json");
program
@ -18,6 +18,7 @@ program
.option('-l, --throttle [value]', 'throttle speed in kb/s (kbyte / sec)')
.option('-i, --intercept', 'intercept(decrypt) https requests when root CA exists')
.option('-c, --clear', 'clear all the tmp certificates')
.option('install', 'install node modules')
.parse(process.argv);
if(program.clear){
@ -30,7 +31,18 @@ if(program.clear){
require("./lib/certMgr").generateRootCA(function(){
process.exit(0);
});
}else if(program.install){
npm.load({
"prefix": process.env.NODE_PATH + '/anyproxy/'
}, function (er) {
npm.commands.install(program.args || [], function (er, data) {
if(er)throw er;
})
npm.registry.log.on("log", function (message) {
})
});
}else{
var proxy = require("./proxy.js");
var ruleModule;
if(program.rule){

View File

@ -1,6 +1,6 @@
{
"name": "anyproxy",
"version": "3.2.2",
"version": "3.2.3",
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
"main": "proxy.js",
"bin": {
@ -19,7 +19,8 @@
"nedb": "^0.11.0",
"qrcode-npm": "0.0.3",
"stream-throttle": "^0.1.3",
"ws": "^0.4.32"
"ws": "^0.4.32",
"npm": "^2.7.0"
},
"devDependencies": {
"proxy-eval": ">=1.1.1"

View File

@ -48,7 +48,12 @@ try{
if(fs.existsSync(path.join(process.cwd(),'rule.js'))){
default_rule = require(path.join(process.cwd(),'rule'));
}
}catch(e){}
}catch(e){
if(e){
console.log("error" + e);
throw e;
}
}
//option
//option.type : 'http'(default) or 'https'

View File

@ -3,7 +3,6 @@
module.exports = {
replaceServerResDataAsync: function(req,res,serverResData,callback){
//append "hello world" to all web pages
if(/html/i.test(res.headers['content-type'])){
var newDataStr = serverResData.toString();