16561: Handle implicit port number in ws:// and wss:// urls.
[arvados.git] / lib / service / cmd.go
index 9e45e0f7e828a340d5eee6d024eb9f8da21cf948..04c3e170ec6e093bac2e701e51e06894aa42009c 100644 (file)
@@ -279,7 +279,11 @@ func getListenAddr(svcs arvados.Services, prog arvados.ServiceName, log logrus.F
                        // explicit port name/number) means listen on
                        // the well-known port for the specified
                        // protocol, "foo.example:https".
                        // explicit port name/number) means listen on
                        // the well-known port for the specified
                        // protocol, "foo.example:https".
-                       listenAddr = net.JoinHostPort(listenAddr, listenURL.Scheme)
+                       port := listenURL.Scheme
+                       if port == "ws" || port == "wss" {
+                               port = "http" + port[2:]
+                       }
+                       listenAddr = net.JoinHostPort(listenAddr, port)
                }
                listener, err := net.Listen("tcp", listenAddr)
                if err == nil {
                }
                listener, err := net.Listen("tcp", listenAddr)
                if err == nil {