[Asterisk-code-review] func_curl: Add 'followlocation' option to CURLOPT() (asterisk[13])

Sean Bright asteriskteam at digium.com
Fri Jan 10 13:32:41 CST 2020


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13587 )


Change subject: func_curl: Add 'followlocation' option to CURLOPT()
......................................................................

func_curl: Add 'followlocation' option to CURLOPT()

We allow for 'maxredirs' to be set, but this value is ignored when
followlocation is not enabled which, by default, it is not.

ASTERISK-17491 #close
Reported by: candrews

Change-Id: I96a4ab0142f2fb7d2e96ff976f6cf7b2982c761a
---
M funcs/func_curl.c
1 file changed, 10 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/13587/1

diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index 06a8b53..5ea04c2 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -108,8 +108,13 @@
 						<para>For HTTP(S) URIs, number of seconds to wait for a
 						server response</para>
 					</enum>
+					<enum name="followlocation">
+						<para>Whether or not to follow HTTP 3xx redirects (boolean)</para>
+					</enum>
 					<enum name="maxredirs">
-						<para>Maximum number of redirects to follow</para>
+						<para>Maximum number of redirects to follow. The default is -1,
+						which allows for unlimited redirects. This only makes sense when
+						followlocation is also set.</para>
 					</enum>
 					<enum name="proxy">
 						<para>Hostname or IP address to use as a proxy server</para>
@@ -247,6 +252,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;
@@ -803,6 +811,7 @@
 "  header         - Retrieve header information (boolean)\n"
 "  httpheader     - Add new custom http header (string)\n"
 "  httptimeout    - Number of seconds to wait for HTTP response\n"
+"  followlocation - Follow HTTP 3xx redirects (boolean)\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"

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13587
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I96a4ab0142f2fb7d2e96ff976f6cf7b2982c761a
Gerrit-Change-Number: 13587
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200110/737a6f88/attachment.html>


More information about the asterisk-code-review mailing list