Skip to content

Commit

Permalink
#18 problem fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Nov 15, 2016
1 parent e8e118b commit 30a989d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/io/jare/tk/TkRelay.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ public Response act(final Request req) throws IOException {
"parameter \"u\" is mandatory"
);
}
final URI uri = URI.create(param.next().trim());
final String target = param.next().trim();
if (!TkRelay.PTN.matcher(target).matches()) {
throw new HttpException(
HttpURLConnection.HTTP_BAD_REQUEST,
String.format(
"target URL \"%s\" is not compliant with RFC3986",
target
)
);
}
final URI uri = URI.create(target);
final String host = uri.getHost().toLowerCase(Locale.ENGLISH);
final Iterator<Domain> domains = this.base.domain(host);
if (!domains.hasNext()) {
Expand Down

0 comments on commit 30a989d

Please sign in to comment.