diff options
author | cjihrig <cjihrig@gmail.com> | 2019-02-20 10:02:46 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-02-26 16:12:54 -0500 |
commit | 907941d48e48a30b40a2ee73da4ccd974019fb6e (patch) | |
tree | 2fb87a2f883958a465e1c9f784613138b3862691 /lib/_http_client.js | |
parent | 4900863043406528d7cd37e8233fe449fa76f9bf (diff) | |
download | android-node-v8-907941d48e48a30b40a2ee73da4ccd974019fb6e.tar.gz android-node-v8-907941d48e48a30b40a2ee73da4ccd974019fb6e.tar.bz2 android-node-v8-907941d48e48a30b40a2ee73da4ccd974019fb6e.zip |
http: validate timeout in ClientRequest()
Validate the timeout option in the ClientRequest() constructor
to prevent asynchronously thrown validation errors.
PR-URL: https://github.com/nodejs/node/pull/26214
Fixes: https://github.com/nodejs/node/issues/26143
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r-- | lib/_http_client.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js index e073e973bb..de7b01cbd1 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -140,7 +140,9 @@ function ClientRequest(input, options, cb) { var setHost = (options.setHost === undefined || Boolean(options.setHost)); this.socketPath = options.socketPath; - this.timeout = options.timeout; + + if (options.timeout !== undefined) + this.timeout = validateTimerDuration(options.timeout, 'timeout'); var method = options.method; var methodIsString = (typeof method === 'string'); |