Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to support error callback on proxy.web and start/proxyReq/end co... #735

Merged
merged 1 commit into from
Nov 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/http-proxy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function createRightProxy(type) {
* refer to the connection socket
* pass(req, socket, options, head)
*/
if(passes[i](req, res, options, head, cbl ? false : this, cbl)) { // passes can return a truthy value to halt the loop
if(passes[i](req, res, options, head, this, cbl)) { // passes can return a truthy value to halt the loop
break;
}
}
Expand Down
6 changes: 1 addition & 5 deletions lib/http-proxy/passes/web-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ web_o = Object.keys(web_o).map(function(pass) {
function stream(req, res, options, _, server, clb) {

// And we begin!
if (!clb) {
server.emit('start', req, res, options.target)
}
server.emit('start', req, res, options.target)
if(options.forward) {
// If forward enable, so just pipe the request
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
Expand Down Expand Up @@ -151,9 +149,7 @@ web_o = Object.keys(web_o).map(function(pass) {

// Allow us to listen when the proxy has completed
proxyRes.on('end', function () {
if (!clb) {
server.emit('end', req, res, proxyRes);
}
})

proxyRes.pipe(res);
Expand Down