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
7e61f0cf
Commit
7e61f0cf
authored
Sep 17, 2010
by
Fedor Indutny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved error handling to response.on('end'), fixed error handling in websocket's part
parent
56003b52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lib/node-http-proxy.js
lib/node-http-proxy.js
+4
-4
No files found.
lib/node-http-proxy.js
View file @
7e61f0cf
...
@@ -160,6 +160,8 @@ HttpProxy.prototype = {
...
@@ -160,6 +160,8 @@ HttpProxy.prototype = {
res
.
write
(
'
An error has occurred:
'
+
sys
.
puts
(
JSON
.
stringify
(
err
)));
res
.
write
(
'
An error has occurred:
'
+
sys
.
puts
(
JSON
.
stringify
(
err
)));
}
}
// Response end may never come so removeListener here
reverse_proxy
.
removeListener
(
'
error
'
,
error
);
res
.
end
();
res
.
end
();
};
};
...
@@ -195,6 +197,7 @@ HttpProxy.prototype = {
...
@@ -195,6 +197,7 @@ HttpProxy.prototype = {
response
.
addListener
(
'
end
'
,
function
()
{
response
.
addListener
(
'
end
'
,
function
()
{
// Remark: Emit the end event for testability
// Remark: Emit the end event for testability
self
.
emitter
.
emit
(
'
proxy
'
,
null
,
self
.
body
);
self
.
emitter
.
emit
(
'
proxy
'
,
null
,
self
.
body
);
reverse_proxy
.
removeListener
(
'
error
'
,
error
);
res
.
end
();
res
.
end
();
});
});
});
});
...
@@ -207,7 +210,6 @@ HttpProxy.prototype = {
...
@@ -207,7 +210,6 @@ HttpProxy.prototype = {
// At the end of the client request, we are going to stop the proxied request
// At the end of the client request, we are going to stop the proxied request
req
.
addListener
(
'
end
'
,
function
()
{
req
.
addListener
(
'
end
'
,
function
()
{
reverse_proxy
.
end
();
reverse_proxy
.
end
();
reverse_proxy
.
removeListener
(
'
error
'
,
error
);
});
});
self
.
unwatch
(
req
);
self
.
unwatch
(
req
);
...
@@ -276,8 +278,6 @@ HttpProxy.prototype = {
...
@@ -276,8 +278,6 @@ HttpProxy.prototype = {
var
request
=
client
.
request
(
'
GET
'
,
req
.
url
,
headers
);
var
request
=
client
.
request
(
'
GET
'
,
req
.
url
,
headers
);
var
errorListener
=
function
(
error
)
{
var
errorListener
=
function
(
error
)
{
p
.
emit
(
'
error
'
,
error
);
request
.
emit
(
'
error
'
,
error
);
socket
.
end
();
socket
.
end
();
}
}
...
...
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