From: Travis Cross Date: Sun, 16 Nov 2014 19:16:39 +0000 (+0000) Subject: Add `connect-timeout` option for curl API command X-Git-Tag: v1.4.14~2^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ee325df48b3c71e8cf645aaf19138eae9a43ff6;p=thirdparty%2Ffreeswitch.git Add `connect-timeout` option for curl API command This option sets the maximum number of seconds that curl will wait to connect with the server. Right now this is a synonym for the `timeout` option. --- diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index bff5df864c..68c21f61e4 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -51,7 +51,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load); */ SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL); -static char *SYNTAX = "curl url [headers|json|content-type |timeout ] [get|head|post|delete|put [data]]"; +static char *SYNTAX = "curl url [headers|json|content-type |connect-timeout |timeout ] [get|head|post|delete|put [data]]"; #define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack" #define HTTP_SENDFILE_RESPONSE_SIZE 32768 @@ -944,6 +944,16 @@ SWITCH_STANDARD_API(curl_function) if (++i < argc) { content_type = switch_core_strdup(pool, argv[i]); } + } else if (!strcasecmp("connect-timeout", argv[i])) { + if (++i < argc) { + int tmp = atoi(argv[i]); + + if (tmp > 0) { + options.connect_timeout = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Invalid connect-timeout!\n"); + } + } } else if (!strcasecmp("timeout", argv[i])) { if (++i < argc) { int tmp = atoi(argv[i]);