Skip to content

Commit 436e997

Browse files
authored
Merge pull request #396 from SenYu/fix/http_in_https
(Fix/http in https) location.protocol should include final ":"
2 parents 4d18fd5 + 9567393 commit 436e997

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/location.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = global.location || {
44
origin: 'http://localhost:80'
5-
, protocol: 'http'
5+
, protocol: 'http:'
66
, host: 'localhost'
77
, port: 80
88
, href: 'http://localhost/'

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function SockJS(url, protocols, options) {
7575

7676
var secure = parsedUrl.protocol === 'https:';
7777
// Step 2 - don't allow secure origin with an insecure protocol
78-
if (loc.protocol === 'https' && !secure) {
78+
if (loc.protocol === 'https:' && !secure) {
7979
throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS');
8080
}
8181

tests/lib/main-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('SockJS', function() {
99

1010
describe('WebSocket specification step #2', function () {
1111
var main = proxyquire('../../lib/main', { './location': {
12-
protocol: 'https'
12+
protocol: 'https:'
1313
}});
1414
var sjs = proxyquire('../../lib/entry', { './main': main });
1515

0 commit comments

Comments
 (0)