Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNPUTmice/Conversations.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2022-03-30 19:45:18 +0300
committerDaniel Gultsch <daniel@gultsch.de>2022-03-30 19:45:18 +0300
commit95e3a6769d6cdc08ff86d70fb8cb561974346501 (patch)
tree89c387a2343da825c6c5b1b39feb2ddc92e4070e
parenteadb1e127b81005b8d83a86197e6c71ce0115fcc (diff)
retrieve uncompressed file size in HEAD request
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index 032496842..850c0683d 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -322,6 +322,7 @@ public class HttpDownloadConnection implements Transferable {
);
final Request request = new Request.Builder()
.url(URL.stripFragment(mUrl))
+ .addHeader("Accept-Encoding", "identity")
.head()
.build();
mostRecentCall = client.newCall(request);
@@ -347,11 +348,11 @@ public class HttpDownloadConnection implements Transferable {
throw new IOException("Server reported negative file size");
}
return size;
- } catch (IOException e) {
+ } catch (final IOException e) {
Log.d(Config.LOGTAG, "io exception during HEAD " + e.getMessage());
throw e;
- } catch (NumberFormatException e) {
- throw new IOException();
+ } catch (final NumberFormatException e) {
+ throw new IOException(e);
}
}