Repository: spark
Updated Branches:
  refs/heads/branch-2.0 7c8d9a557 -> 912487eaf


[SPARK-16988][SPARK SHELL] spark history server log needs to be fixed to show 
https url when ssl is enabled

spark history server log needs to be fixed to show https url when ssl is enabled

Author: chie8842 <[email protected]>

Closes #15611 from hayashidac/SPARK-16988.

(cherry picked from commit c329a568b58d65c492a43926bf0f588f2ae6a66e)
Signed-off-by: Kousuke Saruta <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/912487ea
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/912487ea
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/912487ea

Branch: refs/heads/branch-2.0
Commit: 912487eaf84a82731033d17035f401acd5577994
Parents: 7c8d9a5
Author: hayashidac <[email protected]>
Authored: Wed Oct 26 07:13:48 2016 +0900
Committer: Kousuke Saruta <[email protected]>
Committed: Wed Oct 26 07:14:14 2016 +0900

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/ui/WebUI.scala       |  5 ++++-
 .../src/test/scala/org/apache/spark/SSLOptionsSuite.scala | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/912487ea/core/src/main/scala/org/apache/spark/ui/WebUI.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/ui/WebUI.scala 
b/core/src/main/scala/org/apache/spark/ui/WebUI.scala
index 2c40e72..adc4a4f 100644
--- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala
+++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala
@@ -146,7 +146,10 @@ private[spark] abstract class WebUI(
   }
 
   /** Return the url of web interface. Only valid after bind(). */
-  def webUrl: String = s"http://$publicHostName:$boundPort";
+  def webUrl: String = {
+    val protocol = if (sslOptions.enabled) "https" else "http"
+    s"$protocol://$publicHostName:$boundPort"
+  }
 
   /** Return the actual port to which this server is bound. Only valid after 
bind(). */
   def boundPort: Int = serverInfo.map(_.boundPort).getOrElse(-1)

http://git-wip-us.apache.org/repos/asf/spark/blob/912487ea/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala 
b/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala
index 159b448..2b8b180 100644
--- a/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala
@@ -79,7 +79,7 @@ class SSLOptionsSuite extends SparkFunSuite with 
BeforeAndAfterAll {
     conf.set("spark.ssl.protocol", "SSLv3")
 
     val defaultOpts = SSLOptions.parse(conf, "spark.ssl", defaults = None)
-    val opts = SSLOptions.parse(conf, "spark.ui.ssl", defaults = 
Some(defaultOpts))
+    val opts = SSLOptions.parse(conf, "spark.ssl.ui", defaults = 
Some(defaultOpts))
 
     assert(opts.enabled === true)
     assert(opts.trustStore.isDefined === true)
@@ -102,20 +102,20 @@ class SSLOptionsSuite extends SparkFunSuite with 
BeforeAndAfterAll {
 
     val conf = new SparkConf
     conf.set("spark.ssl.enabled", "true")
-    conf.set("spark.ui.ssl.enabled", "false")
+    conf.set("spark.ssl.ui.enabled", "false")
     conf.set("spark.ssl.keyStore", keyStorePath)
     conf.set("spark.ssl.keyStorePassword", "password")
-    conf.set("spark.ui.ssl.keyStorePassword", "12345")
+    conf.set("spark.ssl.ui.keyStorePassword", "12345")
     conf.set("spark.ssl.keyPassword", "password")
     conf.set("spark.ssl.trustStore", trustStorePath)
     conf.set("spark.ssl.trustStorePassword", "password")
     conf.set("spark.ssl.enabledAlgorithms",
       "TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA")
-    conf.set("spark.ui.ssl.enabledAlgorithms", "ABC, DEF")
+    conf.set("spark.ssl.ui.enabledAlgorithms", "ABC, DEF")
     conf.set("spark.ssl.protocol", "SSLv3")
 
     val defaultOpts = SSLOptions.parse(conf, "spark.ssl", defaults = None)
-    val opts = SSLOptions.parse(conf, "spark.ui.ssl", defaults = 
Some(defaultOpts))
+    val opts = SSLOptions.parse(conf, "spark.ssl.ui", defaults = 
Some(defaultOpts))
 
     assert(opts.enabled === false)
     assert(opts.trustStore.isDefined === true)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to