Socket
Socket
Sign inDemoInstall

agentkeepalive

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agentkeepalive - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

10

History.md
2.0.4 / 2016-03-13
==================
* test: add Circle ci
* test: add appveyor ci build
* refactor: make sure only one error listener
* chore: use codecov
* fix: handle idle socket error
* test: run on more node versions
2.0.3 / 2015-08-03

@@ -3,0 +13,0 @@ ==================

28

lib/_http_agent.js

@@ -22,3 +22,3 @@ // Copyright Joyent, Inc. and other Node contributors.

// copy from https://github.com/joyent/node/blob/master/lib/_http_agent.js
// copy from https://github.com/nodejs/node/blob/v4.x/lib/_http_agent.js

@@ -75,2 +75,3 @@ 'use strict';

// free keep-alive socket timeout. By default free socket do not have a timeout.
// keepAliveTimeout should be rename to `freeSocketKeepAliveTimeout`
self.keepAliveTimeout = self.options.keepAliveTimeout || 0;

@@ -121,2 +122,9 @@ // working socket timeout. By default working socket do not have a timeout.

// Add a default error handler to avoid Unhandled 'error' event throw on idle socket
// https://github.com/node-modules/agentkeepalive/issues/25
// https://github.com/nodejs/node/pull/4482 (fixed in >= 4.4.0 and >= 5.4.0)
if (socket.listeners('error').length === 0) {
socket.once('error', freeSocketErrorListener);
}
// set free keepalive timer

@@ -136,2 +144,9 @@ socket.setTimeout(self.keepAliveTimeout);

function freeSocketErrorListener(err) {
var socket = this;
debug('SOCKET ERROR on FREE socket:', err.message, err.stack);
socket.destroy();
socket.emit('agentRemove');
}
Agent.defaultMaxSockets = Infinity;

@@ -183,2 +198,4 @@

socket.removeListener('error', freeSocketErrorListener);
// restart the default timer

@@ -265,10 +282,2 @@ socket.setTimeout(this.timeout);

// Add a default error handler to avoid Unhandled 'error' event throw
// https://github.com/node-modules/agentkeepalive/issues/25
function onError(err) {
debug('CLIENT socket onError: %s', err);
self.emit('error', err);
}
s.on('error', onError);
function onRemove() {

@@ -283,3 +292,2 @@ // We need this function for cases like HTTP 'upgrade'

s.removeListener('agentRemove', onRemove);
s.removeListener('error', onError);
// remove timer

@@ -286,0 +294,0 @@ s.setTimeout(0, onTimeout);

@@ -1,4 +0,2 @@

/**!
* agentkeepalive - lib/agent.js
*
/**
* refer:

@@ -5,0 +3,0 @@ * * @atimb "Real keep-alive HTTP agent": https://gist.github.com/2963672

{
"name": "agentkeepalive",
"version": "2.0.3",
"version": "2.0.4",
"description": "Missing keepalive http.Agent",
"main": "index.js",
"files": [
"index.js", "lib/"
"index.js",
"lib"
],
"scripts": {
"test": "mocha -R spec -t 5000 -r should-http test/*.test.js",
"test-cov": "node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -t 5000 -r should-http test/*.test.js",
"test-travis": "node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- -t 5000 -r should-http test/*.test.js",
"jshint": "jshint .",
"autod": "autod -w --prefix '~' && npm run cnpm",
"cnpm": "npm install --registry=https://registry.npm.taobao.org",
"contributors": "contributors -f plain -o AUTHORS"
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -t 5000 -r should-http test/*.test.js",
"ci": "npm run lint && npm run test-cov",
"lint": "jshint .",
"autod": "autod -w --prefix '~'",
"contributors": "contributors -f plain -o AUTHORS",
"codecov": "npm i codecov && codecov"
},

@@ -27,8 +28,8 @@ "repository": {

"http",
"https",
"agent",
"keepalive"
"keepalive",
"agentkeepalive"
],
"dependencies": {
},
"dependencies": {},
"devDependencies": {

@@ -39,9 +40,12 @@ "autod": "*",

"mocha": "*",
"pedding": "~1.0.0",
"should": "~4.0.4",
"should-http": "~0.0.2"
"pedding": "1",
"should": "4",
"should-http": "~0.0.2",
"jshint": "^2.9.1"
},
"engines": { "node": ">= 0.10.0" },
"engines": {
"node": ">= 0.10.0"
},
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.com)",
"license": "MIT"
}

@@ -5,4 +5,5 @@ # agentkeepalive

[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
[![Circle status][circle-image]][circle-url]
[![Appveyor status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]

@@ -16,6 +17,8 @@ [![node version][node-image]][node-url]

[travis-url]: https://travis-ci.org/node-modules/agentkeepalive
[coveralls-image]: https://img.shields.io/coveralls/node-modules/agentkeepalive.svg?style=flat
[coveralls-url]: https://coveralls.io/r/node-modules/agentkeepalive?branch=master
[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat
[gittip-url]: https://www.gittip.com/fengmk2/
[circle-image]: https://circleci.com/gh/node-modules/agentkeepalive.svg?style=svg
[circle-url]: https://circleci.com/gh/node-modules/agentkeepalive
[appveyor-image]: https://ci.appveyor.com/api/projects/status/k7ct4s47di6m5uy2?svg=true
[appveyor-url]: https://ci.appveyor.com/project/fengmk2/agentkeepalive
[codecov-image]: https://codecov.io/github/node-modules/agentkeepalive/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/node-modules/agentkeepalive?branch=master
[david-image]: https://img.shields.io/david/node-modules/agentkeepalive.svg?style=flat

@@ -22,0 +25,0 @@ [david-url]: https://david-dm.org/node-modules/agentkeepalive

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