Skip to content

Commit

Permalink
Merge pull request #396 from SenYu/fix/http_in_https
Browse files Browse the repository at this point in the history
(Fix/http in https) location.protocol should include final ":"
  • Loading branch information
brycekahle authored Dec 6, 2017
2 parents 4d18fd5 + 9567393 commit 436e997
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = global.location || {
origin: 'http://localhost:80'
, protocol: 'http'
, protocol: 'http:'
, host: 'localhost'
, port: 80
, href: 'http://localhost/'
Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/main-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down

0 comments on commit 436e997

Please sign in to comment.