whistle 2.10.6 → 2.10.7
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/assets/menu.html +2 -2
- package/assets/modal.html +2 -2
- package/assets/tab.html +2 -2
- package/bin/api.js +545 -0
- package/bin/import.js +3 -3
- package/bin/plugin.js +4 -8
- package/bin/use.js +22 -8
- package/bin/util.js +10 -5
- package/bin/whistle.js +11 -1
- package/biz/webui/cgi-bin/abort.js +14 -5
- package/biz/webui/cgi-bin/frames.js +12 -0
- package/biz/webui/cgi-bin/is-enabled-https.js +6 -0
- package/biz/webui/cgi-bin/plugins/disable-plugin.js +16 -7
- package/biz/webui/cgi-bin/plugins/list.js +17 -0
- package/biz/webui/cgi-bin/plugins/plugin.js +21 -0
- package/biz/webui/cgi-bin/plugins/status.js +21 -0
- package/biz/webui/cgi-bin/rules/is-multi-select.js +7 -0
- package/biz/webui/cgi-bin/rules/move-top.js +11 -0
- package/biz/webui/cgi-bin/rules/select.js +1 -1
- package/biz/webui/cgi-bin/rules/select2.js +16 -0
- package/biz/webui/cgi-bin/rules/status.js +6 -0
- package/biz/webui/cgi-bin/rules/unselect.js +3 -2
- package/biz/webui/cgi-bin/rules/unselect2.js +18 -0
- package/biz/webui/cgi-bin/rules/value.js +19 -0
- package/biz/webui/cgi-bin/sessions.js +6 -0
- package/biz/webui/cgi-bin/util.js +14 -0
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +32 -32
- package/biz/webui/lib/index.js +1 -3
- package/lib/https/index.js +4 -4
- package/lib/init.js +1 -0
- package/lib/inspectors/data.js +6 -4
- package/lib/inspectors/req.js +1 -2
- package/lib/inspectors/res.js +6 -10
- package/lib/plugins/index.js +2 -2
- package/lib/plugins/load-plugin.js +17 -6
- package/lib/rules/util.js +20 -10
- package/lib/service/composer.js +7 -22
- package/lib/service/data-center.js +0 -12
- package/lib/service/generate-saz.js +2 -2
- package/lib/service/service.js +6 -5
- package/lib/service/util.js +6 -16
- package/lib/socket-mgr.js +23 -17
- package/lib/tunnel.js +7 -17
- package/lib/upgrade.js +4 -8
- package/lib/util/common.js +75 -9
- package/lib/util/data-server.js +273 -0
- package/lib/util/index.js +8 -22
- package/lib/util/patch.js +2 -6
- package/lib/util/speed-transform.js +17 -6
- package/lib/util/whistle-transform.js +18 -7
- package/package.json +10 -7
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var Transform = require('pipestream').Transform;
|
|
2
|
-
var
|
|
2
|
+
var inherits = require('util').inherits;
|
|
3
3
|
var iconv = require('iconv-lite');
|
|
4
4
|
var fileMgr = require('./file-mgr');
|
|
5
|
+
var setDelayTimer = require('./common').setDelayTimer;
|
|
5
6
|
|
|
6
7
|
var DOCTYPE = Buffer.from('<!DOCTYPE html>\r\n');
|
|
7
8
|
|
|
8
|
-
function WhistleTransform(options) {
|
|
9
|
+
function WhistleTransform(options, req) {
|
|
9
10
|
Transform.call(this);
|
|
10
11
|
options = options || {};
|
|
11
12
|
var value = parseInt((options.speed * 1000) / 8);
|
|
@@ -21,6 +22,7 @@ function WhistleTransform(options) {
|
|
|
21
22
|
if (!iconv.encodingExists(charset)) {
|
|
22
23
|
charset = 'utf8';
|
|
23
24
|
}
|
|
25
|
+
this._req = req;
|
|
24
26
|
this._isHtml = options.isHtml;
|
|
25
27
|
this._body = getBuffer(options, 'body', charset);
|
|
26
28
|
this._top = getBuffer(options, 'top', charset);
|
|
@@ -42,7 +44,16 @@ function getBuffer(options, name, charset) {
|
|
|
42
44
|
return iconv.encode(buf + '', charset);
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
inherits(WhistleTransform, Transform);
|
|
48
|
+
|
|
49
|
+
var proto = WhistleTransform.prototype;
|
|
50
|
+
|
|
51
|
+
proto._setTimeout = function (callback, delay) {
|
|
52
|
+
var timer = setTimeout(callback, delay);
|
|
53
|
+
if (this._req) {
|
|
54
|
+
setDelayTimer(this._req, timer);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
46
57
|
|
|
47
58
|
function filterHtml(list, isSafe) {
|
|
48
59
|
if (!Array.isArray(list)) {
|
|
@@ -64,7 +75,7 @@ function joinData(list) {
|
|
|
64
75
|
return Array.isArray(list) ? fileMgr.joinData(list) : list;
|
|
65
76
|
}
|
|
66
77
|
|
|
67
|
-
|
|
78
|
+
proto.allowInject = function (chunk) {
|
|
68
79
|
if (!this._isHtml) {
|
|
69
80
|
return true;
|
|
70
81
|
}
|
|
@@ -88,7 +99,7 @@ WhistleTransform.prototype.allowInject = function (chunk) {
|
|
|
88
99
|
return true;
|
|
89
100
|
};
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
proto._transform = function (chunk, encoding, callback) {
|
|
92
103
|
var self = this;
|
|
93
104
|
var cb = function () {
|
|
94
105
|
if (self._allowInject && self._ended && self._bottom) {
|
|
@@ -96,7 +107,7 @@ WhistleTransform.prototype._transform = function (chunk, encoding, callback) {
|
|
|
96
107
|
self._bottom = null;
|
|
97
108
|
}
|
|
98
109
|
if (chunk && self._speed) {
|
|
99
|
-
|
|
110
|
+
self._setTimeout(function () {
|
|
100
111
|
callback(null, chunk);
|
|
101
112
|
}, Math.round((chunk.length * 1000) / self._speed));
|
|
102
113
|
} else {
|
|
@@ -126,7 +137,7 @@ WhistleTransform.prototype._transform = function (chunk, encoding, callback) {
|
|
|
126
137
|
self._top = null;
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
|
-
return self._delay ?
|
|
140
|
+
return self._delay ? self._setTimeout(cb, self._delay) : cb();
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
if (self._ended) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whistle",
|
|
3
3
|
"description": "HTTP, HTTP2, HTTPS, Websocket debugging proxy",
|
|
4
|
-
"version": "2.10.
|
|
4
|
+
"version": "2.10.7",
|
|
5
5
|
"dataDirname": ".whistle",
|
|
6
6
|
"localUIHost": "local.whistlejs.com",
|
|
7
7
|
"port": 8899,
|
|
@@ -15,14 +15,17 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://wproxy.org",
|
|
17
17
|
"keywords": [
|
|
18
|
-
"proxy",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"http-proxy",
|
|
19
|
+
"https-proxy",
|
|
20
|
+
"web-debugging",
|
|
21
|
+
"network-debugging",
|
|
22
|
+
"http-interceptor",
|
|
23
|
+
"api-mocking",
|
|
21
24
|
"websocket",
|
|
22
25
|
"http2",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"mitm",
|
|
27
|
+
"fiddler-alternative",
|
|
28
|
+
"charles-alternative"
|
|
26
29
|
],
|
|
27
30
|
"bin": {
|
|
28
31
|
"whistle": "./bin/whistle.js",
|