Skip to content

Commit

Permalink
Merge pull request vpulim#600 from mgorczyca/http-persistent
Browse files Browse the repository at this point in the history
In http.js, do not end request for keep-alive connections
  • Loading branch information
herom committed Mar 26, 2015
2 parents ebfb1b7 + 5e18379 commit 0a490de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ var httpRequest = function httpRequest(rurl, data, callback, exheaders, exoption
headers: headers,
followAllRedirects: true
};

if (headers.Connection === 'keep-alive') {
options.body = data;
}

exoptions = exoptions || {};
for (attr in exoptions) { options[attr] = exoptions[attr]; }
Expand All @@ -61,8 +65,11 @@ var httpRequest = function httpRequest(rurl, data, callback, exheaders, exoption
callback(null, res, body);
}
});
request.end(data);


if (headers.Connection !== 'keep-alive') {
request.end(data);
}

return request;
};

Expand Down

0 comments on commit 0a490de

Please sign in to comment.