From 814cd0f88ddee858c89f692a4fd6d03627012919 Mon Sep 17 00:00:00 2001 From: Tony Tam <149837+tonytamsf@users.noreply.github.com> Date: Tue, 4 Jan 2022 07:11:24 -0800 Subject: follow 301 for authorization headers during download (#5612) --- .../danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java index 394eb3943..a2facae64 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java @@ -50,6 +50,10 @@ public class BasicAuthorizationInterceptor implements Interceptor { } Request.Builder newRequest = request.newBuilder(); + if (!TextUtils.equals(response.request().url().toString(), request.url().toString())) { + newRequest.url(response.request().url()); + } + Log.d(TAG, "Authorization failed, re-trying with ISO-8859-1 encoded credentials"); String credentials = HttpDownloader.encodeCredentials(parts[0], parts[1], "ISO-8859-1"); newRequest.header("Authorization", credentials); -- cgit v1.2.3