Github user sarutak commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16582#discussion_r97018717
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -306,23 +311,31 @@ private[spark] object JettyUtils extends Logging {
           httpConnector.setPort(currentPort)
           connectors += httpConnector
     
    -      sslOptions.createJettySslContextFactory().foreach { factory =>
    -        // If the new port wraps around, do not try a privileged port.
    -        val securePort =
    -          if (currentPort != 0) {
    -            (currentPort + 400 - 1024) % (65536 - 1024) + 1024
    -          } else {
    -            0
    -          }
    -        val scheme = "https"
    -        // Create a connector on port securePort to listen for HTTPS 
requests
    -        val connector = new ServerConnector(server, factory)
    -        connector.setPort(securePort)
    -
    -        connectors += connector
    -
    -        // redirect the HTTP requests to HTTPS port
    -        collection.addHandler(createRedirectHttpsHandler(securePort, 
scheme))
    +      val httpsConnector = sslOptions.createJettySslContextFactory() match 
{
    +        case Some(factory) =>
    +          // If the new port wraps around, do not try a privileged port.
    +          val securePort =
    +            if (currentPort != 0) {
    +              (currentPort + 400 - 1024) % (65536 - 1024) + 1024
    +            } else {
    +              0
    +            }
    +          val scheme = "https"
    +          // Create a connector on port securePort to listen for HTTPS 
requests
    +          val connector = new ServerConnector(server, factory)
    +          connector.setPort(securePort)
    +          connector.setName(SPARK_CONNECTOR_NAME)
    +          connectors += connector
    +
    +          // redirect the HTTP requests to HTTPS port
    +          httpConnector.setName(REDIRECT_CONNECTOR_NAME)
    +          collection.addHandler(createRedirectHttpsHandler(securePort, 
scheme))
    --- End diff --
    
    I noticed one point.
    If a port is already used, `collection.addHandler` will take place more 
than twice leading redirection doesn't work properly.
    Of course, it's not your fault. If you fix it in this PR together, it's 
good but it's a separate issue so I'll fix in another PR otherwise.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to