Skip to content

Commit

Permalink
fix AsyncPageTransportServlet issues
Browse files Browse the repository at this point in the history
  • Loading branch information
auden-woolfson committed Nov 19, 2024
1 parent 150c7eb commit d6b4b9e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ protected void parseURI(String requestURI, HttpServletRequest request, HttpServl
OutputBufferId bufferId = null;
long token = 0;

String sanitizedRequestURI = requestURI.replaceAll("[\\r\\n]", "");

int previousIndex = -1;
for (int part = 0; part < 8; part++) {
int nextIndex = requestURI.indexOf('/', previousIndex + 1);

if (nextIndex == -1 && part != 7 || nextIndex != -1 && part == 7) {
reportFailure(response, format("Unexpected URI for task result request in async mode: %s", requestURI));
reportFailure(response, format("Unexpected URI for task result request in async mode: %s", sanitizedRequestURI));
return;
}

Expand All @@ -152,7 +154,7 @@ protected void parseURI(String requestURI, HttpServletRequest request, HttpServl
previousIndex = nextIndex;
}
// This is sent forward instead of returned to avoid allocations
processRequest(requestURI, taskId, bufferId, token, request, response);
processRequest(sanitizedRequestURI, taskId, bufferId, token, request, response);
}

protected void processRequest(
Expand Down

0 comments on commit d6b4b9e

Please sign in to comment.