From b78657f67fdd9175e6dd038a9d3f05c9e9fc2d91 Mon Sep 17 00:00:00 2001 From: Looly Date: Tue, 27 Dec 2022 19:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DUrlBuilder=E4=B8=AD=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=AD=E5=8C=85=E6=8B=AC"://"=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- README-EN.md | 2 +- README.md | 2 +- .../src/main/java/cn/hutool/core/net/url/UrlBuilder.java | 6 ++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d4b036c8..5fce32081 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,8 @@ * 【db 】 修复NamedSql中in没有判断大小写问题(issue#2792@Github) * 【core 】 修复ZIP bomb漏洞(issue#2797@Github) * 【core 】 修复JSONXMLSerializer将Json转为XML时,遇到嵌套需要递归情况时会丢失contentKeys问题(pr#903@Gitee) -* 【core 】 修复通过jdbcurl创建SimpleDataSource报NullPointException(pr#900@Gitee) +* 【db 】 修复使用mariadb通过jdbcurl创建SimpleDataSource报NullPointException(pr#900@Gitee) +* 【core 】 修复UrlBuilder中参数中包括"://"判断错误问题(pr#898@Gitee) ------------------------------------------------------------------------------------------------------------- diff --git a/README-EN.md b/README-EN.md index 62d3e6089..d78d8a49c 100755 --- a/README-EN.md +++ b/README-EN.md @@ -41,7 +41,7 @@

- +

------------------------------------------------------------------------------- diff --git a/README.md b/README.md index a7e03e06c..f52458567 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@

- +

------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/net/url/UrlBuilder.java b/hutool-core/src/main/java/cn/hutool/core/net/url/UrlBuilder.java index 82445416a..018019987 100755 --- a/hutool-core/src/main/java/cn/hutool/core/net/url/UrlBuilder.java +++ b/hutool-core/src/main/java/cn/hutool/core/net/url/UrlBuilder.java @@ -108,8 +108,10 @@ public final class UrlBuilder implements Builder { */ public static UrlBuilder ofHttp(String httpUrl, Charset charset) { Assert.notBlank(httpUrl, "Http url must be not blank!"); - if (!httpUrl.startsWith("http://")&&!httpUrl.startsWith("https://")) { - httpUrl = "http://" + httpUrl.trim(); + httpUrl = StrUtil.trimStart(httpUrl); + // issue#I66CIR + if(false == StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){ + httpUrl = "http://" + httpUrl; } return of(httpUrl, charset); }