Skip to content

Commit

Permalink
ipv6 urls must have brackeets
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Aug 2, 2020
1 parent 110788c commit 5174c33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/utils/url.js
Expand Up @@ -46,6 +46,6 @@ module.exports = {
}

, isLoopbackAddr: function (addr) {
return /^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || /^::1$/.test(addr);
return /^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || /^\[::1\]$/.test(addr);
}
};
2 changes: 1 addition & 1 deletion tests/lib/main-node.js
Expand Up @@ -31,7 +31,7 @@ describe('SockJS', function() {

it('should NOT throw SecurityError for ::1 url from a secure page', function () {
expect(function () {
sjs('http://::1');
sjs('http://[::1]');
}).to.not.throwException();
});

Expand Down

0 comments on commit 5174c33

Please sign in to comment.