Merge branch 'master' into 1.5

This commit is contained in:
Spencer Alger
2014-03-14 09:15:25 -07:00
3 changed files with 20 additions and 5 deletions

View File

@ -67,7 +67,7 @@
"license": "Apache 2.0",
"dependencies": {
"chalk": "~0.4",
"forever-agent": "~0.5",
"forever-agent": "0.5.2",
"lodash-node": "~2.4",
"when": "~2.8"
},

View File

@ -0,0 +1,17 @@
module.exports = CustomForeverAgent;
var ForeverAgent = require('forever-agent');
var inherits = require('util').inherits;
function CustomForeverAgent(opts) {
ForeverAgent.call(this, opts);
}
inherits(CustomForeverAgent, ForeverAgent);
CustomForeverAgent.prototype.addRequest = function (req, host, port) {
// force this, so that requests will always use the connection pool
req.useChunkedEncodingByDefault = false;
ForeverAgent.prototype.addRequest.call(this, req, host, port);
};
CustomForeverAgent.SSL = ForeverAgent.SSL;

View File

@ -14,7 +14,7 @@ var handles = {
};
var _ = require('../utils');
var qs = require('querystring');
var ForeverAgent = require('forever-agent');
var ForeverAgent = require('./_custom_forever_agent');
var ConnectionAbstract = require('../connection');
/**
@ -163,8 +163,6 @@ HttpConnector.prototype.request = function (params, cb) {
request.setNoDelay(true);
request.setSocketKeepAlive(true);
request.chunkedEncoding = false;
request.useChunkedEncodingByDefault = false;
if (params.body) {
request.setHeader('Content-Length', Buffer.byteLength(params.body, 'utf8'));
@ -176,4 +174,4 @@ HttpConnector.prototype.request = function (params, cb) {
return function () {
request.abort();
};
};
};