whistle 2.10.7 → 2.10.9
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/bin/whistle.js +1 -1
- package/biz/webui/cgi-bin/util.js +1 -1
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +52 -52
- package/biz/webui/lib/index.js +6 -5
- package/lib/config.js +1 -5
- package/lib/index.js +1 -1
- package/lib/inspectors/data.js +1 -1
- package/lib/service/composer.js +5 -6
- package/lib/util/index.js +3 -1
- package/package.json +4 -4
package/biz/webui/lib/index.js
CHANGED
|
@@ -301,9 +301,10 @@ app.use(function(req, res, next) {
|
|
|
301
301
|
if (referer) {
|
|
302
302
|
var refOpts = parseUrl(referer);
|
|
303
303
|
var pathname = refOpts.pathname;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
var match = PLUGIN_PATH_RE.exec(pathname);
|
|
305
|
+
if (match && match[3]) {
|
|
306
|
+
var name = match[2];
|
|
307
|
+
req.url = '/' + match[1] + '.' + name + path;
|
|
307
308
|
PLUGIN_NAMES.set(path, name);
|
|
308
309
|
} else {
|
|
309
310
|
pluginName = config.getPluginNameByHost(refOpts.hostname);
|
|
@@ -400,9 +401,9 @@ function cgiHandler(req, res) {
|
|
|
400
401
|
var notFound = err ? err.code === 'ENOENT' : !stat.isFile();
|
|
401
402
|
var msg;
|
|
402
403
|
if (config.debugMode) {
|
|
403
|
-
msg = util.THEME_STYLE + '<pre>' + (err ? util.encodeHtml(util.getErrorStack(err)) : 'No such
|
|
404
|
+
msg = util.THEME_STYLE + '<pre>' + (err ? util.encodeHtml(util.getErrorStack(err)) : 'No such file') + '</pre>';
|
|
404
405
|
} else {
|
|
405
|
-
msg = notFound ? 'Not
|
|
406
|
+
msg = notFound ? 'Not found' : 'Internal server error';
|
|
406
407
|
}
|
|
407
408
|
return common.sendRes(res, notFound ? 404 : 500, msg);
|
|
408
409
|
}
|
package/lib/config.js
CHANGED
|
@@ -223,10 +223,6 @@ function createAgent(agentConfig, https) {
|
|
|
223
223
|
return agent;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
function capitalize(str) {
|
|
227
|
-
return (str && str[0].toUpperCase()) + str.substring(1);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
226
|
function getHttpsAgent(options, reqOpts) {
|
|
231
227
|
var key = getCacheKey(options);
|
|
232
228
|
var agent = httpsAgents.get(key);
|
|
@@ -234,7 +230,7 @@ function getHttpsAgent(options, reqOpts) {
|
|
|
234
230
|
var headers = options.headers || {};
|
|
235
231
|
var proxyHeaders = {};
|
|
236
232
|
Object.keys(headers).forEach(function (key) {
|
|
237
|
-
var rawKey = key.split('-').map(
|
|
233
|
+
var rawKey = key.split('-').map(common.upperFirst).join('-');
|
|
238
234
|
proxyHeaders[rawKey] = headers[key];
|
|
239
235
|
});
|
|
240
236
|
reqOpts._tunnelProxyHeaders = proxyHeaders;
|
package/lib/index.js
CHANGED
|
@@ -250,7 +250,7 @@ function handleGlobalException(err) {
|
|
|
250
250
|
code === 'ERR_HTTP_TRAILER_INVALID' ||
|
|
251
251
|
code === 'ERR_INTERNAL_ASSERTION' ||
|
|
252
252
|
code === 'ERR_INVALID_ARG_TYPE' ||
|
|
253
|
-
(err && /finishwrite|'_hadError'/i.test(err.message)))
|
|
253
|
+
(err && /finishwrite|'_hadError'|shouldUpgradeCallback/i.test(err.message)))
|
|
254
254
|
) {
|
|
255
255
|
return;
|
|
256
256
|
}
|
package/lib/inspectors/data.js
CHANGED
|
@@ -332,7 +332,7 @@ function emitDataEvents(req, res, proxy) {
|
|
|
332
332
|
var headers = info.headers;
|
|
333
333
|
captureStream = requestTime == null || enable.captureStream;
|
|
334
334
|
if (headers) {
|
|
335
|
-
isSse = headers['content-type'] === 'text/event-stream';
|
|
335
|
+
isSse = util.trimType(headers['content-type']) === 'text/event-stream';
|
|
336
336
|
captureStream = captureStream || isSse;
|
|
337
337
|
resSepInfo = parseFrameSep(headers);
|
|
338
338
|
if (resSepInfo && resSepInfo.sep) {
|
package/lib/service/composer.js
CHANGED
|
@@ -378,16 +378,15 @@ exports.handleRequest = function(req, res) {
|
|
|
378
378
|
}
|
|
379
379
|
delete headers[config.WEBUI_HEAD];
|
|
380
380
|
headers[config.FROM_COM_HEADER] = '1';
|
|
381
|
-
var isTest = reqBody.isTest;
|
|
382
381
|
var testId;
|
|
383
382
|
var enableProxyRules = reqBody.enableProxyRules !== false && !reqBody.disabledGlobalRules;
|
|
384
383
|
reqBody.enableProxyRules = enableProxyRules;
|
|
385
|
-
if (!enableProxyRules
|
|
384
|
+
if (!enableProxyRules) {
|
|
386
385
|
headers[config.DISABLE_RULES_HEADER] = '1';
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
386
|
+
}
|
|
387
|
+
if (reqBody.isTest) {
|
|
388
|
+
testId = ++testIndex + '';
|
|
389
|
+
headers[config.TEST_HEADER] = testId;
|
|
391
390
|
}
|
|
392
391
|
headers.host = options.host;
|
|
393
392
|
options.clientId = clientId;
|
package/lib/util/index.js
CHANGED
|
@@ -1478,9 +1478,11 @@ exports.getUrlValue = function(rule) {
|
|
|
1478
1478
|
};
|
|
1479
1479
|
|
|
1480
1480
|
function _getRawType(type) {
|
|
1481
|
-
return typeof type === 'string' ? type.split(';')[0].toLowerCase() : '';
|
|
1481
|
+
return typeof type === 'string' ? type.split(';')[0].trim().toLowerCase() : '';
|
|
1482
1482
|
}
|
|
1483
1483
|
|
|
1484
|
+
exports.trimType = _getRawType;
|
|
1485
|
+
|
|
1484
1486
|
function getRawType(data) {
|
|
1485
1487
|
return _getRawType(data.headers && data.headers['content-type']);
|
|
1486
1488
|
}
|
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.9",
|
|
5
5
|
"dataDirname": ".whistle",
|
|
6
6
|
"localUIHost": "local.whistlejs.com",
|
|
7
7
|
"port": 8899,
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"url": "https://github.com/avwo/whistle.git"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"adm-zip": "0.
|
|
40
|
+
"adm-zip": "^0.6.0",
|
|
41
41
|
"async-limiter": "2.0.0",
|
|
42
|
-
"body-parser": "^1.20.
|
|
42
|
+
"body-parser": "^1.20.6",
|
|
43
43
|
"colors": "1.1.2",
|
|
44
44
|
"express": "^4.21.2",
|
|
45
45
|
"extend": "^3.0.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"lru-cache": "^4.1.1",
|
|
52
52
|
"mime": "^1.6.0",
|
|
53
53
|
"multer2": "^1.1.1",
|
|
54
|
-
"node-forge": "^1.
|
|
54
|
+
"node-forge": "^1.4.0",
|
|
55
55
|
"node-pac": "^0.5.1",
|
|
56
56
|
"parseurl": "^1.3.1",
|
|
57
57
|
"pfork": "^0.6.3",
|