kuzzle 2.17.7 → 2.18.1
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/start-kuzzle-server +1 -1
- package/lib/api/controllers/adminController.js +1 -1
- package/lib/api/controllers/authController.js +9 -3
- package/lib/api/controllers/baseController.js +1 -1
- package/lib/api/controllers/bulkController.js +1 -1
- package/lib/api/controllers/clusterController.js +1 -1
- package/lib/api/controllers/collectionController.js +1 -1
- package/lib/api/controllers/documentController.js +13 -4
- package/lib/api/controllers/index.js +1 -1
- package/lib/api/controllers/indexController.js +11 -7
- package/lib/api/controllers/memoryStorageController.js +1 -1
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +80 -42
- package/lib/api/controllers/serverController.js +3 -2
- package/lib/api/documentExtractor.js +3 -2
- package/lib/api/funnel.js +1 -1
- package/lib/api/httpRoutes.js +7 -5
- package/lib/api/openapi/OpenApiManager.js +5 -1
- package/lib/api/openapi/components/document/get.yaml +1 -1
- package/lib/api/openapi/components/document/index.d.ts +2 -0
- package/lib/api/openapi/components/document/index.js +6 -1
- package/lib/api/openapi/components/document/mCreateOrReplace.yaml +93 -0
- package/lib/api/openapi/components/document/update.yaml +1 -1
- package/lib/api/openapi/components/index.d.ts +1 -0
- package/lib/api/openapi/components/index.js +1 -0
- package/lib/api/openapi/components/security/index.d.ts +2 -0
- package/lib/api/openapi/components/security/index.js +10 -0
- package/lib/api/openapi/components/security/upsertUser.yaml +59 -0
- package/lib/api/openapi/openApiGenerator.js +1 -1
- package/lib/api/rateLimiter.js +1 -1
- package/lib/api/request/kuzzleRequest.d.ts +46 -0
- package/lib/api/request/kuzzleRequest.js +147 -19
- package/lib/api/request/requestContext.js +1 -1
- package/lib/api/request/requestInput.js +1 -1
- package/lib/api/request/requestResponse.js +26 -1
- package/lib/cluster/command.js +1 -1
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/cluster/index.js +1 -1
- package/lib/cluster/node.js +8 -8
- package/lib/cluster/publisher.js +1 -1
- package/lib/cluster/state.js +1 -1
- package/lib/cluster/subscriber.js +4 -1
- package/lib/config/documentEventAliases.js +1 -1
- package/lib/config/index.js +1 -1
- package/lib/core/auth/formatProcessing.js +1 -1
- package/lib/core/auth/passportResponse.js +1 -1
- package/lib/core/auth/passportWrapper.js +1 -1
- package/lib/core/auth/tokenManager.js +1 -1
- package/lib/core/backend/applicationManager.js +1 -1
- package/lib/core/backend/backend.js +1 -1
- package/lib/core/backend/backendCluster.js +1 -1
- package/lib/core/backend/backendConfig.js +1 -1
- package/lib/core/backend/backendController.d.ts +7 -1
- package/lib/core/backend/backendController.js +16 -4
- package/lib/core/backend/backendErrors.js +1 -1
- package/lib/core/backend/backendHook.js +1 -1
- package/lib/core/backend/backendImport.js +1 -1
- package/lib/core/backend/backendOpenApi.js +1 -1
- package/lib/core/backend/backendPipe.js +1 -1
- package/lib/core/backend/backendPlugin.js +1 -1
- package/lib/core/backend/backendStorage.js +1 -1
- package/lib/core/backend/backendVault.js +1 -1
- package/lib/core/backend/internalLogger.js +1 -1
- package/lib/core/cache/cacheDbEnum.js +1 -1
- package/lib/core/cache/cacheEngine.js +1 -1
- package/lib/core/network/accessLogger.js +1 -1
- package/lib/core/network/clientConnection.js +1 -1
- package/lib/core/network/context.js +1 -1
- package/lib/core/network/entryPoint.js +6 -6
- package/lib/core/network/httpRouter/index.js +1 -1
- package/lib/core/network/httpRouter/routeHandler.js +1 -1
- package/lib/core/network/httpRouter/routePart.js +1 -1
- package/lib/core/network/protocolManifest.js +1 -1
- package/lib/core/network/protocols/httpMessage.js +1 -1
- package/lib/core/network/protocols/httpwsProtocol.js +13 -16
- package/lib/core/network/protocols/internalProtocol.js +1 -1
- package/lib/core/network/protocols/mqttProtocol.js +4 -3
- package/lib/core/network/protocols/protocol.js +1 -1
- package/lib/core/network/router.js +11 -2
- package/lib/core/plugin/plugin.js +8 -1
- package/lib/core/plugin/pluginContext.js +1 -1
- package/lib/core/plugin/pluginManifest.js +1 -1
- package/lib/core/plugin/pluginRepository.js +1 -1
- package/lib/core/plugin/pluginsManager.js +1 -1
- package/lib/core/plugin/privilegedContext.js +1 -1
- package/lib/core/realtime/actionEnum.js +1 -1
- package/lib/core/realtime/channel.js +1 -1
- package/lib/core/realtime/connectionRooms.js +1 -1
- package/lib/core/realtime/hotelClerk.js +66 -24
- package/lib/core/realtime/index.js +1 -1
- package/lib/core/realtime/notification/document.js +1 -1
- package/lib/core/realtime/notification/index.js +1 -1
- package/lib/core/realtime/notification/server.js +1 -1
- package/lib/core/realtime/notification/user.js +1 -1
- package/lib/core/realtime/notifier.js +1 -1
- package/lib/core/realtime/room.js +1 -1
- package/lib/core/realtime/subscription.js +1 -1
- package/lib/core/security/index.js +1 -1
- package/lib/core/security/profileRepository.js +1 -1
- package/lib/core/security/roleRepository.js +1 -1
- package/lib/core/security/securityLoader.js +1 -1
- package/lib/core/security/tokenRepository.js +1 -1
- package/lib/core/security/userRepository.js +1 -1
- package/lib/core/shared/KoncordeWrapper.js +1 -1
- package/lib/core/shared/abstractManifest.js +1 -1
- package/lib/core/shared/repository.js +1 -1
- package/lib/core/shared/sdk/embeddedSdk.d.ts +2 -2
- package/lib/core/shared/sdk/embeddedSdk.js +4 -3
- package/lib/core/shared/sdk/funnelProtocol.d.ts +13 -0
- package/lib/core/shared/sdk/funnelProtocol.js +76 -81
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +1 -1
- package/lib/core/statistics/index.js +1 -1
- package/lib/core/statistics/statistics.js +1 -1
- package/lib/core/storage/clientAdapter.js +1 -1
- package/lib/core/storage/indexCache.js +1 -1
- package/lib/core/storage/storageEngine.js +1 -1
- package/lib/core/storage/storeScopeEnum.js +1 -1
- package/lib/core/validation/baseType.js +1 -1
- package/lib/core/validation/index.js +1 -1
- package/lib/core/validation/types/anything.js +1 -1
- package/lib/core/validation/types/boolean.js +1 -1
- package/lib/core/validation/types/date.js +1 -1
- package/lib/core/validation/types/email.js +1 -1
- package/lib/core/validation/types/enum.js +1 -1
- package/lib/core/validation/types/geoPoint.js +1 -1
- package/lib/core/validation/types/geoShape.js +1 -1
- package/lib/core/validation/types/integer.js +1 -1
- package/lib/core/validation/types/ipAddress.js +1 -1
- package/lib/core/validation/types/numeric.js +1 -1
- package/lib/core/validation/types/object.js +1 -1
- package/lib/core/validation/types/string.js +1 -1
- package/lib/core/validation/types/url.js +1 -1
- package/lib/core/validation/validation.js +1 -1
- package/lib/kerror/codes/1-services.json +1 -1
- package/lib/kerror/codes/index.js +1 -1
- package/lib/kerror/errors/badRequestError.js +1 -1
- package/lib/kerror/errors/externalServiceError.js +1 -1
- package/lib/kerror/errors/forbiddenError.js +1 -1
- package/lib/kerror/errors/gatewayTimeoutError.js +1 -1
- package/lib/kerror/errors/index.js +1 -1
- package/lib/kerror/errors/internalError.js +1 -1
- package/lib/kerror/errors/kuzzleError.d.ts +1 -1
- package/lib/kerror/errors/kuzzleError.js +1 -1
- package/lib/kerror/errors/multipleErrorsError.js +1 -1
- package/lib/kerror/errors/notFoundError.js +1 -1
- package/lib/kerror/errors/partialError.js +1 -1
- package/lib/kerror/errors/pluginImplementationError.js +1 -1
- package/lib/kerror/errors/preconditionError.js +1 -1
- package/lib/kerror/errors/serviceUnavailableError.js +1 -1
- package/lib/kerror/errors/sizeLimitError.js +1 -1
- package/lib/kerror/errors/tooManyRequestsError.js +1 -1
- package/lib/kerror/errors/unauthorizedError.js +1 -1
- package/lib/kerror/index.js +2 -4
- package/lib/kuzzle/dumpGenerator.js +1 -1
- package/lib/kuzzle/event/kuzzleEventEmitter.js +39 -1
- package/lib/kuzzle/event/pipeRunner.js +1 -1
- package/lib/kuzzle/event/waterfall.js +1 -1
- package/lib/kuzzle/index.js +1 -1
- package/lib/kuzzle/internalIndexHandler.js +1 -1
- package/lib/kuzzle/kuzzle.js +1 -1
- package/lib/kuzzle/kuzzleStateEnum.js +1 -1
- package/lib/kuzzle/log.js +1 -1
- package/lib/kuzzle/vault.js +1 -1
- package/lib/model/security/profile.js +1 -1
- package/lib/model/security/rights.js +1 -1
- package/lib/model/security/role.js +1 -1
- package/lib/model/security/token.js +1 -1
- package/lib/model/security/user.js +6 -7
- package/lib/model/storage/apiKey.js +1 -1
- package/lib/model/storage/baseModel.js +1 -1
- package/lib/service/cache/redis.js +1 -1
- package/lib/service/service.js +1 -1
- package/lib/service/storage/elasticsearch.js +108 -39
- package/lib/service/storage/esWrapper.js +1 -1
- package/lib/service/storage/queryTranslator.js +1 -1
- package/lib/types/Controller.js +1 -1
- package/lib/types/ControllerDefinition.js +1 -1
- package/lib/types/Deprecation.js +1 -1
- package/lib/types/EventHandler.js +1 -1
- package/lib/types/KuzzleDocument.d.ts +3 -0
- package/lib/types/Plugin.js +1 -1
- package/lib/types/PluginManifest.js +1 -1
- package/lib/types/RequestPayload.js +1 -1
- package/lib/types/ResponsePayload.js +1 -1
- package/lib/types/StrategyDefinition.js +1 -1
- package/lib/types/Token.js +1 -1
- package/lib/types/User.js +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +1 -2
- package/lib/util/array.js +1 -1
- package/lib/util/assertType.js +1 -1
- package/lib/util/asyncStore.js +1 -1
- package/lib/util/debug.js +1 -1
- package/lib/util/deprecate.js +1 -1
- package/lib/util/didYouMean.js +1 -1
- package/lib/util/dump-collection.d.ts +35 -0
- package/lib/util/dump-collection.js +11 -8
- package/lib/util/extractFields.js +1 -1
- package/lib/util/inflector.js +1 -1
- package/lib/util/koncordeCompat.js +1 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/mutex.js +1 -1
- package/lib/util/name-generator.js +1 -1
- package/lib/util/promback.js +1 -1
- package/lib/util/requestAssertions.js +1 -1
- package/lib/util/safeObject.js +1 -1
- package/lib/util/stackTrace.js +56 -17
- package/lib/util/wildcard.js +1 -1
- package/package-lock.json +102 -83
- package/package.json +18 -17
- package/lib/core/network/removeErrorStack.js +0 -56
package/lib/cluster/command.js
CHANGED
package/lib/cluster/index.js
CHANGED
package/lib/cluster/node.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -757,15 +757,15 @@ class ClusterNode {
|
|
|
757
757
|
'admin:afterRefreshIndexCache',
|
|
758
758
|
() => this.onIndexCacheRefreshed());
|
|
759
759
|
|
|
760
|
-
global.kuzzle.
|
|
760
|
+
global.kuzzle.onCall(
|
|
761
761
|
'core:realtime:room:create:after',
|
|
762
762
|
payload => this.onNewRealtimeRoom(payload));
|
|
763
763
|
|
|
764
|
-
global.kuzzle.
|
|
764
|
+
global.kuzzle.onCall(
|
|
765
765
|
'core:realtime:subscribe:after',
|
|
766
766
|
roomId => this.onNewSubscription(roomId));
|
|
767
767
|
|
|
768
|
-
global.kuzzle.
|
|
768
|
+
global.kuzzle.onCall(
|
|
769
769
|
'core:realtime:unsubscribe:after',
|
|
770
770
|
roomId => this.onUnsubscription(roomId));
|
|
771
771
|
|
|
@@ -922,15 +922,15 @@ class ClusterNode {
|
|
|
922
922
|
* @param {string} roomId
|
|
923
923
|
* @return {void}
|
|
924
924
|
*/
|
|
925
|
-
|
|
926
|
-
const messageId =
|
|
927
|
-
|
|
925
|
+
removeRealtimeRoom (roomId) {
|
|
926
|
+
const messageId = this.publisher.sendRemoveRealtimeRoom(roomId);
|
|
927
|
+
|
|
928
928
|
debug(
|
|
929
929
|
'[%s] Broadcasted the removal of room %s (message: %d)',
|
|
930
930
|
this.nodeId,
|
|
931
931
|
roomId,
|
|
932
932
|
messageId);
|
|
933
|
-
|
|
933
|
+
|
|
934
934
|
this.fullState.removeRealtimeRoom(roomId, this.nodeId);
|
|
935
935
|
}
|
|
936
936
|
|
package/lib/cluster/publisher.js
CHANGED
package/lib/cluster/state.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -216,6 +216,9 @@ class ClusterSubscriber {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
try {
|
|
219
|
+
// If we are receiving messages from a node,
|
|
220
|
+
// it means the node is alive so it should counts as an heartbeat
|
|
221
|
+
this.handleHeartbeat();
|
|
219
222
|
await this.handlers[topic].call(this, message);
|
|
220
223
|
}
|
|
221
224
|
catch (e) {
|
package/lib/config/index.js
CHANGED
|
@@ -86,5 +86,11 @@ export declare class BackendController extends ApplicationManager {
|
|
|
86
86
|
* @param controller Controller class
|
|
87
87
|
*/
|
|
88
88
|
use(controller: Controller): void;
|
|
89
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Adds the controller definition to the list of application controllers.
|
|
91
|
+
*
|
|
92
|
+
* This method also check if the definition is valid to throw with a stacktrace
|
|
93
|
+
* beginning on the user code adding the controller.
|
|
94
|
+
*/
|
|
95
|
+
private add;
|
|
90
96
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
4
4
|
* to power modern apps
|
|
5
5
|
*
|
|
6
|
-
* Copyright 2015-
|
|
6
|
+
* Copyright 2015-2022 Kuzzle
|
|
7
7
|
* mailto: support AT kuzzle.io
|
|
8
8
|
* website: http://kuzzle.io
|
|
9
9
|
*
|
|
@@ -42,11 +42,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
42
42
|
__setModuleDefault(result, mod);
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
45
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
49
|
exports.BackendController = void 0;
|
|
47
50
|
const inflector_1 = require("../../util/inflector");
|
|
48
51
|
const kerror = __importStar(require("../../kerror"));
|
|
49
52
|
const index_1 = require("./index");
|
|
53
|
+
const plugin_1 = __importDefault(require("../plugin/plugin"));
|
|
50
54
|
const assertionError = kerror.wrap('plugin', 'assert');
|
|
51
55
|
const runtimeError = kerror.wrap('plugin', 'runtime');
|
|
52
56
|
class BackendController extends index_1.ApplicationManager {
|
|
@@ -74,7 +78,8 @@ class BackendController extends index_1.ApplicationManager {
|
|
|
74
78
|
if (this._application.started) {
|
|
75
79
|
throw runtimeError.get('already_started', 'controller');
|
|
76
80
|
}
|
|
77
|
-
|
|
81
|
+
plugin_1.default.checkControllerDefinition(name, definition);
|
|
82
|
+
this.add(name, definition);
|
|
78
83
|
}
|
|
79
84
|
/**
|
|
80
85
|
* Uses a new controller class.
|
|
@@ -147,6 +152,7 @@ class BackendController extends index_1.ApplicationManager {
|
|
|
147
152
|
controller.name = inflector_1.Inflector.kebabCase(controller.constructor.name)
|
|
148
153
|
.replace('-controller', '');
|
|
149
154
|
}
|
|
155
|
+
plugin_1.default.checkControllerDefinition(controller.name, controller.definition);
|
|
150
156
|
for (const [action, definition] of Object.entries(controller.definition.actions)) {
|
|
151
157
|
if (typeof definition.handler !== 'function') {
|
|
152
158
|
throw assertionError.get('invalid_controller_definition', controller.name, `Handler for action "${action}" is not a function.`);
|
|
@@ -158,9 +164,15 @@ class BackendController extends index_1.ApplicationManager {
|
|
|
158
164
|
definition.handler = definition.handler.bind(controller);
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
|
-
this.
|
|
167
|
+
this.add(controller.name, controller.definition);
|
|
162
168
|
}
|
|
163
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Adds the controller definition to the list of application controllers.
|
|
171
|
+
*
|
|
172
|
+
* This method also check if the definition is valid to throw with a stacktrace
|
|
173
|
+
* beginning on the user code adding the controller.
|
|
174
|
+
*/
|
|
175
|
+
add(name, definition) {
|
|
164
176
|
if (this._application._controllers[name]) {
|
|
165
177
|
throw assertionError.get('invalid_controller_definition', name, 'A controller with this name already exists');
|
|
166
178
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -33,7 +33,7 @@ const MqttProtocol = require('./protocols/mqttProtocol');
|
|
|
33
33
|
const InternalProtocol = require('./protocols/internalProtocol');
|
|
34
34
|
const HttpWsProtocol = require('./protocols/httpwsProtocol');
|
|
35
35
|
const Manifest = require('./protocolManifest');
|
|
36
|
-
const
|
|
36
|
+
const { removeStacktrace } = require('../../util/stackTrace');
|
|
37
37
|
const kerror = require('../../kerror');
|
|
38
38
|
const { AccessLogger } = require('./accessLogger');
|
|
39
39
|
|
|
@@ -256,7 +256,7 @@ class EntryPoint {
|
|
|
256
256
|
|
|
257
257
|
const response = _res.response.toJSON();
|
|
258
258
|
|
|
259
|
-
cb(
|
|
259
|
+
cb(removeStacktrace(response));
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -298,7 +298,7 @@ class EntryPoint {
|
|
|
298
298
|
// --------------------------------------------------------------------
|
|
299
299
|
|
|
300
300
|
_broadcast (data) {
|
|
301
|
-
const sanitized =
|
|
301
|
+
const sanitized = removeStacktrace(data);
|
|
302
302
|
|
|
303
303
|
debug('[server] broadcasting data through all protocols: %a', sanitized);
|
|
304
304
|
|
|
@@ -316,7 +316,7 @@ class EntryPoint {
|
|
|
316
316
|
request.setError(networkError.get('shutting_down'));
|
|
317
317
|
this.logAccess(connection, request);
|
|
318
318
|
|
|
319
|
-
cb(
|
|
319
|
+
cb(removeStacktrace(request.response.toJSON()));
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
_notify (data) {
|
|
@@ -332,7 +332,7 @@ class EntryPoint {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
try {
|
|
335
|
-
this.protocols.get(client.protocol).notify(
|
|
335
|
+
this.protocols.get(client.protocol).notify(removeStacktrace(data));
|
|
336
336
|
}
|
|
337
337
|
catch (e) {
|
|
338
338
|
global.kuzzle.log.error(`[notify] protocol ${client.protocol} failed: ${e.message}`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -32,7 +32,7 @@ const { Request } = require('../../../api/request');
|
|
|
32
32
|
const { KuzzleError } = require('../../../kerror/errors');
|
|
33
33
|
const Protocol = require('./protocol');
|
|
34
34
|
const ClientConnection = require('../clientConnection');
|
|
35
|
-
const
|
|
35
|
+
const { removeStacktrace } = require('../../../util/stackTrace');
|
|
36
36
|
const debug = require('../../../util/debug');
|
|
37
37
|
const kerror = require('../../../kerror');
|
|
38
38
|
const HttpMessage = require('./httpMessage');
|
|
@@ -256,10 +256,15 @@ class HttpWsProtocol extends Protocol {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
wsOnUpgradeHandler (res, req, context) {
|
|
259
|
+
const headers = {};
|
|
260
|
+
// Extract headers from uWS request
|
|
261
|
+
req.forEach((header, value) => {
|
|
262
|
+
headers[header] = value;
|
|
263
|
+
});
|
|
264
|
+
|
|
259
265
|
res.upgrade(
|
|
260
266
|
{
|
|
261
|
-
|
|
262
|
-
origin: req.getHeader('origin'),
|
|
267
|
+
headers,
|
|
263
268
|
},
|
|
264
269
|
req.getHeader('sec-websocket-key'),
|
|
265
270
|
req.getHeader('sec-websocket-protocol'),
|
|
@@ -273,10 +278,7 @@ class HttpWsProtocol extends Protocol {
|
|
|
273
278
|
const connection = new ClientConnection(
|
|
274
279
|
this.name,
|
|
275
280
|
[ip],
|
|
276
|
-
|
|
277
|
-
cookie: socket.cookie,
|
|
278
|
-
origin: socket.origin
|
|
279
|
-
}
|
|
281
|
+
socket.headers
|
|
280
282
|
);
|
|
281
283
|
|
|
282
284
|
this.entryPoint.newConnection(connection);
|
|
@@ -412,7 +414,7 @@ class HttpWsProtocol extends Protocol {
|
|
|
412
414
|
// If a requestId is provided we use it instead of the generated one
|
|
413
415
|
request.id = requestId || request.id;
|
|
414
416
|
|
|
415
|
-
const sanitized =
|
|
417
|
+
const sanitized = removeStacktrace(request.response.toJSON()).content;
|
|
416
418
|
|
|
417
419
|
this.wsSend(socket, Buffer.from(JSON.stringify(sanitized)));
|
|
418
420
|
}
|
|
@@ -831,7 +833,7 @@ class HttpWsProtocol extends Protocol {
|
|
|
831
833
|
? error
|
|
832
834
|
: kerrorHTTP.getFrom(error, 'unexpected_error', error.message);
|
|
833
835
|
|
|
834
|
-
const content = Buffer.from(JSON.stringify(
|
|
836
|
+
const content = Buffer.from(JSON.stringify(removeStacktrace(kerr)));
|
|
835
837
|
|
|
836
838
|
debugHTTP('[%s] httpSendError: %a', message.connection.id, kerr);
|
|
837
839
|
|
|
@@ -866,11 +868,6 @@ class HttpWsProtocol extends Protocol {
|
|
|
866
868
|
}
|
|
867
869
|
}
|
|
868
870
|
|
|
869
|
-
|
|
870
|
-
response.writeHeader(
|
|
871
|
-
HTTP_HEADER_CONTENT_LENGTH,
|
|
872
|
-
Buffer.from(content.length.toString()));
|
|
873
|
-
|
|
874
871
|
response.end(content);
|
|
875
872
|
});
|
|
876
873
|
}
|
|
@@ -884,7 +881,7 @@ class HttpWsProtocol extends Protocol {
|
|
|
884
881
|
* @returns {Buffer}
|
|
885
882
|
*/
|
|
886
883
|
httpRequestToResponse (request, message) {
|
|
887
|
-
let data =
|
|
884
|
+
let data = removeStacktrace(request.response.toJSON());
|
|
888
885
|
|
|
889
886
|
if (message.requestId !== data.requestId) {
|
|
890
887
|
data.requestId = message.requestId;
|