gerrit/gerrit-httpd
Luca Milanesio 8301cd8c98 Fix canonical URL detection with URL encoded parts
getServletPath() returns a URL-decoded path while getRequestURL()
just returns the string as-is, creating an incorrect canonical URL
detection because of different URL parts lengths of encoded vs. decoded.

That problem arises when gerrit.canonicalWebUrl is empty and the
canonical URL is obtained by checking the request URL minus the Servlet
request Path.

Apply the URL decoding before trimming the request URL by the Servlet
path length, so that canonical URL can be reliable even when the request
URL contains URL-encoded fragments.

Example: the new UI login link includes the following URL-encoded
search URL (/q/status:open) which was causing an incorrect canonical
URL detection and consequently the inability to log in from PolyGerrit.

Bug: Issue 7036
Change-Id: Ibaadeb8b9a377dc1427d33d339a50a58e79012cf
2017-08-16 12:50:52 +00:00
..
src Fix canonical URL detection with URL encoded parts 2017-08-16 12:50:52 +00:00
BUILD Serve PolyGerrit index.html from a Soy template 2017-04-03 18:12:54 +00:00