ultimate-express 1.4.0 → 1.4.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/README.md +1 -1
- package/package.json +1 -1
- package/src/application.js +3 -1
- package/src/request.js +4 -3
- package/src/types.d.ts +2 -0
package/README.md
CHANGED
|
@@ -232,7 +232,7 @@ In general, basically all features and options are supported. Use [Express 4.x d
|
|
|
232
232
|
- ✅ req.subdomains
|
|
233
233
|
- ✅ req.xhr
|
|
234
234
|
- 🚧 req.route (route implementation is different from Express)
|
|
235
|
-
- 🚧 req.connection, req.socket (only `end()`, `encrypted`, `remoteAddress
|
|
235
|
+
- 🚧 req.connection, req.socket (only `end()`, `encrypted`, `remoteAddress` and `localPort` are supported)
|
|
236
236
|
- ✅ req.accepts()
|
|
237
237
|
- ✅ req.acceptsCharsets()
|
|
238
238
|
- ✅ req.acceptsEncodings()
|
package/package.json
CHANGED
package/src/application.js
CHANGED
|
@@ -55,7 +55,9 @@ class Application extends Router {
|
|
|
55
55
|
if(typeof settings.threads !== 'number') {
|
|
56
56
|
settings.threads = cpuCount > 1 ? 1 : 0;
|
|
57
57
|
}
|
|
58
|
-
if(settings.
|
|
58
|
+
if(settings.uwsApp) {
|
|
59
|
+
this.uwsApp = settings.uwsApp;
|
|
60
|
+
} else if(settings.http3) {
|
|
59
61
|
if(!settings.uwsOptions.key_file_name || !settings.uwsOptions.cert_file_name) {
|
|
60
62
|
throw new Error('uwsOptions.key_file_name and uwsOptions.cert_file_name are required for HTTP/3');
|
|
61
63
|
}
|
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
|
};
|