FailedChanges

Summary

  1. [SPARK-32467][UI] Avoid encoding URL twice on https redirect (commit: 71aea02e9ffb0c6f7c72c91054c2a4653e22e801) (details)
Commit 71aea02e9ffb0c6f7c72c91054c2a4653e22e801 by gengliang.wang
[SPARK-32467][UI] Avoid encoding URL twice on https redirect
### What changes were proposed in this pull request?
When https is enabled for Spark UI, an HTTP request will be redirected
as an encoded HTTPS URL:
https://github.com/apache/spark/pull/10238/files#diff-f79a5ead735b3d0b34b6b94486918e1cR312
When we create the redirect url, we will call getRequestURI and
getQueryString. Both two methods may return an encoded string. However,
we pass them directly to the following URI constructor
``` URI(String scheme, String authority, String path, String query,
String fragment)
``` As this URI constructor assumes both path and query parameters are
decoded strings, it will encode them again. This makes the redirect URL
encoded twice.
This problem is on stage page with HTTPS enabled. The URL of
"/taskTable" contains query parameter `order%5B0%5D%5Bcolumn%5D`. After
encoded it becomes  `order%255B0%255D%255Bcolumn%255D` and it will be
decoded as `order%5B0%5D%5Bcolumn%5D` instead of `order[0][dir]`.  When
the parameter `order[0][dir]` is missing, there will be an excetpion
from:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/status/api/v1/StagesResource.scala#L176
and the stage page fail to load.
To fix the problem, we can try decoding the query parameters before
encoding it. This is to make sure we encode the URL
### Why are the changes needed?
Fix a UI issue when HTTPS is enabled
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
A new Unit test + manually test on a cluster
Closes #29271 from gengliangwang/urlEncode.
Authored-by: Gengliang Wang <gengliang.wang@databricks.com>
Signed-off-by: Gengliang Wang <gengliang.wang@databricks.com>
(commit: 71aea02e9ffb0c6f7c72c91054c2a4653e22e801)
The file was modifiedcore/src/test/scala/org/apache/spark/ui/UISuite.scala (diff)
The file was modifiedcore/src/main/scala/org/apache/spark/ui/JettyUtils.scala (diff)