Permalink
Browse files

When generating a redirect to a directory in the Default Servlet, avo…

…id generating a protocol relative redirect.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1840055 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
markt-asf committed Sep 4, 2018
1 parent 94155ef commit efb860b3ff8ebcf606199b8d0d432f76898040da
Showing with 8 additions and 0 deletions.
  1. +4 −0 java/org/apache/catalina/servlets/DefaultServlet.java
  2. +4 −0 webapps/docs/changelog.xml
@@ -1313,6 +1313,10 @@ private void doDirectoryRedirect(HttpServletRequest request, HttpServletResponse
location.append('?');
location.append(request.getQueryString());
}
// Avoid protocol relative redirects
while (location.length() > 1 && location.charAt(1) == '/') {
location.deleteCharAt(0);
}
response.sendRedirect(response.encodeRedirectURL(location.toString()));
}
@@ -72,6 +72,10 @@
<fix>
<bug>62667</bug>: Add recursion to rewrite substitution parsing. (remm)
</fix>
<fix>
When generating a redirect to a directory in the Default Servlet, avoid
generating a protocol relative redirect. (markt)
</fix>
</changelog>
</subsection>
<subsection name="Coyote">

0 comments on commit efb860b

Please sign in to comment.