Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/src/main/scala/org/apache/spark/ui/WebUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val protocol = if (conf.getBoolean("spark.ssl.enabled", false)) "https" else "http"

There is actually spark.ssl.ui.enabled too, to specifically control the UI. I suppose really you need to check whether sslOptions.enabled is true.

if(conf.get("spark.ssl.enabled") == "true") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its cleaner to use a getOrElse("false") here instead of an == true
Also scalastyle will fail without a space after the if

protocol = "https"
}
s"$protocol://$publicHostName:$boundPort"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: don't indent this line further

}

/** Return the actual port to which this server is bound. Only valid after bind(). */
def boundPort: Int = serverInfo.map(_.boundPort).getOrElse(-1)
Expand Down