-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
0.2.0 / 2013-11-06 | ||
================== | ||
|
||
* use keepalive agent on node 0.11+ impl | ||
|
||
0.1.5 / 2013-06-24 | ||
================== | ||
|
||
* support coveralls | ||
* add node 0.10 test | ||
* add 0.8.22 original https.js | ||
* add original http.js module to diff | ||
* update jscover | ||
* mv pem to fixtures | ||
* add https agent usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var http = require('http'); | ||
var Agent = require('../'); | ||
|
||
var keepaliveAgent = new Agent({ | ||
keepAlive: true | ||
}); | ||
// https://www.google.com/search?q=nodejs&sugexp=chrome,mod=12&sourceid=chrome&ie=UTF-8 | ||
var options = { | ||
host: 'gitcafe.com', | ||
path: '/', | ||
method: 'GET', | ||
agent: keepaliveAgent | ||
}; | ||
|
||
var start = Date.now(); | ||
var req = http.get(options, function (res) { | ||
console.log('STATUS1: %d, %d ms', res.statusCode, Date.now() - start); | ||
console.log('HEADERS1: %j', res.headers); | ||
res.setEncoding('utf8'); | ||
res.on('data', function (chunk) { | ||
console.log('BODY1: %d', chunk.length); | ||
}); | ||
res.on('end', function () { | ||
process.nextTick(function () { | ||
start = Date.now(); | ||
http.get(options, function (res) { | ||
console.log('STATUS2: %d, %d ms', res.statusCode, Date.now() - start); | ||
console.log('HEADERS2: %j', res.headers); | ||
res.setEncoding('utf8'); | ||
res.on('data', function (chunk) { | ||
console.log('BODY2: %d', chunk.length); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
req.on('error', function (e) { | ||
console.log('problem with request: ' + e.message); | ||
}); | ||
|
||
setTimeout(function () { | ||
console.log('keep alive sockets:', keepaliveAgent); | ||
process.exit(); | ||
}, 3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "agentkeepalive", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Missing keepalive http.Agent", | ||
"main": "index.js", | ||
"directories": { | ||
|
@@ -32,6 +32,7 @@ | |
"coveralls": "*", | ||
"mocha-lcov-reporter": "*" | ||
}, | ||
"engines": { "node": ">= 0.10.0" }, | ||
"author": "fengmk2 <[email protected]> (http://fengmk2.github.com)", | ||
"license": "MIT" | ||
} |