[Asterisk-code-review] res_http_media_cache.c: Set reasonable number of redirects (asterisk[16])

Friendly Automation asteriskteam at digium.com
Thu Dec 3 10:28:45 CST 2020


Hello Sean Bright,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15207

to review the following change.


Change subject: res_http_media_cache.c: Set reasonable number of redirects
......................................................................

res_http_media_cache.c: Set reasonable number of redirects

By default libcurl does not follow redirects, so we explicitly enable
it by setting CURLOPT_FOLLOWLOCATION. Once that is enabled, libcurl
will follow up to CURLOPT_MAXREDIRS redirects, which by default is
configured to be unlimited.

This patch sets CURLOPT_MAXREDIRS to a more reasonable default (8). If
we determine at some point that this needs to be increased on
configurable it is a trivial change.

ASTERISK-29173 #close

Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
---
M res/res_http_media_cache.c
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/15207/1

diff --git a/res/res_http_media_cache.c b/res/res_http_media_cache.c
index bca5763..d761442 100644
--- a/res/res_http_media_cache.c
+++ b/res/res_http_media_cache.c
@@ -215,6 +215,7 @@
 	curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_header_callback);
 	curl_easy_setopt(curl, CURLOPT_USERAGENT, GLOBAL_USERAGENT);
 	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
+	curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 8);
 	curl_easy_setopt(curl, CURLOPT_URL, ast_sorcery_object_get_id(cb_data->bucket_file));
 	curl_easy_setopt(curl, CURLOPT_HEADERDATA, cb_data);
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
Gerrit-Change-Number: 15207
Gerrit-PatchSet: 1
Gerrit-Owner: Friendly Automation
Gerrit-Reviewer: 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/20201203/249c9c0d/attachment.html>


More information about the asterisk-code-review mailing list