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

under

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

under - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

benchmark.js
var needle = require('needle');
require('http').globalAgent.maxSockets = 100;
require('http').globalAgent.maxSockets = 500;
// var opts = { agent: agent };

@@ -5,0 +5,0 @@ var opts = { timeout: 0 };

@@ -8,2 +8,3 @@ var connect = require('connect'),

var options = {
debug: true,
timeout: 10000,

@@ -10,0 +11,0 @@ backend: {

@@ -8,3 +8,4 @@ var connect = require('connect'),

var options = {
max_active: 500,
debug: true,
max_active: 50,
timeout: 10000,

@@ -11,0 +12,0 @@ backend: {

@@ -7,5 +7,8 @@ /*

var http = require('http');
http.globalAgent.maxSockets = 100;
var http = require('http'),
agent = new http.Agent();
agent.maxSockets = 100;
var debug = false;
var defaults = {};

@@ -24,3 +27,5 @@

'ECONNREFUSED': 503,
'ENOTFOUND': 503,
'ENOENT': 503,
'EMFILE': 599,
'EADDRNOTAVAIL': 599 // no available sockets/ports

@@ -30,2 +35,3 @@ }

var log = function(msg, err) {
if (!debug) return;
return err ? console.log(msg, err) : console.log(msg);

@@ -69,4 +75,7 @@ }

if (opts.max_active || opts.max_sockets)
http.globalAgent.maxSockets = (opts.max_active || opts.max_sockets);
agent.maxSockets = (opts.max_active || opts.max_sockets);
if (opts.debug)
debug = opts.debug;
return exports.send;

@@ -93,2 +102,3 @@ }

request_opts = target;
request_opts.agent = agent;
request_opts.method = req.method;

@@ -108,6 +118,6 @@ request_opts.path = req.url;

if (timer) clearTimeout(timer);
// log('Proxy request error:', err.message);
log('Proxy request error:', err.message);
var code = req.aborted ? 499 : (errors[err.code] || 500);
res.writeHead(code, { content_type: 'text/plain'} );
res.writeHead(code, {'Content-Type': 'text/plain', 'Connection': 'close'});

@@ -163,3 +173,3 @@ if (req.method !== 'HEAD')

req.once('aborted', function() {
// log('Request aborted!')
log('Request aborted!')
req.aborted = true;

@@ -166,0 +176,0 @@ proxyRequest.abort();

var proxy = require('./proxy');
var max_active = 100;
var debug = false;

@@ -18,2 +19,7 @@ var requests = {

var log = function(str) {
if (!debug) return;
console.log(str);
}
////////////////////////////////////////////////////////////

@@ -36,4 +42,4 @@ // request pool handling

proxy_request(req_res[0], req_res[1]);
// } else {
// console.log(requests.active + '/' + requests.queued.length + " [active/queued]");
} else {
log(requests.active + '/' + requests.queued.length + " [active/queued]");
}

@@ -58,2 +64,5 @@ }

if (opts && opts.debug)
debug = opts.debug;
return queue_request;

@@ -60,0 +69,0 @@ }

{
"name": "under",
"version": "0.0.3",
"version": "0.0.4",
"description": "Reverse proxy library with queue support.",

@@ -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