Skip to content

Commit

Permalink
Improve url validation. Fixes gh-873.
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaMaciaszek committed Dec 4, 2023
1 parent d8bb856 commit c03f78a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ <T> T getTarget() {
if (LOG.isInfoEnabled()) {
LOG.info("For '" + name + "' URL not provided. Will try picking an instance via load-balancing.");
}
if (!name.startsWith("http")) {
if (!name.startsWith("http://") && !name.startsWith("https://")) {
url = "http://" + name;
}
else {
Expand All @@ -426,7 +426,7 @@ <T> T getTarget() {
url += cleanPath();
return (T) loadBalance(builder, context, new HardCodedTarget<>(type, name, url));
}
if (StringUtils.hasText(url) && !url.startsWith("http")) {
if (StringUtils.hasText(url) && !url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url;
}
String url = this.url + cleanPath();
Expand Down

0 comments on commit c03f78a

Please sign in to comment.