From db95da680d321943adbf5edf65a28f93fa425f92 Mon Sep 17 00:00:00 2001
From: "xiaofeng.mxf" <xiaofeng.mxf@taobao.com>
Date: Sun, 24 Mar 2019 21:18:21 +0800
Subject: [PATCH] build document

---
 build_scripts/build-doc-site.sh |  6 +++---
 docs-src/cn/README.md           | 32 ++++++++++++++++++++------------
 docs-src/en/README.md           | 31 +++++++++++++++++++------------
 docs/cn/index.html              |  6 +++++-
 docs/en/index.html              |  6 +++++-
 5 files changed, 52 insertions(+), 29 deletions(-)

diff --git a/build_scripts/build-doc-site.sh b/build_scripts/build-doc-site.sh
index a5e0153..b5be3c7 100755
--- a/build_scripts/build-doc-site.sh
+++ b/build_scripts/build-doc-site.sh
@@ -9,6 +9,6 @@ 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
+# 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 b415bb6..2841a81 100644
--- a/docs-src/cn/README.md
+++ b/docs-src/cn/README.md
@@ -200,6 +200,14 @@ anyproxy --intercept #启动AnyProxy,并解析所有https请求
 
 * [附录:如何信任CA证书](#证书配置)
 
+# 代理WebSocket
+
+```bash
+anyproxy --ws-intercept
+```
+
+> 当启用`HTTPS`代理时,`wss`也会被代理,但是不会被AnyProxy记录。需要开启`--ws-intercept`后才会从界面上看到相应内容。
+
 # rule模块
 
 AnyProxy提供了二次开发的能力,你可以用js编写自己的规则模块(rule),来自定义网络请求的处理逻辑。
@@ -528,8 +536,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_use_local_response.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     intercept all requests toward httpbin.org, use a local response
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@@ -558,8 +566,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_request_header.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify the user-agent in requests toward httpbin.org
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@@ -647,8 +655,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_request_protocol.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     redirect all http requests of httpbin.org to https
   test:
     curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
@@ -677,8 +685,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_statuscode.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify all status code of http://httpbin.org/ to 404
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@@ -706,8 +714,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_header.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify response header of http://httpbin.org/user-agent
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@@ -735,8 +743,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_data.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify response data of http://httpbin.org/user-agent
   test:
     curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
diff --git a/docs-src/en/README.md b/docs-src/en/README.md
index ea1a001..adcdba7 100644
--- a/docs-src/en/README.md
+++ b/docs-src/en/README.md
@@ -200,6 +200,13 @@ anyproxy --intercept #launch anyproxy and intercept all https traffic
 
 * [Appendix:how to trust CA](#config-certification)
 
+# Proxy WebSocket
+
+```bash
+anyproxy --ws-intercept
+```
+> The `wss` requests will be handled automatically when the `HTTPS` intercept is turned on, but AnyProxy will not record the data by default. You need to specify the `--ws-intercept` to tell AnyProxy to record it.
+
 # Rule Introduction
 
 AnyProxy provides the ability to load your own rules written in javascript. With rule module, you could customize the logic to handle requests.
@@ -521,8 +528,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_use_local_response.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     intercept all requests toward httpbin.org, use a local response
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@@ -551,8 +558,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_request_header.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify the user-agent in requests toward httpbin.org
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@@ -640,8 +647,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_request_protocol.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     redirect all http requests of httpbin.org to https
   test:
     curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
@@ -670,8 +677,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_statuscode.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify all status code of http://httpbin.org/ to 404
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@@ -699,8 +706,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_header.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify response header of http://httpbin.org/user-agent
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@@ -728,8 +735,8 @@ module.exports = {
 anyproxy --rule rule_sample/sample_modify_response_data.js
 ```
 ```js
-/*
-  sample:
+/* 
+  sample: 
     modify response data of http://httpbin.org/user-agent
   test:
     curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
diff --git a/docs/cn/index.html b/docs/cn/index.html
index 2ce1c8c..6e618f3 100644
--- a/docs/cn/index.html
+++ b/docs/cn/index.html
@@ -1658,7 +1658,7 @@ newResponse.body += <span class="hljs-string">&apos;--from anyproxy--&apos;</spa
     <script>
         var gitbook = gitbook || [];
         gitbook.push(function() {
-            gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:16:28.519Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:16:29.922Z"},"basePath":".","book":{"language":"cn"}});
+            gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:17:35.024Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:17:35.950Z"},"basePath":".","book":{"language":"cn"}});
         });
     </script>
 </div>
@@ -1668,6 +1668,10 @@ newResponse.body += <span class="hljs-string">&apos;--from anyproxy--&apos;</spa
     <script src="../gitbook/theme.js"></script>
     
         
+        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
+        
+    
+        
         <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
         
     
diff --git a/docs/en/index.html b/docs/en/index.html
index e8a393b..b33dac7 100644
--- a/docs/en/index.html
+++ b/docs/en/index.html
@@ -1646,7 +1646,7 @@ You can change the request with rule of course. For this scenario, all you need
     <script>
         var gitbook = gitbook || [];
         gitbook.push(function() {
-            gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"README.md","ref":"README.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"README.md","ref":"README.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"README.md","ref":"README.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"README.md","ref":"README.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"README.md","ref":"README.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:16:28.518Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:16:29.922Z"},"basePath":".","book":{"language":"en"}});
+            gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"README.md","ref":"README.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"README.md","ref":"README.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"README.md","ref":"README.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"README.md","ref":"README.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"README.md","ref":"README.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:17:35.025Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:17:35.950Z"},"basePath":".","book":{"language":"en"}});
         });
     </script>
 </div>
@@ -1656,6 +1656,10 @@ You can change the request with rule of course. For this scenario, all you need
     <script src="../gitbook/theme.js"></script>
     
         
+        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
+        
+    
+        
         <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>