ultimate-express 1.4.1 → 1.4.3

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/README.md CHANGED
@@ -101,6 +101,7 @@ app.listen(3000, () => {
101
101
  ```
102
102
 
103
103
  - This also applies to non-SSL HTTP too. Do not create http server manually, use `app.listen()` instead.
104
+ - NodeJS max header size is 16384 byte, uWebSockets 4096 byte, if you need long headers set the env variable `UWS_HTTP_MAX_HEADERS_SIZE`
104
105
 
105
106
  ## Performance tips
106
107
 
@@ -232,7 +233,7 @@ In general, basically all features and options are supported. Use [Express 4.x d
232
233
  - ✅ req.subdomains
233
234
  - ✅ req.xhr
234
235
  - 🚧 req.route (route implementation is different from Express)
235
- - 🚧 req.connection, req.socket (only `end()`, `encrypted`, `remoteAddress`, `localPort` and `remotePort` are supported)
236
+ - 🚧 req.connection, req.socket (only `end()`, `encrypted`, `remoteAddress` and `localPort` are supported)
236
237
  - ✅ req.accepts()
237
238
  - ✅ req.acceptsCharsets()
238
239
  - ✅ req.acceptsEncodings()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "The Ultimate Express. Fastest http server with full Express compatibility, based on uWebSockets.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/request.js CHANGED
@@ -233,7 +233,7 @@ module.exports = class Request extends Readable {
233
233
  }
234
234
 
235
235
  get parsedIp() {
236
- if(this.#cachedParsedIp) {
236
+ if(this.#cachedParsedIp !== null) {
237
237
  return this.#cachedParsedIp;
238
238
  }
239
239
  const finished = !this.res.socket.writable;
@@ -252,7 +252,7 @@ module.exports = class Request extends Readable {
252
252
  if(this.rawIp.byteLength === 4) {
253
253
  // ipv4
254
254
  ip = this.rawIp.join('.');
255
- } else {
255
+ } else if(this.rawIp.byteLength === 16) {
256
256
  // ipv6
257
257
  const dv = new DataView(this.rawIp);
258
258
  for(let i = 0; i < 8; i++) {
@@ -261,6 +261,8 @@ module.exports = class Request extends Readable {
261
261
  ip += ':';
262
262
  }
263
263
  }
264
+ } else {
265
+ this.#cachedParsedIp = undefined; // unix sockets dont have ip
264
266
  }
265
267
  this.#cachedParsedIp = ip;
266
268
  return ip;
@@ -270,7 +272,6 @@ module.exports = class Request extends Readable {
270
272
  return {
271
273
  remoteAddress: this.parsedIp,
272
274
  localPort: this.app.port,
273
- remotePort: this.app.port,
274
275
  encrypted: this.app.ssl,
275
276
  end: (body) => this.res.end(body)
276
277
  };
package/src/response.js CHANGED
@@ -543,7 +543,7 @@ module.exports = class Response extends Writable {
543
543
  } else {
544
544
  field = field.toLowerCase();
545
545
  if(field === 'set-cookie' && Array.isArray(value)) {
546
- value = value.join('; ');
546
+ value = value.join(', ');
547
547
  } else if(field === 'content-type') {
548
548
  if(!value.includes('charset=') && (value.startsWith('text/') || value === 'application/json' || value === 'application/javascript')) {
549
549
  value += '; charset=utf-8';