summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
authorRene Weber <weber.rene@live.de>2016-08-31 01:00:41 +0100
committerIlkka Myller <ilkka.myller@nodefield.com>2016-09-26 13:33:52 +0300
commitc9b59e8387b08dab20936f32d2b290804718f688 (patch)
tree5aee2d71644c414b0a4b72a3d342e0288e7c7a5f /lib/net.js
parent50be885285c602c2aa1eb9c6010cb26fe7d186ff (diff)
downloadandroid-node-v8-c9b59e8387b08dab20936f32d2b290804718f688.tar.gz
android-node-v8-c9b59e8387b08dab20936f32d2b290804718f688.tar.bz2
android-node-v8-c9b59e8387b08dab20936f32d2b290804718f688.zip
http: socket connection timeout for http request
This allows passing the socket connection timeout to http#request such that it will be set before the socket is connecting PR-URL: https://github.com/nodejs/node/pull/8101 Fixes: https://github.com/nodejs/node/issues/7580 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/net.js b/lib/net.js
index 8a7e3c2ad2..3944b9627c 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -66,6 +66,11 @@ exports.connect = exports.createConnection = function() {
args = normalizeArgs(args);
debug('createConnection', args);
var s = new Socket(args[0]);
+
+ if (args[0].timeout) {
+ s.setTimeout(args[0].timeout);
+ }
+
return Socket.prototype.connect.apply(s, args);
};