From 15b18e26b71c53ca0d7a6be089e59e6f064759f4 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 11 Feb 2020 14:15:23 +0100 Subject: [PATCH] [http] Let the curl https client follow up to 5 redirects Requests for artwork to Cover Art Archive require redirects. Perhaps there are also some playlist requests that will benefit from this. --- src/http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/http.c b/src/http.c index 1d48c6f3..69da96e5 100644 --- a/src/http.c +++ b/src/http.c @@ -386,10 +386,13 @@ https_client_request_impl(struct http_client_ctx *ctx) curl_easy_setopt(curl, CURLOPT_POSTFIELDS, ctx->output_body); curl_easy_setopt(curl, CURLOPT_TIMEOUT, HTTP_CLIENT_TIMEOUT); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_request_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, ctx); + // Artwork and playlist requests might require redirects + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5); + /* Make request */ DPRINTF(E_INFO, L_HTTP, "Making request for %s\n", ctx->url); @@ -416,7 +419,6 @@ http_client_request(struct http_client_ctx *ctx) { if (strncmp(ctx->url, "http:", strlen("http:")) == 0) return http_client_request_impl(ctx); - #ifdef HAVE_LIBCURL if (strncmp(ctx->url, "https:", strlen("https:")) == 0) return https_client_request_impl(ctx);