Skip to content

Commit

Permalink
Check if scheme is localhost and fail
Browse files Browse the repository at this point in the history
Fixes gh-2919
  • Loading branch information
spencergibb committed Mar 12, 2024
1 parent de105a1 commit c6dbf0e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ public B uri(URI uri) {
this.uri = uri;
String scheme = this.uri.getScheme();
Assert.hasText(scheme, "The parameter [" + this.uri + "] format is incorrect, scheme can not be empty");
if (!scheme.equalsIgnoreCase("forward")) {
Assert.hasText(this.uri.getHost(),
"The parameter [" + this.uri + "] format is incorrect, host can not be empty");
if (scheme.equalsIgnoreCase("localhost")) {
// common error
// TODO: find a general way to detect without breaking existing behavior
throw new IllegalArgumentException(
"The parameter [" + this.uri + "] format is incorrect, scheme can not be localhost");
}
if (this.uri.getPort() < 0 && scheme.startsWith("http")) {
// default known http ports
Expand Down

0 comments on commit c6dbf0e

Please sign in to comment.