diff options
author | Thomas Watson | 2018-09-04 14:42:47 +0000 |
---|---|---|
committer | Thomas Watson | 2018-09-05 19:52:27 +0000 |
commit | e447a42982b5fe6d6c860b062b9806d4a37d3d88 (patch) | |
tree | 0c849377b1767f1a54f798fbf6091b303254a22d /bundles/org.eclipse.equinox.http.servlet/src/org/eclipse | |
parent | 95672c3851ca252895750bba8bfb9995d4fee56c (diff) | |
download | rt.equinox.bundles-e447a42982b5fe6d6c860b062b9806d4a37d3d88.tar.gz rt.equinox.bundles-e447a42982b5fe6d6c860b062b9806d4a37d3d88.tar.xz rt.equinox.bundles-e447a42982b5fe6d6c860b062b9806d4a37d3d88.zip |
Bug 536708 - Multipart request responded with 302 under JettyY20180905-2200
Rework fix to use split with a max to handle trailing SLASH
Change-Id: Ia303f97db59bbd1de6a98bcbe7b1385788dd8c14
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.http.servlet/src/org/eclipse')
-rw-r--r-- | bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java index db26e9dcb..a4d64bb2b 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java @@ -67,9 +67,9 @@ public class ProxyServlet extends HttpServlet { } String requestUri = HttpServletRequestWrapperImpl.getDispatchRequestURI(request); - // NOTE split does not include trailing empty strings for paths that end in SLASH - String[] pathInfoSegments = pathInfo.split(Const.SLASH); - String[] requestUriSegments = requestUri.split(Const.SLASH); + // NOTE use split that takes a max to preserve ending SLASH + String[] pathInfoSegments = pathInfo.split(Const.SLASH, Integer.MAX_VALUE - 1); + String[] requestUriSegments = requestUri.split(Const.SLASH, Integer.MAX_VALUE - 1); if(pathInfoSegments.length == requestUriSegments.length) { return requestUri; @@ -79,10 +79,6 @@ public class ProxyServlet extends HttpServlet { for(int i=(requestUriSegments.length - pathInfoSegments.length + 1);i<requestUriSegments.length;i++) { aliasBuilder.append(Const.SLASH).append(requestUriSegments[i]); } - // if the original request ends in '/' then be sure to append a '/' - if (requestUri.endsWith(Const.SLASH)) { - aliasBuilder.append(Const.SLASH); - } return aliasBuilder.toString(); } |