From f26dbb2f3447a95a46ee3eb29dedc170525b762c Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 31 Oct 2012 17:56:39 -0700 Subject: [PATCH] disambiguate --- .../securesms/mms/MmsDownloadHelper.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/org/thoughtcrime/securesms/mms/MmsDownloadHelper.java b/src/org/thoughtcrime/securesms/mms/MmsDownloadHelper.java index 303f1d859e..280aef8f92 100644 --- a/src/org/thoughtcrime/securesms/mms/MmsDownloadHelper.java +++ b/src/org/thoughtcrime/securesms/mms/MmsDownloadHelper.java @@ -19,8 +19,6 @@ package org.thoughtcrime.securesms.mms; import android.content.Context; import android.util.Log; -import org.apache.http.HttpHost; -import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; @@ -30,34 +28,25 @@ import org.apache.http.client.methods.HttpGet; import ws.com.google.android.mms.MmsException; import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; public class MmsDownloadHelper extends MmsCommunication { private static byte[] makeRequest(MmsConnectionParameters connectionParameters, String url) throws ClientProtocolException, IOException { - try { - HttpClient client = constructHttpClient(connectionParameters); - URI hostUrl = new URI(url); - HttpHost target = new HttpHost(hostUrl.getHost(), hostUrl.getPort(), HttpHost.DEFAULT_SCHEME_NAME); - HttpRequest request = new HttpGet(url); + HttpClient client = constructHttpClient(connectionParameters); + HttpGet request = new HttpGet(url); - request.setParams(client.getParams()); - request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"); + request.setParams(client.getParams()); + request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"); - HttpResponse response = client.execute(target, request); - StatusLine status = response.getStatusLine(); + HttpResponse response = client.execute(request); + StatusLine status = response.getStatusLine(); - if (status.getStatusCode() != 200) - throw new IOException("Non-successful HTTP response: " + status.getReasonPhrase()); + if (status.getStatusCode() != 200) + throw new IOException("Non-successful HTTP response: " + status.getReasonPhrase()); - return parseResponse(response.getEntity()); - } catch (URISyntaxException use) { - Log.w("MmsDownlader", use); - throw new IOException("Bad URI syntax"); - } + return parseResponse(response.getEntity()); } public static byte[] retrieveMms(Context context, String url, String apn) throws IOException {