diff options
author | Selim Gurun <sgurun@google.com> | 2012-06-13 20:39:37 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-13 20:39:37 -0700 |
commit | 17e3ba9b808c0ca3b4a06c3964437204e76f9d30 (patch) | |
tree | b5c8fb6cb94b225a2bff266382c5acd492609f43 /src/com | |
parent | 61bb5caabb5836e4dfff1ef0a66be237d1213b2e (diff) | |
parent | a770f8d4bd583e9a719af6ce314838db12003b33 (diff) | |
download | packages_apps_browser-17e3ba9b808c0ca3b4a06c3964437204e76f9d30.zip packages_apps_browser-17e3ba9b808c0ca3b4a06c3964437204e76f9d30.tar.gz packages_apps_browser-17e3ba9b808c0ca3b4a06c3964437204e76f9d30.tar.bz2 |
am a770f8d4: Encode characters that java.net.URI rejects
* commit 'a770f8d4bd583e9a719af6ce314838db12003b33':
Encode characters that java.net.URI rejects
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/DownloadHandler.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/FetchUrlMimeType.java | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java index 31212b4..1da6795 100644 --- a/src/com/android/browser/DownloadHandler.java +++ b/src/com/android/browser/DownloadHandler.java @@ -107,7 +107,7 @@ public class DownloadHandler { boolean needed = false; for (char c : chars) { - if (c == '[' || c == ']') { + if (c == '[' || c == ']' || c == '|') { needed = true; break; } @@ -118,7 +118,7 @@ public class DownloadHandler { StringBuilder sb = new StringBuilder(""); for (char c : chars) { - if (c == '[' || c == ']') { + if (c == '[' || c == ']' || c == '|') { sb.append('%'); sb.append(Integer.toHexString(c)); } else { diff --git a/src/com/android/browser/FetchUrlMimeType.java b/src/com/android/browser/FetchUrlMimeType.java index 845bcc7..07c9b93 100644 --- a/src/com/android/browser/FetchUrlMimeType.java +++ b/src/com/android/browser/FetchUrlMimeType.java @@ -27,6 +27,7 @@ import android.content.Context; import android.net.Proxy; import android.net.http.AndroidHttpClient; import android.os.Environment; +import android.util.Log; import android.webkit.MimeTypeMap; import android.webkit.URLUtil; @@ -44,6 +45,8 @@ import java.io.IOException; */ class FetchUrlMimeType extends Thread { + private final static String LOGTAG = "FetchUrlMimeType"; + private Context mContext; private DownloadManager.Request mRequest; private String mUri; @@ -64,9 +67,16 @@ class FetchUrlMimeType extends Thread { // User agent is likely to be null, though the AndroidHttpClient // seems ok with that. AndroidHttpClient client = AndroidHttpClient.newInstance(mUserAgent); - HttpHost httpHost = Proxy.getPreferredHttpHost(mContext, mUri); - if (httpHost != null) { - ConnRouteParams.setDefaultProxy(client.getParams(), httpHost); + HttpHost httpHost; + try { + httpHost = Proxy.getPreferredHttpHost(mContext, mUri); + if (httpHost != null) { + ConnRouteParams.setDefaultProxy(client.getParams(), httpHost); + } + } catch (IllegalArgumentException ex) { + Log.e(LOGTAG,"Download failed: " + ex); + client.close(); + return; } HttpHead request = new HttpHead(mUri); |