Skip to content

Commit b78657f

Browse files
committed
修复UrlBuilder中参数中包括"://"判断错误问题
1 parent 7ee9b16 commit b78657f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
* 【db 】 修复NamedSql中in没有判断大小写问题(issue#2792@Github)
2323
* 【core 】 修复ZIP bomb漏洞(issue#2797@Github)
2424
* 【core 】 修复JSONXMLSerializer将Json转为XML时,遇到嵌套需要递归情况时会丢失contentKeys问题(pr#903@Gitee)
25-
* 【core 】 修复通过jdbcurl创建SimpleDataSource报NullPointException(pr#900@Gitee)
25+
* 【db 】 修复使用mariadb通过jdbcurl创建SimpleDataSource报NullPointException(pr#900@Gitee)
26+
* 【core 】 修复UrlBuilder中参数中包括"://"判断错误问题(pr#898@Gitee)
2627

2728
-------------------------------------------------------------------------------------------------------------
2829

README-EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<br/>
4242
<p align="center">
4343
<a href="https://qm.qq.com/cgi-bin/qm/qr?k=QtsqXLkHpLjE99tkre19j6pjPMhSay1a&jump_from=webapi">
44-
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A5-715292493-orange"/></a>
44+
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A6-715292493-orange"/></a>
4545
</p>
4646

4747
-------------------------------------------------------------------------------

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<br/>
4242
<p align="center">
4343
<a href="https://qm.qq.com/cgi-bin/qm/qr?k=QtsqXLkHpLjE99tkre19j6pjPMhSay1a&jump_from=webapi">
44-
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A5-715292493-orange"/></a>
44+
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A6-715292493-orange"/></a>
4545
</p>
4646

4747
-------------------------------------------------------------------------------

hutool-core/src/main/java/cn/hutool/core/net/url/UrlBuilder.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ public static UrlBuilder ofHttp(String httpUrl) {
108108
*/
109109
public static UrlBuilder ofHttp(String httpUrl, Charset charset) {
110110
Assert.notBlank(httpUrl, "Http url must be not blank!");
111-
if (!httpUrl.startsWith("http://")&&!httpUrl.startsWith("https://")) {
112-
httpUrl = "http://" + httpUrl.trim();
111+
httpUrl = StrUtil.trimStart(httpUrl);
112+
// issue#I66CIR
113+
if(false == StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){
114+
httpUrl = "http://" + httpUrl;
113115
}
114116
return of(httpUrl, charset);
115117
}

0 commit comments

Comments
 (0)