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:
Christian Ludwig 2012-11-25 20:25:13 +01:00
parent 82426bb8e4
commit 94c63e9db9
1 changed files with 1 additions and 0 deletions

View File

@ -40,6 +40,7 @@ public class HttpDownloader extends Downloader {
URL url = new URL(status.getFeedFile().getDownload_url());
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(CONNECTION_TIMEOUT);
connection.setInstanceFollowRedirects(true);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
if (AppConfig.DEBUG) {