@vandenberghinc/volt 1.2.21 → 1.2.22

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.
@@ -108,8 +108,8 @@ class Stream {
108
108
  }
109
109
  return (Array.isArray(value) ? value[0] : value) || void 0;
110
110
  };
111
- this._ip = unpack_ip_header(this.headers["x-forwarded-for"]) || unpack_ip_header(this.headers["x-real-ip"]) || this.http2 ? this.s.session.socket.remoteAddress : this.req.socket.remoteAddress;
112
- this._port = this.http2 ? this.s.session.socket.remotePort : this.req.socket.remotePort;
111
+ this._ip = unpack_ip_header(this.headers["x-forwarded-for"]) || unpack_ip_header(this.headers["x-real-ip"]) || (this.http2 ? this.s.session?.socket?.remoteAddress : this.req?.socket?.remoteAddress) || "unknown";
112
+ this._port = (this.http2 ? this.s.session?.socket?.remotePort : this.req?.socket?.remotePort) || -1;
113
113
  this.body = "";
114
114
  this.raw_body = Buffer.alloc(0);
115
115
  this.wire_body = Buffer.alloc(0);
@@ -99,8 +99,9 @@ export class Stream {
99
99
  };
100
100
  this._ip = (unpack_ip_header(this.headers['x-forwarded-for'])
101
101
  || unpack_ip_header(this.headers['x-real-ip'])
102
- || this.http2 ? this.s.session.socket.remoteAddress : this.req.socket.remoteAddress);
103
- this._port = this.http2 ? this.s.session.socket.remotePort : this.req.socket.remotePort;
102
+ || (this.http2 ? this.s.session?.socket?.remoteAddress : this.req?.socket?.remoteAddress)
103
+ || "unknown");
104
+ this._port = (this.http2 ? this.s.session?.socket?.remotePort : this.req?.socket?.remotePort) || -1;
104
105
  // Read body.
105
106
  this.body = "";
106
107
  this.raw_body = Buffer.alloc(0);
@@ -99,8 +99,9 @@ export class Stream {
99
99
  };
100
100
  this._ip = (unpack_ip_header(this.headers['x-forwarded-for'])
101
101
  || unpack_ip_header(this.headers['x-real-ip'])
102
- || this.http2 ? this.s.session.socket.remoteAddress : this.req.socket.remoteAddress);
103
- this._port = this.http2 ? this.s.session.socket.remotePort : this.req.socket.remotePort;
102
+ || (this.http2 ? this.s.session?.socket?.remoteAddress : this.req?.socket?.remoteAddress)
103
+ || "unknown");
104
+ this._port = (this.http2 ? this.s.session?.socket?.remotePort : this.req?.socket?.remotePort) || -1;
104
105
  // Read body.
105
106
  this.body = "";
106
107
  this.raw_body = Buffer.alloc(0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Daan van den Bergh",
3
3
  "name": "@vandenberghinc/volt",
4
- "version": "1.2.21",
4
+ "version": "1.2.22",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "types": "./backend/dist/esm/index.d.ts",