Bug 1366716 - Encode crash submission URI correctly; r=snorp
authorJim Chen <nchen@mozilla.com>
Thu, 25 May 2017 18:35:19 -0400
changeset 408855 60e0d98a2ae6c03a2f6708deecc1089fe026971f
parent 408854 35d857a41a7b6f269b6b2fa0c64e6f28168110e1
child 408856 950464e0d22c6fee9cc580255b17913bb64f27bf
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1366716
milestone55.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 1366716 - Encode crash submission URI correctly; r=snorp Correctly encode the crash submission URI so it's valid. MozReview-Commit-ID: KFqloHXDCSd
mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
--- a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
@@ -14,16 +14,18 @@ import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.InputStreamReader;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLDecoder;
 import java.nio.channels.Channels;
 import java.nio.channels.FileChannel;
 import java.security.MessageDigest;
 import java.util.zip.GZIPOutputStream;
 
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.util.ProxySelector;
 
@@ -405,17 +407,20 @@ public class CrashReporter extends AppCo
         String spec = extras.get(SERVER_URL_KEY);
         if (spec == null) {
             doFinish();
             return;
         }
 
         Log.i(LOGTAG, "server url: " + spec);
         try {
-            URI uri = new URI(spec);
+            final URL url = new URL(URLDecoder.decode(spec, "UTF-8"));
+            final URI uri = new URI(url.getProtocol(), url.getUserInfo(),
+                                    url.getHost(), url.getPort(),
+                                    url.getPath(), url.getQuery(), url.getRef());
             HttpURLConnection conn = (HttpURLConnection)ProxySelector.openConnectionWithProxy(uri);
             conn.setRequestMethod("POST");
             String boundary = generateBoundary();
             conn.setDoOutput(true);
             conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
             conn.setRequestProperty("Content-Encoding", "gzip");
 
             OutputStream os = new GZIPOutputStream(conn.getOutputStream());