-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
server listen on unix_socket, if access the req.ip,
will throw the RangeError: Offset is outside the bounds of the DataView. due to req.rawIp is an empty ArrayBuffer(0)
RangeError: Offset is outside the bounds of the DataView
at DataView.prototype.getUint16 (<anonymous>)
at get parsedIp (/home/jimmy/Projects/playground/node_modules/ultimate-express/src/request.js:259:26)
at get ip (/home/jimmy/Projects/playground/node_modules/ultimate-express/src/request.js:174:25)
at /home/jimmy/Projects/playground/unix_socket/index.js:14:19
at next (/home/jimmy/Projects/playground/node_modules/ultimate-express/src/router.js:543:37)
at /home/jimmy/Projects/playground/node_modules/ultimate-express/src/router.js:564:17
at new Promise (<anonymous>)
const express = require('ultimate-express')
const { fetch, Agent } = require('undici');
const http = require('node:http');
const app = express();
app.get('/test', (req, res) => {
res.send('Hello, World!');
});
app.listen('/tmp/app.sock', (t) => {
console.log('Server is running on Unix socket', t);
})
// fetch('http://localhost/test', {
// dispatcher: new Agent({
// connect: {
// socketPath: '/tmp/app.sock'
// }
// })
// }).then(async (resp) => {
// console.log(await resp.text())
// })
http.request({
socketPath: '/tmp/app.sock',
path: '/test',
}, (res) => {
res.on('data', (data) => {
console.log(data.toString());
});
}).end();
- req.(connection|socket).remotePort is wrong
ultimate-express/src/request.js
Lines 272 to 273 in 86c6798
localPort: this.app.port, remotePort: this.app.port,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels