http: validate timeout in ClientRequest() · nodejs/node@907941d (original) (raw)

Original file line number Diff line number Diff line change
@@ -140,7 +140,9 @@ function ClientRequest(input, options, cb) {
140 140 var setHost = (options.setHost === undefined |
141 141
142 142 this.socketPath = options.socketPath;
143 -this.timeout = options.timeout;
143 +
144 +if (options.timeout !== undefined)
145 +this.timeout = validateTimerDuration(options.timeout, 'timeout');
144 146
145 147 var method = options.method;
146 148 var methodIsString = (typeof method === 'string');