Socket
Socket
Sign inDemoInstall

http2-proxy

Package Overview
Dependencies
0
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.17 to 5.0.18

2

package.json
{
"name": "http2-proxy",
"version": "5.0.17",
"version": "5.0.18",
"scripts": {

@@ -5,0 +5,0 @@ "dev": "nodemon --inspect=9308 src",

@@ -164,6 +164,7 @@ # http2-proxy

for await (const { port, timeout, hostname } of upstream) {
if (req.aborted) {
if (req.aborted || finished) {
return
}
let error = null
let finished = false

@@ -181,6 +182,8 @@ let bytesWritten = 0

if (!res.headersSent) {
res.statusCode = proxyRes.statusCode
for (const [ key, value ] of Object.entries(headers)) {
res.setHeader(key, value)
function setHeaders () {
if (!bytesWritten) {
res.statusCode = proxyRes.statusCode
for (const [ key, value ] of Object.entries(headers)) {
res.setHeader(key, value)
}
}

@@ -192,13 +195,5 @@ }

function onClose () {
res.off('drain', onDrain)
}
function onDrain () {
proxyRes.resume()
}
proxyRes
.on('data', buf => {
// WORKAROUND: https://github.com/nodejs/node/pull/28004
setHeaders()
bytesWritten += buf.length

@@ -210,22 +205,28 @@ if (!res.write(buf)) {

.on('end', () => {
setHeaders()
// WORKAROUND: https://github.com/nodejs/node/pull/27984
if (proxyRes.aborted) {
return
if (!proxyRes.aborted) {
res.end()
// WORKAROUND: https://github.com/nodejs/node/pull/24347
finished = true
}
res.end()
// WORKAROUND: https://github.com/nodejs/node/pull/24347
finished = true
})
.on('close', onClose)
.on('close', () => {
res.off('drain', onDrain)
}))
res.on('drain', onDrain)
function onDrain () {
proxyRes.resume()
}
}
})
} catch (err) {
if (finished) {
if (!err.statusCode) {
throw err
}
error = err
if (err.statusCode === 503) {

@@ -238,5 +239,5 @@ continue

continue
} else {
// TODO: Retry range request
}
// TODO: Retry range request
}

@@ -248,3 +249,3 @@

throw new createError.ServiceUnavailable()
throw error || new createError.ServiceUnavailable()
} catch (err) {

@@ -251,0 +252,0 @@ defaultWebHandler(err)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc