Extracting port+ssl from passed hostname
authorDarren <darren@darrenwhitlen.com>
Thu, 11 Oct 2012 10:25:43 +0000 (11:25 +0100)
committerDarren <darren@darrenwhitlen.com>
Thu, 11 Oct 2012 10:25:43 +0000 (11:25 +0100)
client/dev/model_application.js

index 1f4e0e56e2d681074b08c2eb6e31e54ffdcbadac..8bf024675ab55023abdad4c948753b6c8473d80a 100644 (file)
@@ -138,8 +138,21 @@ kiwi.model.Application = function () {
                 parts.shift();\r
 \r
                 if (parts.length > 0 && parts[0]) {\r
-                    // TODO: Extract the port from this hostname\r
-                    defaults.server = parts[0];\r
+                    // Extract the port+ssl if we find one\r
+                    if (parts[0].search(/:/) > 0) {\r
+                        defaults.port = parts[0].substring(parts[0].search(/:/) + 1);\r
+                        defaults.server = parts[0].substring(0, parts[0].search(/:/));\r
+                        if (defaults.port[0] === '+') {\r
+                            defaults.port = parseInt(defaults.port.substring(1), 10);\r
+                            defaults.ssl = true;\r
+                        } else {\r
+                            defaults.ssl = false;\r
+                        }\r
+\r
+                    } else {\r
+                        defaults.server = parts[0];\r
+                    }\r
+\r
                     parts.shift();\r
                 }\r
 \r