forcessl detect port fix + typo
authorDarren <darren@darrenwhitlen.com>
Sat, 1 Oct 2011 19:52:44 +0000 (20:52 +0100)
committerDarren <darren@darrenwhitlen.com>
Sat, 1 Oct 2011 19:52:44 +0000 (20:52 +0100)
node/kiwi_modules/forcessl.js

index 82e8cf223a2db869c3484cad550118cfabba13b3..fb9498344dd41429ee11a246f33d1933594a65d6 100644 (file)
@@ -15,13 +15,13 @@ exports.onhttp = function (ev) {
            host = ev.request.headers.host;
 
            // Remove the port if one is set
-           if (host.search(/:/)) {
+           if (host.search(/:/) > -1) {
                host = host.substring(0, host.search(/:/));
            }
 
        for (i in kiwi.config.ports) {
                if (kiwi.config.ports[i].secure) {
-                       port = kiwi.config.ports[0].number;
+                       port = kiwi.config.ports[i].number;
                        break;
                }
        }