修复UrlBuilder中参数中包括"://"判断错误问题

This commit is contained in:
Looly 2022-12-27 19:41:52 +08:00
parent 7ee9b163c4
commit b78657f67f
4 changed files with 8 additions and 5 deletions

View File

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

View File

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

View File

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

View File

@ -108,8 +108,10 @@ public final class UrlBuilder implements Builder<String> {
*/ */
public static UrlBuilder ofHttp(String httpUrl, Charset charset) { public static UrlBuilder ofHttp(String httpUrl, Charset charset) {
Assert.notBlank(httpUrl, "Http url must be not blank!"); Assert.notBlank(httpUrl, "Http url must be not blank!");
if (!httpUrl.startsWith("http://")&&!httpUrl.startsWith("https://")) { httpUrl = StrUtil.trimStart(httpUrl);
httpUrl = "http://" + httpUrl.trim(); // issue#I66CIR
if(false == StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){
httpUrl = "http://" + httpUrl;
} }
return of(httpUrl, charset); return of(httpUrl, charset);
} }