diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-02-21 17:52:35 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-03-04 21:55:21 +0000 |
commit | 648d668fcc29dafeb99f90d89087b682457f96b3 (patch) | |
tree | 18b5aa896f2b4d868dd99588a89faf5b695607d9 /lib/_http_client.js | |
parent | d83f8303fdc5dc5c934df87f0883d1f2558b10a6 (diff) | |
download | android-node-v8-648d668fcc29dafeb99f90d89087b682457f96b3.tar.gz android-node-v8-648d668fcc29dafeb99f90d89087b682457f96b3.tar.bz2 android-node-v8-648d668fcc29dafeb99f90d89087b682457f96b3.zip |
http: emit timeout duration overflow warning sync
Emit the `TimeoutOverflowWarning` synchronously, even when
still connecting, to get a better stack trace.
With thanks to Anatoli Papirovski for providing helpful
tips when writing the test.
PR-URL: https://github.com/nodejs/node/pull/18906
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r-- | lib/_http_client.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js index 727dc649c0..7bf485b47e 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -40,6 +40,7 @@ const { urlToOptions, searchParamsSymbol } = require('internal/url'); const { outHeadersKey, ondrain } = require('internal/http'); const { nextTick } = require('internal/process/next_tick'); const errors = require('internal/errors'); +const { validateTimerDuration } = require('internal/timers'); const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/; @@ -678,6 +679,7 @@ function _deferToConnect(method, arguments_, cb) { } ClientRequest.prototype.setTimeout = function setTimeout(msecs, callback) { + msecs = validateTimerDuration(msecs); if (callback) this.once('timeout', callback); const emitTimeout = () => this.emit('timeout'); |