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
f4fcf934
Commit
f4fcf934
authored
Aug 30, 2011
by
isaacs
Committed by
indexzero
Aug 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memory leak hunting.
Detach listeners and clean up buffer on error
parent
7beead54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
lib/node-http-proxy.js
lib/node-http-proxy.js
+21
-7
No files found.
lib/node-http-proxy.js
View file @
f4fcf934
...
@@ -344,6 +344,13 @@ HttpProxy.prototype.buffer = function (obj) {
...
@@ -344,6 +344,13 @@ HttpProxy.prototype.buffer = function (obj) {
obj
.
removeListener
(
'
data
'
,
onData
);
obj
.
removeListener
(
'
data
'
,
onData
);
obj
.
removeListener
(
'
end
'
,
onEnd
);
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
()
{
resume
:
function
()
{
this
.
end
();
this
.
end
();
for
(
var
i
=
0
,
len
=
events
.
length
;
i
<
len
;
++
i
)
{
for
(
var
i
=
0
,
len
=
events
.
length
;
i
<
len
;
++
i
)
{
...
@@ -586,8 +593,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
...
@@ -586,8 +593,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
});
});
// If we have been passed buffered data, resume it.
// If we have been passed buffered data, resume it.
if
(
options
.
buffer
&&
!
errState
)
{
if
(
options
.
buffer
)
{
if
(
!
errState
)
{
options
.
buffer
.
resume
();
options
.
buffer
.
resume
();
}
else
{
options
.
buffer
.
destroy
();
}
}
}
};
};
...
@@ -733,6 +744,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -733,6 +744,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
reverseProxy
.
incoming
.
socket
.
write
(
data
);
reverseProxy
.
incoming
.
socket
.
write
(
data
);
}
}
catch
(
e
)
{
catch
(
e
)
{
detach
();
reverseProxy
.
incoming
.
socket
.
end
();
reverseProxy
.
incoming
.
socket
.
end
();
proxySocket
.
end
();
proxySocket
.
end
();
}
}
...
@@ -749,6 +761,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -749,6 +761,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
proxySocket
.
write
(
data
);
proxySocket
.
write
(
data
);
}
}
catch
(
e
)
{
catch
(
e
)
{
detach
();
proxySocket
.
end
();
proxySocket
.
end
();
socket
.
end
();
socket
.
end
();
}
}
...
@@ -833,7 +846,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -833,7 +846,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
if
(
self
.
emit
(
'
webSocketProxyError
'
,
req
,
socket
,
head
))
{
if
(
self
.
emit
(
'
webSocketProxyError
'
,
req
,
socket
,
head
))
{
return
;
return
;
}
}
socket
.
end
();
socket
.
end
();
}
}
...
@@ -932,10 +944,12 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -932,10 +944,12 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
proxyError
(
ex
);
proxyError
(
ex
);
}
}
//
// If we have been passed buffered data, resume it.
// If we have been passed buffered data, resume it.
//
if
(
options
.
buffer
)
{
if
(
options
.
buffer
&&
!
errState
)
{
if
(
!
errState
)
{
options
.
buffer
.
resume
();
options
.
buffer
.
resume
();
}
else
{
options
.
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