From: Sean Bright Date: Sat, 21 Nov 2020 17:51:48 +0000 (-0500) Subject: res_http_media_cache.c: Set reasonable number of redirects X-Git-Tag: 18.2.0-rc1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f39d5ea7cdd142ea8782d690022a1415c9b2411b;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_http_media_cache.c b/res/res_http_media_cache.c index bca576372c..d761442b41 100644 --- a/res/res_http_media_cache.c +++ b/res/res_http_media_cache.c @@ -215,6 +215,7 @@ static CURL *get_curl_instance(struct curl_bucket_file_data *cb_data) 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);