Created attachment 35061 [details] Encoded space test case After update to tomcat 8.0.44, there are some behaviour differences in URL Rewrite. URL encoded space (+) gets re-encoded as %2B after rewrite and param value gets modified to + instead of space. From the changelog, seems like below change related to encoding seems to be the cause. "Review those places where Tomcat re-encodes a URI or URI component and ensure that that correct encoding (path differs from query string) is applied and that the encoding is applied consistently." Attached test case which passes in 8.0.43 but fails in 8.0.44
Thanks for the test case. It makes it much, much easier to work with a bug report that includes a test case. This particular report is invalid. The test set-up does this: String url = "/a/" + URLEncoder.encode("Test Query", "UTF-8"); This results in a value for url of "/a/Test+query". And there lies the problem. It is only valid to encode a ' ' with '+' in a query string so in this test case the '+' gets treated as a literal '+' and is correctly encoded to %2B. If the test is modified so url is correctly encoded: String url = "/a/Test%20Query"; the test passes as expected.
(In reply to Mark Thomas from comment #1) > Thanks for the test case. It makes it much, much easier to work with a bug > report that includes a test case. > > This particular report is invalid. > > The test set-up does this: > String url = "/a/" + URLEncoder.encode("Test Query", "UTF-8"); > > This results in a value for url of "/a/Test+query". And there lies the > problem. It is only valid to encode a ' ' with '+' in a query string so in > this test case the '+' gets treated as a literal '+' and is correctly > encoded to %2B. > > If the test is modified so url is correctly encoded: > String url = "/a/Test%20Query"; > > the test passes as expected. Thanks for the clarification.