mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Updated to support error callback on proxy.web and start/proxyReq/end continue working.
This commit is contained in:
parent
709b3e9656
commit
9ba8311343
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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(
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user