From 047151e79a48cab08c8b96a3409e4a32a7df9682 Mon Sep 17 00:00:00 2001 From: chie8842 Date: Tue, 25 Oct 2016 00:52:45 +0900 Subject: [PATCH 1/4] fixed weburl outputted by historyserver log --- core/src/main/scala/org/apache/spark/ui/WebUI.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 4118fcf46b42..03a2e721a5a0 100644 --- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala @@ -147,7 +147,13 @@ 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 = { + var protocol = "http" + if(conf.get("spark.ssl.enabled") == "true") { + protocol = "https" + } + 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) From 5d929181989a05db1576db282af3d8569f5425b6 Mon Sep 17 00:00:00 2001 From: chie8842 Date: Tue, 25 Oct 2016 17:51:17 +0900 Subject: [PATCH 2/4] fixed weburl outputted by historyserver log --- core/src/main/scala/org/apache/spark/ui/WebUI.scala | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 03a2e721a5a0..4a15092b0fbf 100644 --- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala @@ -148,10 +148,7 @@ private[spark] abstract class WebUI( /** Return the url of web interface. Only valid after bind(). */ def webUrl: String = { - var protocol = "http" - if(conf.get("spark.ssl.enabled") == "true") { - protocol = "https" - } + val protocol = if (sslOptions.enabled) "https" else "http" s"$protocol://$publicHostName:$boundPort" } From 6f26e3057988767262030d962d287454de7c5783 Mon Sep 17 00:00:00 2001 From: chie8842 Date: Tue, 25 Oct 2016 18:21:09 +0900 Subject: [PATCH 3/4] fixed weburl outputted by historyserver log --- core/src/main/scala/org/apache/spark/ui/WebUI.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4a15092b0fbf..a05e0efb7a3e 100644 --- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala @@ -149,7 +149,7 @@ private[spark] abstract class WebUI( /** Return the url of web interface. Only valid after bind(). */ def webUrl: String = { val protocol = if (sslOptions.enabled) "https" else "http" - s"$protocol://$publicHostName:$boundPort" + s"$protocol://$publicHostName:$boundPort" } /** Return the actual port to which this server is bound. Only valid after bind(). */ From af7351824491bafde8d480a4ae2fe5004d4c85f4 Mon Sep 17 00:00:00 2001 From: chie8842 Date: Tue, 25 Oct 2016 19:53:31 +0900 Subject: [PATCH 4/4] fixed spark.ui.ssl to spark.ssl.ui --- .../test/scala/org/apache/spark/SSLOptionsSuite.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala b/core/src/test/scala/org/apache/spark/SSLOptionsSuite.scala index 159b448e05b0..2b8b1805bc83 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)