Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 373cfa75 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0...

[automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0 am: 97668ae1 am: fddbf1b6 am: d3c0db66

Change-Id: If07298bb4ecf8a55391a014568a3ea264358b0e9
parents 240b55de d3c0db66
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -719,6 +719,10 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                LOOP: while (end < length) {
                    switch (uriString.charAt(end)) {
                        case '/': // Start of path
                        case '\\':// Start of path
                          // Per http://url.spec.whatwg.org/#host-state, the \ character
                          // is treated as if it were a / character when encountered in a
                          // host
                        case '?': // Start of query
                        case '#': // Start of fragment
                            break LOOP;
@@ -757,6 +761,10 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                        case '#': // Start of fragment
                            return ""; // Empty path.
                        case '/': // Start of path!
                        case '\\':// Start of path!
                          // Per http://url.spec.whatwg.org/#host-state, the \ character
                          // is treated as if it were a / character when encountered in a
                          // host
                            break LOOP;
                    }
                    pathStart++;
+6 −0
Original line number Diff line number Diff line
@@ -192,6 +192,12 @@ public class UriTest extends TestCase {
        assertEquals("a:a@example.com:a@example2.com", uri.getAuthority());
        assertEquals("example2.com", uri.getHost());
        assertEquals(-1, uri.getPort());
        assertEquals("/path", uri.getPath());

        uri = Uri.parse("http://a.foo.com\\.example.com/path");
        assertEquals("a.foo.com", uri.getHost());
        assertEquals(-1, uri.getPort());
        assertEquals("\\.example.com/path", uri.getPath());
    }

    @SmallTest