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); URL url = new URL(src);
Log.i("Caching url=" + url); Log.i("Caching url=" + url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); HttpURLConnection connection = null;
connection.setRequestMethod("GET");
connection.setReadTimeout(timeout);
connection.setConnectTimeout(timeout);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("User-Agent", WebViewEx.getUserAgent(context));
connection.connect();
try { try {
int status = connection.getResponseCode(); connection = Helper.openUrlRedirect(context, src, timeout);
if (status != HttpURLConnection.HTTP_OK)
throw new FileNotFoundException("Error " + status + ": " + connection.getResponseMessage());
Helper.copy(connection.getInputStream(), os); Helper.copy(connection.getInputStream(), os);
} finally { } finally {
if (connection != null)
connection.disconnect(); connection.disconnect();
} }
} catch (Throwable ex) { } catch (Throwable ex) {

Loading…
Cancel
Save