diff --git a/app/src/main/java/app/fedilab/android/client/HttpsConnection.java b/app/src/main/java/app/fedilab/android/client/HttpsConnection.java index cd3c820ea..f5145ad73 100644 --- a/app/src/main/java/app/fedilab/android/client/HttpsConnection.java +++ b/app/src/main/java/app/fedilab/android/client/HttpsConnection.java @@ -236,7 +236,7 @@ public class HttpsConnection { httpsURLConnection.setInstanceFollowRedirects(false); httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory(this.instance)); httpsURLConnection.setRequestMethod("HEAD"); - if (httpsURLConnection.getResponseCode() == 301) { + if (httpsURLConnection.getResponseCode() == 301 || httpsURLConnection.getResponseCode() == 302) { Map> map = httpsURLConnection.getHeaderFields(); for (Map.Entry> entry : map.entrySet()) { if (entry.toString().toLowerCase().startsWith("location")) { @@ -809,7 +809,7 @@ public class HttpsConnection { httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT); int responseCode = httpsURLConnection.getResponseCode(); // always check HTTP response code first - if (responseCode == HttpURLConnection.HTTP_OK) { + if (responseCode >= 200 && responseCode < 400) { // opens input stream from the HTTP connection return httpsURLConnection.getInputStream(); } @@ -830,7 +830,7 @@ public class HttpsConnection { httpURLConnection.setRequestProperty("User-Agent", USER_AGENT); int responseCode = httpURLConnection.getResponseCode(); // always check HTTP response code first - if (responseCode == HttpURLConnection.HTTP_OK) { + if (responseCode >= 200 && responseCode < 400) { // opens input stream from the HTTP connection return httpURLConnection.getInputStream(); }