Print/images follow redirect

pull/204/head
M66B 3 years ago
parent 974957a315
commit 945b903312

@ -8125,21 +8125,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
URL url = new URL(src);
Log.i("Caching url=" + url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(timeout);
connection.setConnectTimeout(timeout);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("User-Agent", WebViewEx.getUserAgent(context));
connection.connect();
HttpURLConnection connection = null;
try {
int status = connection.getResponseCode();
if (status != HttpURLConnection.HTTP_OK)
throw new FileNotFoundException("Error " + status + ": " + connection.getResponseMessage());
connection = Helper.openUrlRedirect(context, src, timeout);
Helper.copy(connection.getInputStream(), os);
} finally {
if (connection != null)
connection.disconnect();
}
} catch (Throwable ex) {

Loading…
Cancel
Save