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 0.2.16 to 0.2.17

54

index.js

@@ -49,10 +49,6 @@ const http2 = require('http2')

}, callback) {
const onFinished = OnFinished.create(req, resOrSocket)
const errorHandler = ErrorHandler.create(req, resOrSocket, callback, onFinished)
const finishedHandler = OnFinishedHandler.create(req, resOrSocket)
resOrSocket.on('error', errorHandler)
const errorHandler = ErrorHandler.create(req, resOrSocket, callback, finishedHandler)
const incoming = req.stream || req
incoming.on('error', errorHandler)
if (resOrSocket instanceof net.Socket) {

@@ -116,3 +112,3 @@ if (req.method !== 'GET') {

const proxyErrorHandler = ProxyErrorHandler.create(req, proxyReq, errorHandler, onFinished)
const proxyErrorHandler = ProxyErrorHandler.create(req, proxyReq, errorHandler, finishedHandler)

@@ -126,6 +122,6 @@ req

.on('timeout', proxyErrorHandler.gatewayTimeout)
.on('response', ProxyResponseHandler.create(req, resOrSocket, onRes, proxyErrorHandler, onFinished))
.on('response', ProxyResponseHandler.create(req, resOrSocket, onRes, proxyErrorHandler, finishedHandler))
if (resOrSocket instanceof net.Socket) {
proxyReq.on('upgrade', ProxyUpgradeHandler.create(req, resOrSocket, proxyErrorHandler, onFinished))
proxyReq.on('upgrade', ProxyUpgradeHandler.create(req, resOrSocket, proxyErrorHandler, finishedHandler))
}

@@ -252,3 +248,7 @@ }

release () {
release (err) {
if (err) {
this.handle(err)
}
this.hasError = false

@@ -333,7 +333,7 @@ this.req = null

static create (req, proxyReq, errorHandler, onFinished) {
static create (req, proxyReq, errorHandler, finishedHandler) {
const handler = ProxyErrorHandler.pool.pop() || new ProxyErrorHandler()
handler.proxyReq = proxyReq
handler.errorHandler = errorHandler
onFinished.register(handler)
finishedHandler.register(handler)
return handler.handle

@@ -410,3 +410,3 @@ }

static create (req, resOrSocket, onRes, proxyErrorHandler, onFinished) {
static create (req, resOrSocket, onRes, proxyErrorHandler, finishedHandler) {
const handler = ProxyResponseHandler.pool.pop() || new ProxyResponseHandler()

@@ -417,3 +417,3 @@ handler.req = req

handler.proxyErrorHandler = proxyErrorHandler
onFinished.register(handler)
finishedHandler.register(handler)
return handler.handle

@@ -485,7 +485,7 @@ }

static create (req, socket, proxyErrorHandler, onFinished) {
static create (req, socket, proxyErrorHandler, finishedHandler) {
const handler = ProxyUpgradeHandler.pool.pop() || new ProxyUpgradeHandler()
handler.socket = socket
handler.proxyErrorHandler = proxyErrorHandler
onFinished.register(handler)
finishedHandler.register(handler)
return handler.handle

@@ -496,5 +496,6 @@ }

class OnFinished {
class OnFinishedHandler {
constructor () {
this.req = null
this.res = null
this.handlers = []

@@ -505,5 +506,6 @@ this.handle = this.handle.bind(this)

handle () {
handle (err) {
this.req.removeListener('close', this.handle)
this.req.removeListener('error', this.handle)
this.res.removeListener('error', this.handle)

@@ -514,7 +516,7 @@ this.req = null

for (const handler of this.handlers) {
handler.release()
handler.release(err)
}
this.handlers.length = 0
OnFinished.pool.push(this)
OnFinishedHandler.pool.push(this)
}

@@ -529,11 +531,13 @@

this.req.on('error', this.handle)
this.res.on('error', this.handle)
}
static create (req, res) {
const onFinished = OnFinished.pool.pop() || new OnFinished()
onFinished.req = req
process.nextTick(onFinished.init)
return onFinished
const handler = OnFinishedHandler.pool.pop() || new OnFinishedHandler()
handler.req = req
handler.res = res
process.nextTick(handler.init)
return handler
}
}
OnFinished.pool = []
OnFinishedHandler.pool = []
{
"name": "http2-proxy",
"version": "0.2.16",
"version": "0.2.17",
"scripts": {

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

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