mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-07 22:03:50 +00:00
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.
This commit is contained in:
parent
07c5cc18ba
commit
1ee325df48
@ -51,7 +51,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load);
|
|||||||
*/
|
*/
|
||||||
SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL);
|
SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL);
|
||||||
|
|
||||||
static char *SYNTAX = "curl url [headers|json|content-type <mime-type>|timeout <seconds>] [get|head|post|delete|put [data]]";
|
static char *SYNTAX = "curl url [headers|json|content-type <mime-type>|connect-timeout <seconds>|timeout <seconds>] [get|head|post|delete|put [data]]";
|
||||||
|
|
||||||
#define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack"
|
#define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack"
|
||||||
#define HTTP_SENDFILE_RESPONSE_SIZE 32768
|
#define HTTP_SENDFILE_RESPONSE_SIZE 32768
|
||||||
@ -944,6 +944,16 @@ SWITCH_STANDARD_API(curl_function)
|
|||||||
if (++i < argc) {
|
if (++i < argc) {
|
||||||
content_type = switch_core_strdup(pool, argv[i]);
|
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])) {
|
} else if (!strcasecmp("timeout", argv[i])) {
|
||||||
if (++i < argc) {
|
if (++i < argc) {
|
||||||
int tmp = atoi(argv[i]);
|
int tmp = atoi(argv[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user