Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
node-http-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
node-http-proxy
Commits
ca1d12cf
Commit
ca1d12cf
authored
Sep 08, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] Memory leak hunting.
parent
e1c41d06
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
lib/node-http-proxy.js
lib/node-http-proxy.js
+8
-0
lib/node-http-proxy/http-proxy.js
lib/node-http-proxy/http-proxy.js
+13
-5
No files found.
lib/node-http-proxy.js
View file @
ca1d12cf
...
...
@@ -174,6 +174,14 @@ exports.buffer = function (obj) {
obj
.
removeListener
(
'
data
'
,
onData
);
obj
.
removeListener
(
'
end
'
,
onEnd
);
},
destroy
:
function
()
{
this
.
end
();
this
.
resume
=
function
()
{
console
.
error
(
"
Cannot resume buffer after destroying it.
"
);
};
onData
=
onEnd
=
events
=
obj
=
null
;
},
resume
:
function
()
{
this
.
end
();
for
(
var
i
=
0
,
len
=
events
.
length
;
i
<
len
;
++
i
)
{
...
...
lib/node-http-proxy/http-proxy.js
View file @
ca1d12cf
...
...
@@ -279,9 +279,13 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
}
});
//
// If we have been passed buffered data, resume it.
if
(
buffer
&&
!
errState
)
{
buffer
.
resume
();
//
if
(
buffer
)
{
return
!
errState
?
buffer
.
resume
()
:
buffer
.
destroy
();
}
};
...
...
@@ -419,6 +423,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
reverseProxy
.
incoming
.
socket
.
write
(
data
);
}
catch
(
ex
)
{
detach
();
reverseProxy
.
incoming
.
socket
.
end
();
proxySocket
.
end
();
}
...
...
@@ -429,12 +434,13 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
// Any outgoing data on this Websocket from the proxy target
// will be written to the `proxySocket` socket.
//
reverseProxy
.
incoming
.
socket
.
on
(
'
data
'
,
listeners
.
onOutgoing
=
function
(
data
)
{
reverseProxy
.
incoming
.
socket
.
on
(
'
data
'
,
listeners
.
onOutgoing
=
function
(
data
)
{
try
{
self
.
emit
(
'
websocket:incoming
'
,
reverseProxy
,
reverseProxy
.
incoming
,
head
,
data
);
proxySocket
.
write
(
data
);
}
catch
(
ex
)
{
detach
();
proxySocket
.
end
();
socket
.
end
();
}
...
...
@@ -625,7 +631,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
//
// If we have been passed buffered data, resume it.
//
if
(
buffer
&&
!
errState
)
{
buffer
.
resume
();
if
(
buffer
)
{
return
!
errState
?
buffer
.
resume
()
:
buffer
.
destroy
();
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment