Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gohttp

Package Overview
Dependencies
Maintainers
0
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gohttp - npm Package Compare versions

Comparing version 5.0.7 to 5.0.8-beta

68

http2proxy.js
'use strict'
const http2 = require('node:http2')
const hiio = require('./hiio.js')

@@ -7,3 +8,2 @@

let error_502_text = `<!DOCTYPE html><html>

@@ -58,6 +58,6 @@ <head>

let hiiproxy = function (options = {}) {
if (!(this instanceof hiiproxy)) return hiiproxy(options)
let HiiProxy = function (options = {}) {
if (!(this instanceof HiiProxy)) return HiiProxy(options)
if (typeof options !== 'object') options = {}

@@ -124,3 +124,3 @@

hiiproxy.prototype.fmtConfig = function (cfg, k) {
HiiProxy.prototype.fmtConfig = function (cfg, k) {
if (typeof cfg[k] === 'string') {

@@ -135,3 +135,3 @@ cfg[k] = [

hiiproxy.prototype.checkConfig = function (tmp, k) {
HiiProxy.prototype.checkConfig = function (tmp, k) {

@@ -177,3 +177,3 @@ if (typeof tmp !== 'object' || (tmp instanceof Array) ) {

hiiproxy.prototype.checkAndSetConfig = function (backend_obj, tmp) {
HiiProxy.prototype.checkAndSetConfig = function (backend_obj, tmp) {
if (tmp.headers && tmp.headers.toString() === '[object Object]') {

@@ -207,3 +207,3 @@ backend_obj.headers = {}

hiiproxy.prototype.setHostProxy = function (cfg) {
HiiProxy.prototype.setHostProxy = function (cfg) {
if (typeof cfg !== 'object') return false

@@ -278,10 +278,9 @@

}
} //end sub for
}
} //end for
}
hiiproxy.prototype.checkAlive = function (pr) {
HiiProxy.prototype.checkAlive = function (pr) {
if (!pr.h2Pool || !pr.h2Pool.pool[0].connected) {

@@ -294,4 +293,3 @@ return false

hiiproxy.prototype.getBackend = function (c, host) {
HiiProxy.prototype.getBackend = function (c, host) {
let prlist = this.hostProxy[host][c.routepath]

@@ -322,3 +320,2 @@

}
}

@@ -343,3 +340,3 @@

hiiproxy.prototype.mid = function () {
HiiProxy.prototype.mid = function () {
let self = this

@@ -366,3 +363,3 @@

hind -= 1
hind--
}

@@ -403,2 +400,3 @@ }

let rpath = pr.rewrite(c, c.headers[':path'])
if (rpath) {

@@ -415,13 +413,22 @@ let path_typ = typeof rpath

await new Promise((rv, rj) => {
let stm = hii.session.request(c.headers)
let resolved = false
let rejected = false
stm.setTimeout(pr.timeout, () => {
stm.close()
stm.close(http2.constants.NGHTTP2_CANCEL)
})
stm.on('aborted', err => {
rj(err)
!resolved && !rejected && (rejected = true) && rj(err)
})
stm.on('close', () => {
if (stm.rstCode === http2.constants.NGHTTP2_NO_ERROR) {
!resolved && !rejected && (resolved = true) && rv()
} else {
!resolved && !rejected && (rejected = true) && rj()
}
})
stm.on('response', (headers, flags) => {

@@ -432,9 +439,9 @@ c.reply.respond(headers)

stm.on('frameError', err => {
stm.close()
rj(err)
stm.close(http2.constants.NGHTTP2_FRAME_SIZE_ERROR)
//!resolved && !rejected && (rejected = true) && rj(err)
})
stm.on('error', err => {
stm.close()
rj(err)
stm.close(http2.constants.NGHTTP2_INTERNAL_ERROR)
//!resolved && !rejected && (rejected = true) && rj(err)
})

@@ -456,3 +463,3 @@

stm.close()
rv(true)
!resolved && !rejected && (resolved = true) && rv()
})

@@ -464,4 +471,6 @@

c.send(error_503_text, 503)
}
} finally(() => {
})
}

@@ -471,4 +480,3 @@

hiiproxy.prototype.init =function (app) {
HiiProxy.prototype.init =function (app) {
app.config.timeout = this.timeout

@@ -487,2 +495,2 @@

module.exports = hiiproxy
module.exports = HiiProxy
{
"name": "gohttp",
"version": "5.0.7",
"version": "5.0.8-beta",
"description": "http & https client for HTTP/1.1 and HTTP/2",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc