Skip to content

Commit

Permalink
Merge pull request #1605 from ivassile/JBEAP-27014
Browse files Browse the repository at this point in the history
[UNDERTOW-2383] do not canonicalize query string in sendRedirect location
  • Loading branch information
fl4via authored Jun 21, 2024
2 parents fbe9b3b + 85ee324 commit 282d7ff
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ public void sendRedirect(final String location) throws IOException {
} else {
current = "";
}
realPath = CanonicalPathUtils.canonicalize(servletContext.getContextPath() + current + location);
String precanonLocation = location;
String query = "";
int firstQuestionMark = location.indexOf("?");
if (firstQuestionMark >= 0) {
precanonLocation = location.substring(0, firstQuestionMark);
query = location.substring(firstQuestionMark);
}
realPath = CanonicalPathUtils.canonicalize(servletContext.getContextPath() + current + precanonLocation) + query;
}
String loc = exchange.getRequestScheme() + "://" + exchange.getHostAndPort() + realPath;
exchange.getResponseHeaders().put(Headers.LOCATION, loc);
Expand Down

0 comments on commit 282d7ff

Please sign in to comment.