Bug 1169421 - Switch Fennec to use ch.boye instead of org.apache.http to allow for building with Android M SDK 23. r=mfinkle
authorAmogh Pradeep <amoghbl1@gmail.com>
Sat, 20 Jun 2015 01:13:47 -0500
changeset 254108 7b48142f4120394cdc247b06e8f9c4eb40eaf765
parent 254107 7ecd5948ed30c024d9ef77f8f1c7516aedc6643e
child 254109 fe835839b4ec3ae3e63e31d9fa514b0b8da522b7
push id29089
push userryanvm@gmail.com
push dateWed, 22 Jul 2015 20:29:27 +0000
treeherdermozilla-central@7abecce35aca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs1169421
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169421 - Switch Fennec to use ch.boye instead of org.apache.http to allow for building with Android M SDK 23. r=mfinkle
mobile/android/base/distribution/Distribution.java
mobile/android/base/favicons/LoadFaviconTask.java
--- a/mobile/android/base/distribution/Distribution.java
+++ b/mobile/android/base/distribution/Distribution.java
@@ -27,17 +27,17 @@ import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
 import javax.net.ssl.SSLException;
 
-import org.apache.http.protocol.HTTP;
+import ch.boye.httpclientandroidlib.protocol.HTTP;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.GeckoSharedPrefs;
 import org.mozilla.gecko.Telemetry;
--- a/mobile/android/base/favicons/LoadFaviconTask.java
+++ b/mobile/android/base/favicons/LoadFaviconTask.java
@@ -3,23 +3,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.favicons;
 
 
 import android.content.ContentResolver;
 import android.content.Context;
 import android.graphics.Bitmap;
-import android.net.http.AndroidHttpClient;
+import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
 import android.text.TextUtils;
 import android.util.Log;
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
+import ch.boye.httpclientandroidlib.Header;
+import ch.boye.httpclientandroidlib.HttpEntity;
+import ch.boye.httpclientandroidlib.HttpResponse;
+import ch.boye.httpclientandroidlib.client.methods.HttpGet;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.favicons.decoders.FaviconDecoder;
 import org.mozilla.gecko.favicons.decoders.LoadFaviconResult;
 import org.mozilla.gecko.util.GeckoJarReader;
 import org.mozilla.gecko.util.IOUtils;
 import org.mozilla.gecko.util.ThreadUtils;
@@ -67,17 +67,17 @@ public class LoadFaviconTask {
     private final boolean onlyFromLocal;
     volatile boolean mCancelled;
 
     // Assuming square favicons, judging by width only is acceptable.
     protected int targetWidth;
     private LinkedList<LoadFaviconTask> chainees;
     private boolean isChaining;
 
-    static AndroidHttpClient httpClient = AndroidHttpClient.newInstance(GeckoAppShell.getGeckoInterface().getDefaultUAString());
+    static DefaultHttpClient httpClient = new DefaultHttpClient();
 
     public LoadFaviconTask(Context context, String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener) {
         this(context, pageURL, faviconURL, flags, listener, -1, false);
     }
 
     public LoadFaviconTask(Context context, String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener,
                            int targetWidth, boolean onlyFromLocal) {
         id = nextFaviconLoadId.incrementAndGet();
@@ -123,16 +123,17 @@ public class LoadFaviconTask {
         return tryDownloadRecurse(faviconURI, visitedLinkSet);
     }
     private HttpResponse tryDownloadRecurse(URI faviconURI, HashSet<String> visited) throws URISyntaxException, IOException {
         if (visited.size() == MAX_REDIRECTS_TO_FOLLOW) {
             return null;
         }
 
         HttpGet request = new HttpGet(faviconURI);
+        request.setHeader("User-Agent", GeckoAppShell.getGeckoInterface().getDefaultUAString());
         HttpResponse response = httpClient.execute(request);
         if (response == null) {
             return null;
         }
 
         if (response.getStatusLine() != null) {
 
             // Was the response a failure?