From f1df8d609672094f3ce10a1a7de8b59a86d3db92 Mon Sep 17 00:00:00 2001 From: Travis Cross <tc@traviscross.com> Date: Sun, 16 Nov 2014 19:20:07 +0000 Subject: [PATCH] Allow setting CURL timeout from curl API command Previously the `timeout` option to the curl API command set only `CURLOPT_CONNECTTIMEOUT` -- the maximum amount of time that curl will wait to connect to the server. If the server accepted the connection but then never replied, curl would wait essentially forever. There was no way to set `CURLOPT_TIMEOUT` -- the maximum amount of time the entire request operation is allowed to take. With this change, the `timeout` option sets `CURLOPT_TIMEOUT`. We've earlier added a `connect-timeout` option to set `CURLOPT_CONNECTTIMEOUT`. This is a change to existing behavior. However, it's likely that this is what people expected it to do all along. The curl application call, for example, accepts both `curl_connect_timeout` and `curl_timeout` channel variables, with the latter setting `CURLOPT_TIMEOUT`. If people really were relying on this odd behavior, we'll rename the option with the new behavior to something else and come up with a transition plan. --- src/mod/applications/mod_curl/mod_curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 68c21f61e4..86e2924073 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -959,7 +959,7 @@ SWITCH_STANDARD_API(curl_function) int tmp = atoi(argv[i]); if (tmp > 0) { - options.connect_timeout = tmp; + options.timeout = tmp; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Invalid timeout!\n"); }