From d8c04909fa50e87bba58311dd8feecaa94508f4b Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 30 Apr 2013 14:23:39 +0000 Subject: src/tool: allow timeouts to accept decimal values Implement wrappers around strtod to convert the user argument to a double with sane error checking. Use this to allow --max-time and --connect-timeout to accept decimal values instead of strictly integers. The manpage is updated to make mention of this feature and, additionally, forewarn that the actual timeout of the operation can vary in its precision (particularly as the value increases in its decimal precision). --- src/tool_operate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/tool_operate.c') diff --git a/src/tool_operate.c b/src/tool_operate.c index 3a15bed51..9c2fd3847 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -946,7 +946,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd); my_setopt_str(curl, CURLOPT_RANGE, config->range); my_setopt(curl, CURLOPT_ERRORBUFFER, errorbuffer); - my_setopt(curl, CURLOPT_TIMEOUT, config->timeout); + my_setopt(curl, CURLOPT_TIMEOUT_MS, (long)(config->timeout * 1000)); if(built_in_protos & CURLPROTO_HTTP) { @@ -1134,7 +1134,8 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) /* new in libcurl 7.7: */ my_setopt_str(curl, CURLOPT_RANDOM_FILE, config->random_file); my_setopt(curl, CURLOPT_EGDSOCKET, config->egd_file); - my_setopt(curl, CURLOPT_CONNECTTIMEOUT, config->connecttimeout); + my_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, + (long)(config->connecttimeout * 1000)); if(config->cipher_list) my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list); -- cgit v1.2.3