[pacman-dev] [PATCHv2] libalpm: prevent 301 redirect loop from hanging the process

Allan McRae allan at archlinux.org
Wed Feb 6 23:51:58 UTC 2019


On 7/2/19 12:36 am, Mark Ulrich wrote:
> If a mirror responds with a 301 redirect to itself, it will create an
> infinite redirect loop. This will cause pacman to hang, unresponsive to
> even a SIGINT. The result is pacman being unable to sync or
> download any package from a particular repo if its current mirror
> is stuck in a redirect loop. Setting libcurl's MAXREDIRS option
> effectively prevents a redirect loop from hanging the process.
> 
> Signed-off-by: Mark Ulrich <mark.ulrich.86 at gmail.com>
> ---
>  lib/libalpm/dload.c | 1 +
>  1 file changed, 1 insertion(+)

Great!  Applied.

Allan

> 
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index 36ae4ee1..7b114230 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -259,6 +259,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
>  	curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
>  	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
>  	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
> +	curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
>  	curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
>  	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
>  	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
> 


More information about the pacman-dev mailing list