--- funcs/func_curl.c 2016-04-19 15:46:17.579734476 -0500
+++ funcs/func_curl_fixed.c 2016-04-19 16:19:40.260259838 -0500
@@ -103,6 +103,10 @@
For HTTP(S) URIs, number of seconds to wait for a
server response
+
+ Whether or not to follow any Location header in a HTTP 3xx
+ response.
+
Maximum number of redirects to follow
@@ -136,6 +140,9 @@
to use for authentication when the server response to
an initial request indicates a 401 status code.
+
+ Set the preferred SSL/TLS version.
+
Whether to verify the server certificate against
a list of known root certificate authorities (boolean).
@@ -215,6 +222,16 @@
HASHCOMPAT_LEGACY,
};
+enum sslversion {
+ DEFAULT = 0,
+ TLSv1,
+ SSLv2,
+ SSLv3,
+ TLSv1_0,
+ TLSv1_1,
+ TLSv1_2
+};
+
static int parse_curlopt_key(const char *name, CURLoption *key, enum optiontype *ot)
{
if (!strcasecmp(name, "header")) {
@@ -238,6 +255,9 @@
} else if (!strcasecmp(name, "proxyuserpwd")) {
*key = CURLOPT_PROXYUSERPWD;
*ot = OT_STRING;
+ } else if (!strcasecmp(name, "followlocation")) {
+ *key = CURLOPT_FOLLOWLOCATION;
+ *ot = OT_BOOLEAN;
} else if (!strcasecmp(name, "maxredirs")) {
*key = CURLOPT_MAXREDIRS;
*ot = OT_INTEGER;
@@ -278,6 +298,9 @@
} else if (!strcasecmp(name, "hashcompat")) {
*key = CURLOPT_SPECIAL_HASHCOMPAT;
*ot = OT_ENUM;
+ } else if (!strcasecmp(name, "sslversion")) {
+ *key = CURLOPT_SSLVERSION;
+ *ot = OT_ENUM;
} else {
return -1;
}
@@ -371,6 +394,29 @@
if ((new = ast_calloc(1, sizeof(*new)))) {
new->value = (void *) (long) (!strcasecmp(value, "legacy") ? HASHCOMPAT_LEGACY : ast_true(value) ? HASHCOMPAT_YES : HASHCOMPAT_NO);
}
+ } else if (key == CURLOPT_SSLVERSION) {
+ long ver = CURL_SSLVERSION_DEFAULT;
+ if (0) {
+
+ } else if (!strcasecmp(value, "tlsv1")) {
+ ver = CURL_SSLVERSION_TLSv1;
+ } else if (!strcasecmp(value, "sslv2")) {
+ ver = CURL_SSLVERSION_SSLv2;
+ } else if (!strcasecmp(value, "sslv3")) {
+ ver = CURL_SSLVERSION_SSLv3;
+#if CURLVERSION_ATLEAST(7,34,0)
+ } else if (!strcasecmp(value, "tlsv1.0")) {
+ ver = CURL_SSLVERSION_TLSv1_0;
+ } else if (!strcasecmp(value, "tlsv1.1")) {
+ ver = CURL_SSLVERSION_TLSv1_1;
+ } else if (!strcasecmp(value, "tlsv1.2")) {
+ ver = CURL_SSLVERSION_TLSv1_2;
+#endif
+ }
+
+ if ((new = ast_calloc(1, sizeof(*new)))) {
+ new->value = (void *)ver;
+ }
} else {
/* Highly unlikely */
goto yuck;
@@ -776,6 +822,7 @@
" ftptimeout - For FTP, the server response timeout\n"
" header - Retrieve header information (boolean)\n"
" httptimeout - Number of seconds to wait for HTTP response\n"
+" followlocation - Whether or not to follow any Location header in a HTTP 3xx response\n"
" maxredirs - Maximum number of redirects to follow\n"
" proxy - Hostname or IP to use as a proxy\n"
" proxytype - http, socks4, or socks5\n"
@@ -784,6 +831,7 @@
" referer - Referer URL to use for the request\n"
" useragent - UserAgent string to use\n"
" userpwd - A : to use for authentication\n"
+" sslversion - Set the preferred SSL/TLS version\n"
" ssl_verifypeer - Whether to verify the peer certificate (boolean)\n"
" hashcompat - Result data will be compatible for use with HASH()\n"
" - if value is \"legacy\", will translate '+' to ' '\n"