Ensure TIMEOUT_MS is positive (Fixes #1264)

This commit is contained in:
Gregory Schier 2018-12-14 13:26:10 -05:00
parent d755a7ca01
commit 5825327c27

View File

@ -207,7 +207,6 @@ export async function _actuallySend(
// Set all the basic options
setOpt(Curl.option.FOLLOWLOCATION, settings.followRedirects);
setOpt(Curl.option.TIMEOUT_MS, settings.timeout); // 0 for no timeout
setOpt(Curl.option.VERBOSE, true); // True so debug function works
setOpt(Curl.option.NOPROGRESS, false); // False so progress function works
setOpt(Curl.option.ACCEPT_ENCODING, ''); // Auto decode everything
@ -319,6 +318,14 @@ export async function _actuallySend(
addTimelineText('Preparing request to ' + finalUrl);
addTimelineText(`Using ${Curl.getVersion()}`);
// Set timeout
if (settings.timeout > 0) {
addTimelineText(`Enable timeout of ${settings.timeout}ms`);
setOpt(Curl.option.TIMEOUT_MS, settings.timeout);
} else {
addTimelineText(`Disable timeout`);
}
// log some things
if (renderedRequest.settingEncodeUrl) {
addTimelineText('Enable automatic URL encoding');