提交 6aae3750 编写于 作者: A aefimov

8167223: URL handling improvements

Reviewed-by: prappo, chegar
上级 78fe4ea4
...@@ -161,9 +161,9 @@ public abstract class URLStreamHandler { ...@@ -161,9 +161,9 @@ public abstract class URLStreamHandler {
(spec.charAt(start + 1) == '/')) { (spec.charAt(start + 1) == '/')) {
start += 2; start += 2;
i = spec.indexOf('/', start); i = spec.indexOf('/', start);
if (i < 0) { if (i < 0 || i > limit) {
i = spec.indexOf('?', start); i = spec.indexOf('?', start);
if (i < 0) if (i < 0 || i > limit)
i = limit; i = limit;
} }
...@@ -171,8 +171,14 @@ public abstract class URLStreamHandler { ...@@ -171,8 +171,14 @@ public abstract class URLStreamHandler {
int ind = authority.indexOf('@'); int ind = authority.indexOf('@');
if (ind != -1) { if (ind != -1) {
userInfo = authority.substring(0, ind); if (ind != authority.lastIndexOf('@')) {
host = authority.substring(ind+1); // more than one '@' in authority. This is not server based
userInfo = null;
host = null;
} else {
userInfo = authority.substring(0, ind);
host = authority.substring(ind+1);
}
} else { } else {
userInfo = null; userInfo = null;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册