http2-proxy
Advanced tools
Comparing version 4.2.8 to 4.2.9
33
index.js
@@ -28,4 +28,2 @@ const http = require('http') | ||
function noop () {} | ||
const kReq = Symbol('req') | ||
@@ -143,4 +141,3 @@ const kRes = Symbol('res') | ||
} else { | ||
process.nextTick(onComplete.bind(res), new HttpError(`invalid protocol`, null, 500)) | ||
return promise | ||
throw new HttpError(`invalid protocol`, null, 500) | ||
} | ||
@@ -160,3 +157,2 @@ proxyReq = agent.request(reqOptions) | ||
.on('close', onComplete) | ||
// XXX: Node doesn't always emit 'close' after 'finish'. | ||
.on('finish', onComplete) | ||
@@ -183,2 +179,10 @@ .on('error', onComplete) | ||
const callback = res[kProxyCallback] | ||
if (!callback) { | ||
return | ||
} | ||
res[kProxyCallback] = null | ||
res | ||
@@ -205,6 +209,2 @@ .removeListener('close', onComplete) | ||
if (proxySocket) { | ||
proxySocket | ||
.removeListener('error', onComplete) | ||
.removeListener('close', onProxyAborted) | ||
proxySocket.on('error', noop) | ||
if (proxySocket.destroy) { | ||
@@ -216,7 +216,2 @@ proxySocket.destroy() | ||
if (proxyRes) { | ||
proxyRes | ||
.removeListener('error', onComplete) | ||
.removeListener('end', onComplete) | ||
.removeListener('aborted', onProxyAborted) | ||
proxyRes.on('error', noop) | ||
if (proxyRes.destroy) { | ||
@@ -228,8 +223,2 @@ proxyRes.destroy() | ||
if (proxyReq) { | ||
proxyReq | ||
.removeListener('error', onComplete) | ||
.removeListener('timeout', onProxyTimeout) | ||
.removeListener('response', onProxyResponse) | ||
.removeListener('upgrade', onProxyUpgrade) | ||
proxyReq.on('error', noop) | ||
if (proxyReq.abort) { | ||
@@ -254,5 +243,5 @@ proxyReq.abort() | ||
if (res[kHead] === undefined) { | ||
res[kProxyCallback].call(res[kSelf], err, req, res, { proxyReq, proxyRes }) | ||
callback.call(res[kSelf], err, req, res, { proxyReq, proxyRes }) | ||
} else { | ||
res[kProxyCallback].call(res[kSelf], err, req, res, res[kHead], { proxyReq, proxyRes, proxySocket }) | ||
callback.call(res[kSelf], err, req, res, res[kHead], { proxyReq, proxyRes, proxySocket }) | ||
} | ||
@@ -259,0 +248,0 @@ } |
{ | ||
"name": "http2-proxy", | ||
"version": "4.2.8", | ||
"version": "4.2.9", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "nodemon --inspect=9308 src", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104746
348