From 25a49a28ce7e90405c2f0162cb04522544695109 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 13 Mar 2018 11:59:32 +0100 Subject: [PATCH] disable caches in HttpUrlConnections --- .../eu/siacs/conversations/http/HttpDownloadConnection.java | 2 ++ .../java/eu/siacs/conversations/http/HttpUploadConnection.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index 173d29634..9f2bd327a 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -226,6 +226,7 @@ public class HttpDownloadConnection implements Transferable { connection = (HttpURLConnection) mUrl.openConnection(); } connection.setRequestMethod("HEAD"); + connection.setUseCaches(false); Log.d(Config.LOGTAG, "url: " + connection.getURL().toString()); Log.d(Config.LOGTAG, "connection: " + connection.toString()); connection.setRequestProperty("User-Agent", mXmppConnectionService.getIqGenerator().getIdentityName()); @@ -295,6 +296,7 @@ public class HttpDownloadConnection implements Transferable { if (connection instanceof HttpsURLConnection) { mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, interactive); } + connection.setUseCaches(false); connection.setRequestProperty("User-Agent", mXmppConnectionService.getIqGenerator().getIdentityName()); final boolean tryResume = file.exists() && file.getKey() == null && file.getSize() > 0; long resumeSize = 0; diff --git a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java index ea5c176a0..4f72baf03 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java @@ -186,6 +186,7 @@ public class HttpUploadConnection implements Transferable { if (connection instanceof HttpsURLConnection) { mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, true); } + connection.setUseCaches(false); connection.setRequestMethod("PUT"); connection.setFixedLengthStreamingMode(expectedFileSize); connection.setRequestProperty("Content-Type", mime == null ? "application/octet-stream" : mime);