http2-proxy
Advanced tools
Comparing version 0.2.10 to 0.2.11
16
index.js
@@ -74,4 +74,2 @@ const http2 = require('http2') | ||
// XXX http2.Http2ServerRequest doesn't forward stream errors. | ||
// (https://github.com/nodejs/node/issues/15359) | ||
(req.stream || req).on('error', onError) | ||
@@ -149,2 +147,4 @@ resOrSocket.on('error', onError) | ||
let hasError = false | ||
const abort = () => { | ||
@@ -157,2 +157,6 @@ if (!proxyReq.aborted) { | ||
const callback = err => { | ||
if (hasError) { | ||
return | ||
} | ||
hasError = true | ||
req.removeListener('close', abort) | ||
@@ -183,6 +187,4 @@ abort() | ||
}) | ||
// XXX http.ClientRequest doesn't emit 'aborted'. Instead it emits | ||
// a "socket hang up" error. | ||
// .on('aborted', () => callback(new createError.BadGateway('socket hang up'))) | ||
// (https://github.com/nodejs/node/pull/15270) | ||
// NOTE http.ClientRequest emits "socket hang up" error when aborted, i.e. | ||
// there is no need to listen for proxyReq.on('aborted', ...). | ||
.on('timeout', () => callback(createError('gateway timeout', null, 504))) | ||
@@ -255,4 +257,2 @@ .on('response', proxyRes => { | ||
// XXX Does this overlap socket errors, i.e. duplicate emits? | ||
// (https://github.com/nodejs/node/issues/15360) | ||
proxyRes.on('error', callback) | ||
@@ -259,0 +259,0 @@ |
{ | ||
"name": "http2-proxy", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "nodemon --inspect=9308 --expose-http2 src", |
15338
284