Limit scheme/host check in fromUriString to HTTP URLs

Closes gh-26258
This commit is contained in:
Rossen Stoyanchev 2020-12-17 14:49:57 +00:00
parent d3e1c54354
commit f07fc76cf3
1 changed files with 2 additions and 2 deletions

View File

@ -252,8 +252,8 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
builder.schemeSpecificPart(ssp);
}
else {
if (StringUtils.hasLength(scheme) && !StringUtils.hasLength(host)) {
throw new IllegalArgumentException("[" + uri + "] is not a valid URI");
if (StringUtils.hasLength(scheme) && scheme.startsWith("http") && !StringUtils.hasLength(host)) {
throw new IllegalArgumentException("[" + uri + "] is not a valid HTTP URL");
}
builder.userInfo(userInfo);
builder.host(host);