update new sdk
This commit is contained in:
parent
f33907443a
commit
744c72c133
1643 changed files with 83006 additions and 28021 deletions
20
android/libcore/luni/src/test/java/libcore/java/net/URLTest.java
Normal file → Executable file
20
android/libcore/luni/src/test/java/libcore/java/net/URLTest.java
Normal file → Executable file
|
@ -409,6 +409,26 @@ public final class URLTest extends TestCase {
|
|||
assertEquals("http://host/a/c", url.toString()); // RI doesn't canonicalize
|
||||
}
|
||||
|
||||
public void testPathContainsBackslash() throws Exception {
|
||||
URL url = new URL("http://host\\path@foo");
|
||||
assertEquals("\\path@foo", url.getPath());
|
||||
assertEquals("host", url.getHost());
|
||||
}
|
||||
|
||||
public void testQueryContainsForwardSlash() throws Exception {
|
||||
URL url = new URL("http://host?query/foo");
|
||||
assertEquals("", url.getPath());
|
||||
assertEquals("host", url.getHost());
|
||||
assertEquals("query/foo", url.getQuery());
|
||||
}
|
||||
|
||||
public void testFragmentContainsForwardSlash() throws Exception {
|
||||
URL url = new URL("http://host#fragment/foo");
|
||||
assertEquals("", url.getPath());
|
||||
assertEquals("host", url.getHost());
|
||||
assertEquals("fragment/foo", url.getRef());
|
||||
}
|
||||
|
||||
public void testRelativePathAndFragment() throws Exception {
|
||||
URL base = new URL("http://host/file");
|
||||
assertEquals("http://host/another#fragment", new URL(base, "another#fragment").toString());
|
||||
|
|
17
android/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java
Normal file → Executable file
17
android/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java
Normal file → Executable file
|
@ -167,12 +167,25 @@ public abstract class URLStreamHandler {
|
|||
if (!isUNCName && (start <= limit - 2) && (spec.charAt(start) == '/') &&
|
||||
(spec.charAt(start + 1) == '/')) {
|
||||
start += 2;
|
||||
// BEGIN Android-changed: Check for all hostname termination chars. http://b/110955991
|
||||
/*
|
||||
i = spec.indexOf('/', start);
|
||||
if (i < 0 || i > limit) {
|
||||
i = spec.indexOf('?', start);
|
||||
if (i < 0 || i > limit)
|
||||
i = limit;
|
||||
}
|
||||
*/
|
||||
LOOP: for (i = start; i < limit; i++) {
|
||||
switch (spec.charAt(i)) {
|
||||
case '/': // Start of path
|
||||
case '\\': // Start of path - see https://url.spec.whatwg.org/#host-state
|
||||
case '?': // Start of query
|
||||
case '#': // Start of fragment
|
||||
break LOOP;
|
||||
}
|
||||
}
|
||||
// END Android-changed: Check for all hostname termination chars. http://b/110955991
|
||||
|
||||
host = authority = spec.substring(start, i);
|
||||
|
||||
|
@ -266,7 +279,9 @@ public abstract class URLStreamHandler {
|
|||
|
||||
// Parse the file path if any
|
||||
if (start < limit) {
|
||||
if (spec.charAt(start) == '/') {
|
||||
// Android-changed: Check for all hostname termination chars. http://b/110955991
|
||||
// if (spec.charAt(start) == '/') {
|
||||
if (spec.charAt(start) == '/' || spec.charAt(start) == '\\') {
|
||||
path = spec.substring(start, limit);
|
||||
} else if (path != null && path.length() > 0) {
|
||||
isRelPath = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue