Bug 562843 - Invalid behavior in HttpServletRequest methods with respect to URI encoding
Summary: Invalid behavior in HttpServletRequest methods with respect to URI encoding
Status: VERIFIED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 4.8.0 Photon   Edit
Hardware: All All
: P3 blocker (vote)
Target Milestone: 4.16 M3   Edit
Assignee: Raymond Auge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-05 13:13 EDT by John Vasta CLA
Modified: 2020-12-02 13:33 EST (History)
4 users (show)

See Also:


Attachments
test servlet source project (4.22 KB, application/x-zip-compressed)
2020-05-05 13:13 EDT, John Vasta CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Vasta CLA 2020-05-05 13:13:38 EDT
Created attachment 282710 [details]
test servlet source project

Starting in the 4.8 release, two methods of HttpServletRequest stopped doing URL-decoding of their return values, in violation of the JEE Servlet specification. According to https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html, both getPathInfo() and getServletPath() should return URL-decoded values, but they don't (they did in the 4.7.3 release).

I am attaching a project archive for a simple servlet plug-in that illustrates the bad behavior. I deployed it in an embedded Equinox application according to https://www.eclipse.org/equinox/server/http_in_container.php (in an IBM WebSphere Liberty profile) as an application named "reqtest48". It registers a servlet at "/echo test". When invoked with a URL like

http://localhost:9080/reqtest48/echo%20test/foo%20bar

the getPathInfo() method returns "/foo%20bar" when it should be "/foo bar", and getServletPath() returns "/echo%20test" when it should be "/echo test".

This is a blocker for us. Our product puts user-defined names in URLs, which often have spaces or other URL-invalid characters (e.g. "My Project Area"). We are currently based on the 4.4.2 release and am starting to work on upgrading to a much more recent release. This bug will break URL resolution behavior in many areas. Without a fix, we will only be able to upgrade to 4.7.3.

I can also attach my test application WAR file that is ready to deploy in a JEE servlet container, if that is desired.

Note: I suspect this was caused by the changes for https://bugs.eclipse.org/bugs/show_bug.cgi?id=497510
Comment 1 John Vasta CLA 2020-05-05 13:19:46 EDT
By the way, I tried the 4.15 release as well, and it's still broken.
Comment 2 Eclipse Genie CLA 2020-05-05 15:09:55 EDT
New Gerrit change created: https://git.eclipse.org/r/162083
Comment 3 Thomas Watson CLA 2020-05-05 15:10:43 EDT
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/162083

This only adds a new testcase.  Need to figure out next steps to fixing this.
Comment 4 Eclipse Genie CLA 2020-05-05 16:36:49 EDT
New Gerrit change created: https://git.eclipse.org/r/162088
Comment 5 Eclipse Genie CLA 2020-05-05 17:33:04 EDT
New Gerrit change created: https://git.eclipse.org/r/162093
Comment 9 Thomas Watson CLA 2020-05-11 10:29:52 EDT
(In reply to Alexander Kurtakov from comment #8)
> This seems to have broken 2 of the ua tests:
> https://download.eclipse.org/eclipse/downloads/drops4/I20200509-1800/
> testresults/html/org.eclipse.ua.tests_ep416I-unit-cen64-gtk3-java11_linux.
> gtk.x86_64_11.html

Looking into this now.
Comment 10 Eclipse Genie CLA 2020-05-11 11:36:07 EDT
New Gerrit change created: https://git.eclipse.org/r/162830
Comment 11 Eclipse Genie CLA 2020-05-11 11:53:21 EDT
New Gerrit change created: https://git.eclipse.org/r/162833
Comment 12 Eclipse Genie CLA 2020-05-11 12:37:12 EDT
New Gerrit change created: https://git.eclipse.org/r/162835
Comment 15 Thomas Watson CLA 2020-05-11 13:13:38 EDT
(In reply to Alexander Kurtakov from comment #8)
> This seems to have broken 2 of the ua tests:
> https://download.eclipse.org/eclipse/downloads/drops4/I20200509-1800/
> testresults/html/org.eclipse.ua.tests_ep416I-unit-cen64-gtk3-java11_linux.
> gtk.x86_64_11.html

There are two issues here.

1) At one point in bug 535106 UA removed the code that handled a servletPath that needed to be encoded when making a request.  This was really covering up a bug that got introduced in Equinox where the servletPath was remaining unencoded.  The fix in bug 535106 needs to therefore be reverted (but not the tests, they should remain).  But the tests do have an issue in that they expect the response to have uncoded servletPath elements in them but this info is coming from the getServletPath() method which must not be encoded.  This fix is in the gerrit: https://git.eclipse.org/r/#/c/162833/

2) Equinox has a separate issue where it is attempting to double decode the servlet path.  This is now fixed and tested with gerrits: https://git.eclipse.org/r/162830 and https://git.eclipse.org/r/162835
Comment 17 Thomas Watson CLA 2020-05-11 16:38:43 EDT
This should be fixed now.  Will verify with tonight's build.
Comment 18 Thomas Watson CLA 2020-05-12 08:45:50 EDT
Verified in I20200511-1800
Comment 19 Eclipse Genie CLA 2020-09-01 11:46:50 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/168595
Comment 20 Eclipse Genie CLA 2020-09-01 11:46:52 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/168596
Comment 21 Eclipse Genie CLA 2020-09-01 11:46:55 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/168597
Comment 22 Eclipse Genie CLA 2020-09-01 12:08:09 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ua/+/168599
Comment 27 Eclipse Genie CLA 2020-10-26 13:39:16 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/171308
Comment 28 Eclipse Genie CLA 2020-10-26 13:39:29 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/171312
Comment 29 Eclipse Genie CLA 2020-10-26 13:39:31 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/171313
Comment 30 Eclipse Genie CLA 2020-10-26 14:53:07 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ua/+/171317