Skip to content

Commit

Permalink
Fully decode #9444
Browse files Browse the repository at this point in the history
WIP
  • Loading branch information
gregw committed Mar 8, 2023
1 parent dc918db commit 9fc64a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
String encodedPathInContext;
if (included)
encodedPathInContext = URIUtil.encodePath(getIncludedPathInContext(req, includedServletPath, isPathInfoOnly()));
else if (isPathInfoOnly())
encodedPathInContext = URIUtil.encodePath(req.getPathInfo());
else if (req instanceof ServletApiRequest apiRequest)
encodedPathInContext = Context.getPathInContext(req.getContextPath(), apiRequest.getServletContextRequest().getHttpURI().getCanonicalPath());
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public void init() throws Exception

connector = new LocalConnector(server);
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setUriCompliance(UriCompliance.UNSAFE);
Path extraJarResources = MavenPaths.findTestResourceFile(ODD_JAR);
URL[] urls = new URL[]{extraJarResources.toUri().toURL()};

Expand Down Expand Up @@ -209,6 +208,8 @@ public void testGetBinaryWithUtfResponseEncoding() throws Exception
@Test
public void testGetPercent2F() throws Exception
{
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setUriCompliance(UriCompliance.UNSAFE);

Path file = docRoot.resolve("file.txt");
Files.writeString(file, "How now brown cow", UTF_8);

Expand Down Expand Up @@ -658,7 +659,7 @@ public static Stream<Arguments> contextBreakoutScenarios()
Connection: close\r
\r
""".replace("@PREFIX@", prefix),
HttpStatus.NOT_FOUND_404,
prefix.endsWith("?") ? HttpStatus.NOT_FOUND_404 : HttpStatus.BAD_REQUEST_400,
(response) -> assertThat(response.getContent(), not(containsString("Sssh")))
);

Expand Down

0 comments on commit 9fc64a7

Please sign in to comment.