diff --git a/lib/location.js b/lib/location.js index 79a9a9f6..be64fe81 100644 --- a/lib/location.js +++ b/lib/location.js @@ -2,7 +2,7 @@ module.exports = global.location || { origin: 'http://localhost:80' -, protocol: 'http' +, protocol: 'http:' , host: 'localhost' , port: 80 , href: 'http://localhost/' diff --git a/lib/main.js b/lib/main.js index 8a526084..01bb894c 100644 --- a/lib/main.js +++ b/lib/main.js @@ -75,7 +75,7 @@ function SockJS(url, protocols, options) { var secure = parsedUrl.protocol === 'https:'; // Step 2 - don't allow secure origin with an insecure protocol - if (loc.protocol === 'https' && !secure) { + if (loc.protocol === 'https:' && !secure) { throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS'); } diff --git a/tests/lib/main-node.js b/tests/lib/main-node.js index f2695307..87456be6 100644 --- a/tests/lib/main-node.js +++ b/tests/lib/main-node.js @@ -9,7 +9,7 @@ describe('SockJS', function() { describe('WebSocket specification step #2', function () { var main = proxyquire('../../lib/main', { './location': { - protocol: 'https' + protocol: 'https:' }}); var sjs = proxyquire('../../lib/entry', { './main': main });