From 7b3d171a96369d83a9a58862ab0467852cb292a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Mon, 11 Dec 2017 10:24:21 +0800 Subject: [PATCH 01/11] fix the "write after end" error when in stream mode --- lib/requestHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 3c93e7b..a7e86ea 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -159,7 +159,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { res.on('end', () => { if (resDataStream) { - resDataStream.emit('end'); // EOF + resDataStream.push(null); // indicate the stream is end } else { finishCollecting(); } From 50ec8eb2ba03f40c0e51699037babd11f6f794eb Mon Sep 17 00:00:00 2001 From: Otto Mao Date: Wed, 13 Dec 2017 00:08:36 +0800 Subject: [PATCH 02/11] fix #290, release 4.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c14a20..1dff289 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "4.0.0", + "version": "4.0.1", "description": "A fully configurable HTTP/HTTPS proxy in Node.js", "main": "proxy.js", "bin": { From b6c7088965ecb5a82d1f4155b754cca3fc4aeee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Thu, 14 Dec 2017 23:58:52 +0800 Subject: [PATCH 03/11] do not unzip the response body when it's empty, such as 304 also remove the delete operatoin for 'accept-encoding' in the test utils, since AnyProxy will not remove the header now --- lib/requestHandler.js | 11 ++++++----- test/jasmine.json | 2 +- test/server/server.js | 5 +++++ test/spec_rule/no_rule_spec.js | 25 +++++++++++++++++++++++++ test/util/CommonUtil.js | 7 ------- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index a7e86ea..ecde92b 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -93,11 +93,12 @@ function fetchRemoteResponse(protocol, options, reqData, config) { fulfill(resDataStream); } else { const serverResData = Buffer.concat(resDataChunks); + const originContentLen = util.getByteSize(serverResData); + // set origin content length into header + resHeader['x-anyproxy-origin-content-length'] = originContentLen; - // put origin content length into header - resHeader['x-anyproxy-origin-content-length'] = util.getByteSize(serverResData); - - if (ifServerGzipped) { + // only do unzip when there is res data + if (ifServerGzipped && originContentLen) { zlib.gunzip(serverResData, (err, buff) => { // TODO test case to cover if (err) { rejectParsing(err); @@ -105,7 +106,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { fulfill(buff); } }); - } else if (isServerDeflated) { + } else if (isServerDeflated && originContentLen) { zlib.inflateRaw(serverResData, (err, buff) => { // TODO test case to cover if (err) { rejectParsing(err); diff --git a/test/jasmine.json b/test/jasmine.json index 689230e..057167a 100644 --- a/test/jasmine.json +++ b/test/jasmine.json @@ -8,6 +8,6 @@ "../node_modules/babel-register/lib/node.js", "../node_modules/babel-polyfill/dist/polyfill.js" ], - "stopSpecOnExpectationFailure": true, + "stopSpecOnExpectationFailure": false, "random": false } diff --git a/test/server/server.js b/test/server/server.js index f37c43f..d674633 100644 --- a/test/server/server.js +++ b/test/server/server.js @@ -103,6 +103,11 @@ KoaServer.prototype.constructRouter = function () { }); }); + router.get('/test/response/304', this.logRequest, function *(next) { + this.response.set('Content-Encoding', 'gzip'); + this.status = 304; + }); + router.get('/test/response/303', function *(next) { printLog('now to redirect 303'); this.redirect('/test'); diff --git a/test/spec_rule/no_rule_spec.js b/test/spec_rule/no_rule_spec.js index 6e9e123..8157076 100644 --- a/test/spec_rule/no_rule_spec.js +++ b/test/spec_rule/no_rule_spec.js @@ -212,6 +212,31 @@ function testRequest(protocol = 'http') { }); }); + it('304 should work as direct without proxy rules', (done) => { + const url = constructUrl('/test/response/304'); + + proxyGet(url, CommonRequestHeader) + .then(proxyRes => { + directGet(url, CommonRequestHeader) + .then(directRes => { + expect(directRes.statusCode).toEqual(304); + expect(directRes.body).toEqual(''); + + expect(directRes.statusCode).toEqual(proxyRes.statusCode); + expect(isCommonResHeaderEqual(directRes.headers, proxyRes.headers, url)).toBe(true); + expect(directRes.body).toEqual(proxyRes.body); + expect(isCommonReqEqual(url, serverInstance)).toBe(true); + done(); + }, error => { + console.error('error happened in direct 304 request:', error); + done.fail('error happened in direct 304 request'); + }); + }, error => { + console.error('error happened in proxy 304 request:', error); + done.fail('error happened in proxy 304 request'); + }); + }) + describe('Response code should be honored as direct without proxy rules', () => { [301, 302, 303].forEach(code => { testRedirect(code); diff --git a/test/util/CommonUtil.js b/test/util/CommonUtil.js index 75a3751..1d20e7e 100644 --- a/test/util/CommonUtil.js +++ b/test/util/CommonUtil.js @@ -130,13 +130,6 @@ function isCommonReqEqual(url, serverInstance) { isEqual = isEqual && proxyReqObj.headers['via-proxy'] === 'true'; delete proxyReqObj.headers['via-proxy']; - // exclued accept-encoding from comparing, since the proxy will remove it before sending it out - delete directReqObj.headers['accept-encoding']; - - // TODO: 我这里proxy出去的options里没有accept-encoding, 但node自己加上了。Why ? - // By 加里 2017.1.31 - delete proxyReqObj.headers['accept-encoding']; - directReqObj.headers['content-type'] = trimFormContentType(directReqObj.headers['content-type']); proxyReqObj.headers['content-type'] = trimFormContentType(proxyReqObj.headers['content-type']); From 9e6eb5bd2e23509f71404be17fa084b1a36ed143 Mon Sep 17 00:00:00 2001 From: Otto Mao Date: Fri, 15 Dec 2017 00:13:41 +0800 Subject: [PATCH 04/11] fix #295 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1dff289..94a9a04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "4.0.1", + "version": "4.0.2", "description": "A fully configurable HTTP/HTTPS proxy in Node.js", "main": "proxy.js", "bin": { From 9cdac33e97ab6e215ac5b9dd57c1ebabe0c0bf54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Mon, 25 Dec 2017 21:22:07 +0800 Subject: [PATCH 05/11] correct the license declaration --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94a9a04..e2008d5 100644 --- a/package.json +++ b/package.json @@ -110,5 +110,5 @@ "url": "https://github.com/alibaba/anyproxy" }, "author": "ottomao@gmail.com", - "license": "ISC" + "license": "Apache-2.0" } From ee0f285e78a5a754069ccb70a179074d58d61fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Thu, 28 Dec 2017 21:31:13 +0800 Subject: [PATCH 06/11] Only update the `content-header` when the content is handled by AnyProxy --- lib/requestHandler.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index ecde92b..2480102 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -94,11 +94,29 @@ function fetchRemoteResponse(protocol, options, reqData, config) { } else { const serverResData = Buffer.concat(resDataChunks); const originContentLen = util.getByteSize(serverResData); + // remove gzip related header, and ungzip the content + // note there are other compression types like deflate + const contentEncoding = resHeader['content-encoding'] || resHeader['Content-Encoding']; + const ifServerGzipped = /gzip/i.test(contentEncoding); + const isServerDeflated = /deflate/i.test(contentEncoding); + + /** + * when the content is unzipped, update the header content + */ + const refactContentEncoding = () => { + if (contentEncoding) { + resHeader['x-anyproxy-origin-content-encoding'] = contentEncoding; + delete resHeader['content-encoding']; + delete resHeader['Content-Encoding']; + } + } + // set origin content length into header resHeader['x-anyproxy-origin-content-length'] = originContentLen; - + // only do unzip when there is res data if (ifServerGzipped && originContentLen) { + refactContentEncoding(); zlib.gunzip(serverResData, (err, buff) => { // TODO test case to cover if (err) { rejectParsing(err); @@ -107,6 +125,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { } }); } else if (isServerDeflated && originContentLen) { + refactContentEncoding(); zlib.inflateRaw(serverResData, (err, buff) => { // TODO test case to cover if (err) { rejectParsing(err); @@ -131,12 +150,6 @@ function fetchRemoteResponse(protocol, options, reqData, config) { }); }; - // remove gzip related header, and ungzip the content - // note there are other compression types like deflate - const contentEncoding = resHeader['content-encoding'] || resHeader['Content-Encoding']; - const ifServerGzipped = /gzip/i.test(contentEncoding); - const isServerDeflated = /deflate/i.test(contentEncoding); - //deal response data res.on('data', (chunk) => { rawResChunks.push(chunk); @@ -265,7 +278,6 @@ function getUserReqHandler(userRule, recorder) { const responseBody = responseInfo.body || ''; const transferEncoding = resHeader['transfer-encoding'] || resHeader['Transfer-Encoding'] || ''; - const contentEncoding = resHeader['content-encoding'] || resHeader['Content-Encoding']; const contentLength = resHeader['content-length'] || resHeader['Content-Length']; const connection = resHeader.Connection || resHeader.connection; if (contentLength) { @@ -273,12 +285,6 @@ function getUserReqHandler(userRule, recorder) { delete resHeader['Content-Length']; } - if (contentEncoding) { - resHeader['x-anyproxy-origin-content-encoding'] = contentEncoding; - delete resHeader['content-encoding']; - delete resHeader['Content-Encoding']; - } - // set proxy-connection if (connection) { resHeader['x-anyproxy-origin-connection'] = connection; From 63170983674a50b3d08ea3ee1f4cc55721add0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Thu, 28 Dec 2017 21:57:10 +0800 Subject: [PATCH 07/11] Support to decompress the brotli content-encoding --- lib/requestHandler.js | 12 ++++++++++++ package.json | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 2480102..bba6b7f 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -12,6 +12,7 @@ const http = require('http'), logUtil = require('./log'), co = require('co'), HttpsServerMgr = require('./httpsServerMgr'), + brotliTorb = require('iltorb'), Readable = require('stream').Readable; const requestErrorHandler = require('./requestErrorHandler'); @@ -99,6 +100,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { const contentEncoding = resHeader['content-encoding'] || resHeader['Content-Encoding']; const ifServerGzipped = /gzip/i.test(contentEncoding); const isServerDeflated = /deflate/i.test(contentEncoding); + const isBrotlied = /br/i.test(contentEncoding); /** * when the content is unzipped, update the header content @@ -133,6 +135,16 @@ function fetchRemoteResponse(protocol, options, reqData, config) { fulfill(buff); } }); + } else if (isBrotlied && originContentLen) { + refactContentEncoding(); + + brotliTorb.decompress(serverResData, (err, buff) => { + if (err) { + rejectParsing(err); + } else { + fulfill(buff); + } + }); } else { fulfill(serverResData); } diff --git a/package.json b/package.json index e2008d5..37bdea5 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "es6-promise": "^3.3.1", "express": "^4.8.5", "iconv-lite": "^0.4.6", + "iltorb": "^2.0.3", "inquirer": "^3.0.1", "ip": "^0.3.2", "juicer": "^0.6.6-stable", @@ -92,7 +93,7 @@ "worker-loader": "^0.7.1" }, "scripts": { - "prepublish":"npm run buildweb", + "prepublish": "npm run buildweb", "test": "node test.js", "lint": "eslint .", "testserver": "node test/server/startServer.js", From 52582bee0733e96cdc0d2b4e14248a71fc3e5132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Fri, 29 Dec 2017 18:42:11 +0800 Subject: [PATCH 08/11] update dependency to brotli --- lib/requestHandler.js | 15 +++++++-------- package.json | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index bba6b7f..83f6bb7 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -12,7 +12,7 @@ const http = require('http'), logUtil = require('./log'), co = require('co'), HttpsServerMgr = require('./httpsServerMgr'), - brotliTorb = require('iltorb'), + brotliTorb = require('brotli'), Readable = require('stream').Readable; const requestErrorHandler = require('./requestErrorHandler'); @@ -138,13 +138,12 @@ function fetchRemoteResponse(protocol, options, reqData, config) { } else if (isBrotlied && originContentLen) { refactContentEncoding(); - brotliTorb.decompress(serverResData, (err, buff) => { - if (err) { - rejectParsing(err); - } else { - fulfill(buff); - } - }); + try { + const result = brotliTorb.decompress(serverResData); + fulfill(new Buffer(result)); + } catch (e) { + rejectParsing(e); + } } else { fulfill(serverResData); } diff --git a/package.json b/package.json index 37bdea5..7c65c47 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "async": "~0.9.0", "async-task-mgr": ">=1.1.0", "body-parser": "^1.13.1", + "brotli": "^1.3.2", "classnames": "^2.2.5", "clipboard-js": "^0.3.3", "co": "^4.6.0", @@ -21,7 +22,6 @@ "es6-promise": "^3.3.1", "express": "^4.8.5", "iconv-lite": "^0.4.6", - "iltorb": "^2.0.3", "inquirer": "^3.0.1", "ip": "^0.3.2", "juicer": "^0.6.6-stable", From ecb9a71eb146011b4291b2f112c2181990bfecd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Sat, 30 Dec 2017 13:34:38 +0800 Subject: [PATCH 09/11] add comment and replace the deprecated `new Buffer()` with `Buffer.from()` --- lib/requestHandler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 83f6bb7..1ed7e97 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -139,8 +139,9 @@ function fetchRemoteResponse(protocol, options, reqData, config) { refactContentEncoding(); try { + // an Unit8Array returned by decompression const result = brotliTorb.decompress(serverResData); - fulfill(new Buffer(result)); + fulfill(Buffer.from(result)); } catch (e) { rejectParsing(e); } From d7e68caea97e1172b590d3418309b69b8c42244d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Wed, 3 Jan 2018 15:00:19 +0800 Subject: [PATCH 10/11] add readme about installing CA in Android --- docs-src/cn/src_doc.md | 8 ++++++++ docs-src/en/src_doc.md | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/docs-src/cn/src_doc.md b/docs-src/cn/src_doc.md index 200ada4..02b9ab0 100644 --- a/docs-src/cn/src_doc.md +++ b/docs-src/cn/src_doc.md @@ -611,6 +611,14 @@ module.exports = { +### 安卓系统信任CA证书 +首先和iOS类似,需要先扫描证书的二维码进行下载。然后不同的安卓系统安装证书的方式可能有所不同,但是安装的步骤是类似的,我们列举了几种类型。 + +* 下载后的证书可以直接单击打开并安装,这种方式是最简单的,直接安装即可 +* 证书下载到指定目录后,需要从其他入口进行安装,包括: + * 设置 -> 安全性与位置信息 -> 加密与凭据 -> 从存储设备安装。找到你下载的证书文件,进行安装 + * 设置 -> 安全 -> 从SD卡安装证书。找到你下载的证书文件,进行安装 + ### 配置iOS/Android系统代理 * 代理服务器都在wifi设置中配置 diff --git a/docs-src/en/src_doc.md b/docs-src/en/src_doc.md index 94352eb..da11810 100644 --- a/docs-src/en/src_doc.md +++ b/docs-src/en/src_doc.md @@ -602,6 +602,15 @@ install : * Besides installing root CA, you have to "turn on" the certificate for web manually in *settings - general - about - Certificate Trust Settings*. Otherwire, safari will not trust the root CA generated by AnyProxy. +### trust root CA in Android +First of all, you need to download the root CA by clicking *Root CA* in web ui, and then scan the QR code. +Installing CA in Android could be different based on the system, we list some common steps as below, but you can find the right way in you system with similar menu path. + +* The downloaded CA file can be directly installed by clicking, this is the easist way +* You need to install the CA file from other menu, such as: + * Settings -> Security & Location > Encryption & credentials -> Install from storage, and find your CA file to install + * Settings -> Security -> Install from SD card, and find you CA file to install + ### config iOS/Android proxy server From 01dba5fc92937a75e140dcbd385943c74e160850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Sun, 7 Jan 2018 21:34:32 +0800 Subject: [PATCH 11/11] add link to summary also update doc:build script to build the site --- build_scripts/build-doc-site.sh | 14 +++ docs-src/cn/README.md | 8 ++ docs-src/cn/SUMMARY.md | 1 + docs-src/en/README.md | 9 ++ docs-src/en/SUMMARY.md | 71 ++++++------- docs-src/en/_layouts/layout.html | 2 +- docs/cn/index.html | 30 +++++- docs/cn/search_index.json | 2 +- docs/cn/src_doc.md | 8 ++ docs/en/index.html | 175 ++++++++++++++++++------------- docs/en/search_index.json | 2 +- docs/en/src_doc.md | 9 ++ docs/gitbook/gitbook.js | 4 +- docs/gitbook/theme.js | 2 +- docs/index.html | 2 +- docs/search_index.json | 2 +- package.json | 2 +- 17 files changed, 223 insertions(+), 120 deletions(-) create mode 100755 build_scripts/build-doc-site.sh diff --git a/build_scripts/build-doc-site.sh b/build_scripts/build-doc-site.sh new file mode 100755 index 0000000..a5e0153 --- /dev/null +++ b/build_scripts/build-doc-site.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +## get into the "build_scripts" folder regardless of the excution directory +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$parent_path/.." + +## compile the doc +node ./build_scripts/prebuild-doc.js +gitbook build ./docs-src ./docs + +## push the doc into github +git add ./docs +git commit -m 'building docs' +git push origin diff --git a/docs-src/cn/README.md b/docs-src/cn/README.md index aca96f6..0cf047a 100644 --- a/docs-src/cn/README.md +++ b/docs-src/cn/README.md @@ -810,6 +810,14 @@ module.exports = { +### 安卓系统信任CA证书 +首先和iOS类似,需要先扫描证书的二维码进行下载。然后不同的安卓系统安装证书的方式可能有所不同,但是安装的步骤是类似的,我们列举了几种类型。 + +* 下载后的证书可以直接单击打开并安装,这种方式是最简单的,直接安装即可 +* 证书下载到指定目录后,需要从其他入口进行安装,包括: + * 设置 -> 安全性与位置信息 -> 加密与凭据 -> 从存储设备安装。找到你下载的证书文件,进行安装 + * 设置 -> 安全 -> 从SD卡安装证书。找到你下载的证书文件,进行安装 + ### 配置iOS/Android系统代理 * 代理服务器都在wifi设置中配置 diff --git a/docs-src/cn/SUMMARY.md b/docs-src/cn/SUMMARY.md index e9fe3aa..437904f 100644 --- a/docs-src/cn/SUMMARY.md +++ b/docs-src/cn/SUMMARY.md @@ -35,5 +35,6 @@ * [配置浏览器HTTP代理](README.md#配置浏览器http代理) * [iOS系统信任CA证书](README.md#ios系统信任ca证书) * [iOS >= 10.3信任CA证书](README.md#ios--103信任ca证书) + * [安卓系统信任CA证书](README.md#安卓系统信任ca证书) * [配置iOS/Android系统代理](README.md#配置iosandroid系统代理) * [FAQ](README.md#faq) diff --git a/docs-src/en/README.md b/docs-src/en/README.md index 56ccc3b..300feda 100644 --- a/docs-src/en/README.md +++ b/docs-src/en/README.md @@ -801,6 +801,15 @@ install : * Besides installing root CA, you have to "turn on" the certificate for web manually in *settings - general - about - Certificate Trust Settings*. Otherwire, safari will not trust the root CA generated by AnyProxy. +### trust root CA in Android +First of all, you need to download the root CA by clicking *Root CA* in web ui, and then scan the QR code. +Installing CA in Android could be different based on the system, we list some common steps as below, but you can find the right way in you system with similar menu path. + +* The downloaded CA file can be directly installed by clicking, this is the easist way +* You need to install the CA file from other menu, such as: + * Settings -> Security & Location > Encryption & credentials -> Install from storage, and find your CA file to install + * Settings -> Security -> Install from SD card, and find you CA file to install + ### config iOS/Android proxy server diff --git a/docs-src/en/SUMMARY.md b/docs-src/en/SUMMARY.md index af787b5..5f2c9f2 100644 --- a/docs-src/en/SUMMARY.md +++ b/docs-src/en/SUMMARY.md @@ -1,38 +1,39 @@ # Summary * [Introduction](README.md) -* [Getting-Start](doc.md#getting-start) - * [Install](doc.md#install) - * [Launch](doc.md#launch) - * [Options](doc.md#options) - * [As Node Module](doc.md#use-anyproxy-as-an-npm-module) -* [Proxy HTTPS](doc.md#proxy-https) -* [Rule Introduction](doc.md#rule-introduction) - * [Sample](doc.md#sample) - * [How Does It Work](doc.md#how-does-it-work) - * [Load A Rule](doc.md#how-to-load-rule-module) -* [Rule Module Interfaces](doc.md#rule-module-interface) - * [summary_class=rule-title](doc.md#summary) - * [beforeSendRequest_class=rule-title](doc.md#beforesendrequest) - * [beforeSendResponse_class=rule-title](doc.md#beforesendresponse) - * [beforeDealHttpsRequest_class=rule-title](doc.md#beforedealhttpsrequest) - * [onError_class=rule-title](doc.md#onerror) - * [onConnectError_class=rule-title](doc.md#onconnecterror) -* [Rule Samples](doc.md#rule-samples) - * [Use local response_class=sample-title](doc.md#use-local-response) - * [Modify Request Header_class=sample-title](doc.md#modify-request-header) - * [Modify Request Body_class=sample-title](doc.md#modify-request-body) - * [Modify The Request Target_class=sample-title](doc.md#modify-the-request-target) - * [Modify Request Protocol_class=sample-title](doc.md#modify-request-protocol) - * [Modify Response Status Code_class=sample-title](doc.md#modify-response-status-code) - * [Modify The Response Header_class=sample-title](doc.md#modify-the-response-header) - * [Modify Response Data And Delay_class=sample-title](doc.md#modify-response-data-and-delay) -* [Config Certification](doc.md#config-certification) - * [Config Root CA In OSX](doc.md#config-root-ca-in-osx) - * [Configure Root CA In windows](doc.md#config-root-ca-in-windows) - * [Config OSX System Proxy](doc.md#config-osx-system-proxy) - * [Config As Http Proxy Server](doc.md#config-http-proxy-server) - * [Trust Root CA In IOS](doc.md#trust-root-ca-in-ios) - * [Trust Root CA In iOS after 10.3](doc.md#trust-root-ca-in-ios-after-103) - * [Config IOS/Android Proxy Server](doc.md#config-iosandroid-proxy-server) -* [FAQ](doc.md) +* [Getting-Start](README.md#getting-start) + * [Install](README.md#install) + * [Launch](README.md#launch) + * [Options](README.md#options) + * [As Node Module](README.md#use-anyproxy-as-an-npm-module) +* [Proxy HTTPS](README.md#proxy-https) +* [Rule Introduction](README.md#rule-introduction) + * [Sample](README.md#sample) + * [How Does It Work](README.md#how-does-it-work) + * [Load A Rule](README.md#how-to-load-rule-module) +* [Rule Module Interfaces](README.md#rule-module-interface) + * [summary_class=rule-title](README.md#summary) + * [beforeSendRequest_class=rule-title](README.md#beforesendrequest) + * [beforeSendResponse_class=rule-title](README.md#beforesendresponse) + * [beforeDealHttpsRequest_class=rule-title](README.md#beforedealhttpsrequest) + * [onError_class=rule-title](README.md#onerror) + * [onConnectError_class=rule-title](README.md#onconnecterror) +* [Rule Samples](README.md#rule-samples) + * [Use local response_class=sample-title](README.md#use-local-response) + * [Modify Request Header_class=sample-title](README.md#modify-request-header) + * [Modify Request Body_class=sample-title](README.md#modify-request-body) + * [Modify The Request Target_class=sample-title](README.md#modify-the-request-target) + * [Modify Request Protocol_class=sample-title](README.md#modify-request-protocol) + * [Modify Response Status Code_class=sample-title](README.md#modify-response-status-code) + * [Modify The Response Header_class=sample-title](README.md#modify-the-response-header) + * [Modify Response Data And Delay_class=sample-title](README.md#modify-response-data-and-delay) +* [Config Certification](README.md#config-certification) + * [Config Root CA In OSX](README.md#config-root-ca-in-osx) + * [Configure Root CA In windows](README.md#config-root-ca-in-windows) + * [Config OSX System Proxy](README.md#config-osx-system-proxy) + * [Config As Http Proxy Server](README.md#config-http-proxy-server) + * [Trust Root CA In IOS](README.md#trust-root-ca-in-ios) + * [Trust Root CA In iOS after 10.3](README.md#trust-root-ca-in-ios-after-103) + * [Trust Root CA In Android](README.md#trust-root-ca-in-android) + * [Config IOS/Android Proxy Server](README.md#config-iosandroid-proxy-server) +* [FAQ](README.md) diff --git a/docs-src/en/_layouts/layout.html b/docs-src/en/_layouts/layout.html index 0b56e83..41a2809 100644 --- a/docs-src/en/_layouts/layout.html +++ b/docs-src/en/_layouts/layout.html @@ -19,7 +19,7 @@ {% endfor %} {% endblock %} - + diff --git a/docs/cn/index.html b/docs/cn/index.html index 22af80a..dc2524a 100644 --- a/docs/cn/index.html +++ b/docs/cn/index.html @@ -7,7 +7,7 @@ 简介 · AnyProxy - + @@ -649,6 +649,22 @@
  • + + + +
    + 安卓系统信任CA证书 +
    + + +
    + + + +
  • + +
  • + @@ -1512,6 +1528,16 @@ newResponse.body += '--from anyproxy--'除了上述证书安装过程,还需要在 设置->通用->关于本机->证书信任设置 中把AnyProxy证书的开关打开,否则safari将报错。
  • +

    安卓系统信任CA证书

    +

    首先和iOS类似,需要先扫描证书的二维码进行下载。然后不同的安卓系统安装证书的方式可能有所不同,但是安装的步骤是类似的,我们列举了几种类型。

    +
      +
    • 下载后的证书可以直接单击打开并安装,这种方式是最简单的,直接安装即可
    • +
    • 证书下载到指定目录后,需要从其他入口进行安装,包括:
        +
      • 设置 -> 安全性与位置信息 -> 加密与凭据 -> 从存储设备安装。找到你下载的证书文件,进行安装
      • +
      • 设置 -> 安全 -> 从SD卡安装证书。找到你下载的证书文件,进行安装
      • +
      +
    • +

    配置iOS/Android系统代理