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

George Joseph asteriskteam at digium.com
Wed Dec 9 13:04:52 CST 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15193 )

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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



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/+/15193
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
Gerrit-Change-Number: 15193
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201209/87ad53e5/attachment-0001.html>


More information about the asterisk-code-review mailing list