http2-proxy
Advanced tools
Comparing version 5.0.28 to 5.0.29
30
index.js
@@ -26,3 +26,2 @@ const net = require('net') | ||
const kProxySocket = Symbol('proxySocket') | ||
const kConnected = Symbol('connected') | ||
const kOnRes = Symbol('onRes') | ||
@@ -183,3 +182,2 @@ | ||
proxyReq[kRes] = res | ||
proxyReq[kConnected] = false | ||
proxyReq[kOnRes] = onRes | ||
@@ -196,2 +194,4 @@ | ||
.on('error', onComplete) | ||
.on('data', onRequestData) | ||
.on('end', onRequestEnd) | ||
@@ -203,18 +203,7 @@ proxyReq | ||
.on('upgrade', onProxyReqUpgrade) | ||
.on('drain', onProxyRequestDrain) | ||
deferToConnect.call(proxyReq, onProxyConnect) | ||
return promise | ||
} | ||
function deferToConnect (cb) { | ||
this.once('socket', function (socket) { | ||
if (!socket.connecting) { | ||
cb.call(this) | ||
} else { | ||
socket.once('connect', cb.bind(this)) | ||
} | ||
}) | ||
} | ||
function onComplete (err) { | ||
@@ -271,13 +260,2 @@ const res = this[kRes] | ||
function onProxyConnect () { | ||
this[kConnected] = true | ||
this[kReq] | ||
.on('data', onRequestData) | ||
.on('end', onRequestEnd) | ||
this | ||
.on('drain', onProxyRequestDrain) | ||
} | ||
function onRequestData (buf) { | ||
@@ -298,3 +276,3 @@ if (!this[kProxyReq].write(buf)) { | ||
function onProxyReqError (err) { | ||
err.statusCode = this[kConnected] ? 502 : 503 | ||
err.statusCode = this.headersSent ? 502 : 503 | ||
onComplete.call(this, err) | ||
@@ -301,0 +279,0 @@ } |
{ | ||
"name": "http2-proxy", | ||
"version": "5.0.28", | ||
"version": "5.0.29", | ||
"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
23053
402