mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
force redirects, get inputstream first
This commit is contained in:
parent
b355991b0b
commit
eb462f0345
@ -180,6 +180,7 @@ public class MmsCommunication {
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
}
|
||||
|
||||
urlConnection.setInstanceFollowRedirects(true);
|
||||
urlConnection.setConnectTimeout(20*1000);
|
||||
urlConnection.setReadTimeout(20*1000);
|
||||
urlConnection.setUseCaches(false);
|
||||
|
@ -21,6 +21,7 @@ import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
import ws.com.google.android.mms.pdu.PduParser;
|
||||
@ -44,7 +45,8 @@ public class MmsDownloadHelper extends MmsCommunication {
|
||||
Log.w(TAG, "Connecting to " + url);
|
||||
client.connect();
|
||||
|
||||
int responseCode = client.getResponseCode();
|
||||
final InputStream is = client.getInputStream();
|
||||
final int responseCode = client.getResponseCode();
|
||||
|
||||
Log.w(TAG, "Response code: " + responseCode + "/" + client.getResponseMessage());
|
||||
|
||||
@ -52,7 +54,7 @@ public class MmsDownloadHelper extends MmsCommunication {
|
||||
throw new IOException("non-200 response");
|
||||
}
|
||||
|
||||
return parseResponse(client.getInputStream());
|
||||
return parseResponse(is);
|
||||
} finally {
|
||||
if (client != null) client.disconnect();
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ public class MmsSendHelper extends MmsCommunication {
|
||||
|
||||
Log.w(TAG, "Payload sent");
|
||||
|
||||
int responseCode = client.getResponseCode();
|
||||
final InputStream is = client.getInputStream();
|
||||
final int responseCode = client.getResponseCode();
|
||||
|
||||
Log.w(TAG, "Response code: " + responseCode + "/" + client.getResponseMessage());
|
||||
|
||||
@ -74,7 +75,7 @@ public class MmsSendHelper extends MmsCommunication {
|
||||
throw new IOException("non-200 response");
|
||||
}
|
||||
|
||||
return parseResponse(client.getInputStream());
|
||||
return parseResponse(is);
|
||||
} finally {
|
||||
if (client != null) client.disconnect();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user