geonix 1.23.0 → 1.23.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonix",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": {
package/src/Gateway.js CHANGED
@@ -10,7 +10,7 @@ import semver from "semver";
10
10
  import { WebSocket } from "ws";
11
11
  import { logger } from "./Logger.js";
12
12
 
13
- const raw = express.raw({ limit: "100mb" });
13
+ const raw = express.raw({ limit: "1024mb" });
14
14
 
15
15
  const DEBUG_ENDPOINT = "/lZ6jD2eC3iP0zB3jJ1yJ9pM8gG3yI3vS";
16
16
  const endpointMatcher = /^((?<options>.+)\|)?(?<verb>WS|GET|POST|PATCH|PUT|DELETE|HEAD|OPTIONS|ALL)\s(?<url>.*)/;
package/src/Service.js CHANGED
@@ -15,8 +15,8 @@ const isEndpointFilter = methodName => endpointMatcher.test(methodName);
15
15
  const ERROR_BEGIN_DELIMITER = "-".repeat(10);
16
16
  const ERROR_END_DELIMITER = "-".repeat(40);
17
17
 
18
- const json = express.json({ limit: "100mb" });
19
- const raw = express.raw({ type: "*/*", limit: "100mb" });
18
+ const json = express.json({ limit: "1024mb" });
19
+ const raw = express.raw({ type: "*/*", limit: "1024mb" });
20
20
  const cookies = cookieParser();
21
21
 
22
22
  /**
package/src/Util.js CHANGED
@@ -295,43 +295,45 @@ export async function parseMultipart(req, _options) {
295
295
  const boundaryIndex = combined.indexOf(boundary);
296
296
  const isLastBoundary = combined[boundaryIndex + boundary.length] === 45 && combined[boundaryIndex + boundary.length + 1] === 45;
297
297
 
298
- if (boundaryIndex > -1) {
299
- if (boundaryIndex > 0) {
300
- if (options.useMemory) {
301
- activePart.body.push(combined.slice(0, boundaryIndex));
302
- } else {
303
- activePart.body.write(combined.slice(0, boundaryIndex));
304
- }
305
- }
298
+ if (boundaryIndex === -1) {
299
+ break;
300
+ }
306
301
 
307
- if (isLastBoundary) {
308
- combined = combined.slice(boundaryIndex + boundary.length + 2);
309
- done = true;
310
- break;
302
+ if (boundaryIndex > 0) {
303
+ if (options.useMemory) {
304
+ activePart.body.push(combined.slice(0, boundaryIndex));
305
+ } else {
306
+ activePart.body.write(combined.slice(0, boundaryIndex));
311
307
  }
308
+ }
312
309
 
313
- // create new part
314
- const bodyFile = tempFilename();
315
- activePart = {
316
- headers: {},
317
- bodyFile: options.useMemory ? undefined : bodyFile,
318
- body: options.useMemory ? [] : createWriteStream(bodyFile, { flags: "wx" })
319
- };
320
- parts.push(activePart);
321
-
322
- const endOfHeaders = combined.indexOf(END_OF_HEADERS, boundaryIndex);
323
- activePart.headers = combined
324
- .slice(boundaryIndex + boundary.length + 2, endOfHeaders).toString()
325
- .split("\r\n")
326
- .reduce((acc, val) => {
327
- const [header, value] = val.split(": ");
328
- acc[header.toLowerCase()] = value;
329
- return acc;
330
- }, {});
331
-
332
- combined = combined.slice(endOfHeaders + END_OF_HEADERS.length);
310
+ if (isLastBoundary) {
311
+ combined = combined.slice(boundaryIndex + boundary.length + 2);
312
+ done = true;
313
+ break;
333
314
  }
334
315
 
316
+ // create new part
317
+ const bodyFile = tempFilename();
318
+ activePart = {
319
+ headers: {},
320
+ bodyFile: options.useMemory ? undefined : bodyFile,
321
+ body: options.useMemory ? [] : createWriteStream(bodyFile, { flags: "wx" })
322
+ };
323
+ parts.push(activePart);
324
+
325
+ const endOfHeaders = combined.indexOf(END_OF_HEADERS, boundaryIndex);
326
+ activePart.headers = combined
327
+ .slice(boundaryIndex + boundary.length + 2, endOfHeaders).toString()
328
+ .split("\r\n")
329
+ .reduce((acc, val) => {
330
+ const [header, value] = val.split(": ");
331
+ acc[header.toLowerCase()] = value;
332
+ return acc;
333
+ }, {});
334
+
335
+ combined = combined.slice(endOfHeaders + END_OF_HEADERS.length);
336
+
335
337
  lastChunk = combined;
336
338
  }
337
339
 
package/src/WebServer.js CHANGED
@@ -98,17 +98,25 @@ class WebServer {
98
98
 
99
99
  res.on("finish", () => {
100
100
  handled = true;
101
- currentResolve();
101
+ if (currentResolve) {
102
+ currentResolve();
103
+ }
102
104
  });
103
105
 
104
106
  let router = routers.shift();
105
107
  while (router) {
106
- router = await new Promise((resolve) => {
108
+ router = await new Promise((resolve, reject) => {
107
109
  currentResolve = resolve;
108
- router(req, res, () => {
109
- // go to next router
110
- resolve(routers.shift());
111
- });
110
+
111
+ router(req, res,
112
+ (error, _req, _res, _next) => {
113
+ if (error) {
114
+ return reject(error);
115
+ }
116
+
117
+ // go to next router
118
+ resolve(routers.shift());
119
+ });
112
120
  });
113
121
  }
114
122