mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-12-01 12:31:45 +00:00
Obey redirects in HTTP downloads
If an HTTP request returns an error code 301 or 302, follow redirects to the new location.
This commit is contained in:
@ -40,6 +40,7 @@ public class HttpDownloader extends Downloader {
|
|||||||
URL url = new URL(status.getFeedFile().getDownload_url());
|
URL url = new URL(status.getFeedFile().getDownload_url());
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
connection.setConnectTimeout(CONNECTION_TIMEOUT);
|
connection.setConnectTimeout(CONNECTION_TIMEOUT);
|
||||||
|
connection.setInstanceFollowRedirects(true);
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
if (AppConfig.DEBUG) {
|
if (AppConfig.DEBUG) {
|
||||||
|
|||||||
Reference in New Issue
Block a user