New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hoxy

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoxy - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

2

package.json
{
"name": "hoxy",
"version": "2.1.1",
"version": "2.2.0",
"author": "Greg Reimer <gregreimer@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Web-hacking proxy API for node",

@@ -263,3 +263,5 @@ /*

, source = req._source
, { rate, latency } = req.slow()
, pSlow = this._proxy._slow || {}
, rSlow = req.slow() || {}
, latency = rSlow.latency || 0
if (resp._populated) {

@@ -278,9 +280,17 @@ return Promise.resolve(undefined)

})
if (rate > 0) {
let brake = streams.brake(rate)
source = source.pipe(brake)
}
if (latency > 0) {
yield wait(latency)
}
if (rSlow.rate > 0) {
let brake = streams.brake(rSlow.rate)
source = source.pipe(brake)
}
if (pSlow.rate) {
let groupedBrake = pSlow.rate.throttle()
source = source.pipe(groupedBrake)
}
if (pSlow.up) {
let groupedBrake = pSlow.up.throttle()
source = source.pipe(groupedBrake)
}
req._tees().forEach(writable => source.pipe(writable))

@@ -295,12 +305,24 @@ yield provisionableReq.send(source) // wait for it all to pipe out

, source = resp._source
, { latency, rate } = resp.slow()
, rSlow = resp.slow() || {}
, pSlow = this._proxy._slow || {}
, rLatency = rSlow.latency || 0
, pLatency = pSlow.latency || 0
, latency = Math.max(pLatency, rLatency)
return co.call(this, function*() {
if (latency > 0) {
yield wait(latency)
}
outResp.writeHead(resp.statusCode, resp.headers)
if (rate > 0) {
let brake = streams.brake(rate)
if (rSlow.rate > 0) {
let brake = streams.brake(rSlow.rate)
source = source.pipe(brake)
}
if (latency > 0) {
yield wait(latency)
if (pSlow.rate) {
let groupedBrake = pSlow.rate.throttle()
source = source.pipe(groupedBrake)
}
if (pSlow.down) {
let groupedBrake = pSlow.down.throttle()
source = source.pipe(groupedBrake)
}
let tees = resp._tees()

@@ -307,0 +329,0 @@ tees.forEach(writable => source.pipe(writable))

@@ -18,2 +18,4 @@ /*

import https from 'https'
import _ from 'lodash'
import { ThrottleGroup } from 'stream-throttle'

@@ -141,2 +143,28 @@ function isAsync(fun) {

if (opts.slow) {
let slow = this._slow = { latency: 0 };
['rate', 'latency', 'up', 'down'].forEach(name => {
let val = opts.slow[name]
if (val === undefined) { return }
if (typeof val !== 'number') {
throw new Error(`slow.${name} must be a number`)
}
if (val < 0) {
throw new Error(`slow.${name} must be >= 0`)
}
})
if (opts.slow.rate) {
slow.rate = new ThrottleGroup({ rate: opts.slow.rate })
}
if (opts.slow.latency) {
slow.latency = opts.slow.latency
}
if (opts.slow.up) {
slow.up = new ThrottleGroup({ rate: opts.slow.up })
}
if (opts.slow.down) {
slow.down = new ThrottleGroup({ rate: opts.slow.down })
}
}
this._tls = opts.tls

@@ -143,0 +171,0 @@

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