Skip to content

Commit 1b0bd98

Browse files
Fixed all the issues with deallocation of request
1 parent bf6313c commit 1b0bd98

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uquik",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "uQuik HTTP(S) framework",
55
"main": "index.js",
66
"scripts": {

src/Request.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ class Request extends Readable {
2525

2626
this.locals = {}
2727

28+
// IMPORTANT TO GET ALL THE DATA!
2829
this.method = this.raw_request.getMethod().toUpperCase()
2930
this.path = this.raw_request.getUrl()
31+
this._remote_ip = this.raw_response.getRemoteAddress()
32+
this._remote_proxy_ip = this.raw_response.getProxiedRemoteAddress()
3033

3134
route.requestDecorators.forEach((decorator, name) => (this[name] = decorator))
3235

@@ -613,7 +616,7 @@ class Request extends Readable {
613616
*/
614617
get ip () {
615618
// Convert Remote IP to string on first access
616-
if (typeof this.remote_ip !== 'string') this.remote_ip = getIP(this.raw_response.getRemoteAddress())
619+
if (typeof this.remote_ip !== 'string') this.remote_ip = getIP(this._remote_ip)
617620

618621
return this.remote_ip
619622
}
@@ -624,7 +627,7 @@ class Request extends Readable {
624627
*/
625628
get proxy_ip () {
626629
// Convert Remote Proxy IP to string on first access
627-
if (typeof this.remote_proxy_ip !== 'string') this.remote_proxy_ip = getIP(this.raw_response.getProxiedRemoteAddress())
630+
if (typeof this.remote_proxy_ip !== 'string') this.remote_proxy_ip = getIP(this._remote_proxy_ip)
628631

629632
return this.remote_proxy_ip
630633
}

src/Response.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ class Response extends Writable {
6060
if (position > this.middleware_cursor) return (this.middleware_cursor = position)
6161

6262
// If position is not greater than last cursor then we likely have a double middleware execution
63-
this.throw(
64-
new Error(
65-
'Double middleware execution detected! You have a bug where one of your middlewares is calling both the next() callback and also resolving from a Promise/async middleware. You must only use one of these not both.'
66-
)
67-
)
63+
this.throw(new Error('Double middleware execution detected! You have a bug where one of your middlewares is calling both the next() callback and also resolving from a Promise/async middleware. You must only use one of these not both.'))
6864
}
6965

7066
/**

0 commit comments

Comments
 (0)