aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpUploadConnection.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
index 609ad65d3..0fa79ff8f 100644
--- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
@@ -155,11 +155,13 @@ public class HttpUploadConnection implements Transferable {
PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_upload_" + message.getUuid());
try {
fileInputStream = new FileInputStream(file);
+ final String slotHostname = slot.getPutUrl().getHost();
+ final boolean onionSlot = slotHostname != null && slotHostname.endsWith(".onion");
final int expectedFileSize = (int) file.getExpectedSize();
final int readTimeout = ((expectedFileSize / 2048) + Config.SOCKET_TIMEOUT) * 1000; //assuming a minimum transfer speed of 16kbit/s
wakeLock.acquire(readTimeout);
Log.d(Config.LOGTAG, "uploading to " + slot.getPutUrl().toString() + " w/ read timeout of " + readTimeout / 1000 + "s");
- if (mUseTor || message.getConversation().getAccount().isOnion()) {
+ if (mUseTor || message.getConversation().getAccount().isOnion() || onionSlot) {
connection = (HttpURLConnection) slot.getPutUrl().openConnection(HttpConnectionManager.getProxy());
} else {
connection = (HttpURLConnection) slot.getPutUrl().openConnection();