whistle 2.9.10 → 2.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biz/index.js +10 -1
- package/biz/webui/cgi-bin/util.js +1 -0
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +7 -7
- package/index.d.ts +1 -0
- package/lib/config.js +6 -0
- package/lib/https/h2.js +1 -1
- package/lib/https/index.js +14 -13
- package/lib/inspectors/data.js +2 -1
- package/lib/inspectors/res.js +26 -16
- package/lib/plugins/index.js +1 -1
- package/lib/plugins/load-plugin.js +6 -1
- package/lib/rules/index.js +13 -30
- package/lib/rules/rules.js +35 -24
- package/lib/tunnel.js +9 -4
- package/lib/util/index.js +102 -14
- package/lib/util/patch.js +16 -11
- package/package.json +2 -2
package/biz/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var CUSTOM_REAL_WEBUI_HOST = new RegExp('^/[\\w.-]*\\.whistle-path\\.5b6af7b9884
|
|
|
18
18
|
var CUSTOM_INTERNAL_APP = new RegExp('^/[\\w.-]*\\.whistle-path\\.5b6af7b9884e1165[\\w.-]*/+(log|weinre|cgi)(?:\\.(\\d{1,5}))?/');
|
|
19
19
|
var CUSTOM_PLUGIN_RE = new RegExp('^/[\\w.-]*\\.whistle-path\\.5b6af7b9884e1165[\\w.-]*/+whistle\\.([a-z\\d_-]+)/');
|
|
20
20
|
var REAL_WEBUI_HOST_PARAM = /_whistleInternalHost_=(__([a-z\d.-]+)(?:__(\d{1,5}))?__)/;
|
|
21
|
+
var OUTER_PLUGIN_RE = /^(?:\/whistle)?\/((?:whistle|plugin)\.[a-z\\d_-]+)::(\d{1,5})\//;
|
|
21
22
|
|
|
22
23
|
module.exports = function(req, res, next) {
|
|
23
24
|
var config = this.config;
|
|
@@ -118,8 +119,16 @@ module.exports = function(req, res, next) {
|
|
|
118
119
|
if (isOthers) {
|
|
119
120
|
util.transformReq(req, res, transformPort);
|
|
120
121
|
} else {
|
|
121
|
-
req._hasRespond = true;
|
|
122
122
|
req.url = req.url.replace(transformPort ? internalAppRe : webUI, '/');
|
|
123
|
+
if (OUTER_PLUGIN_RE.test(req.path)) {
|
|
124
|
+
var outerPort = RegExp.$2;
|
|
125
|
+
req.url = req.url.replace(RegExp['$&'], '/' + RegExp.$1 + '/');
|
|
126
|
+
if (outerPort > 0 && outerPort < 65536 && outerPort != config.port) {
|
|
127
|
+
req.headers.host = '127.0.0.1:' + outerPort;
|
|
128
|
+
return util.transformReq(req, res, outerPort);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
req._hasRespond = true;
|
|
123
132
|
if (isWeinre) {
|
|
124
133
|
handleWeinreReq(req, res);
|
|
125
134
|
} else {
|