diff options
-rw-r--r-- | lib/url.js | 6 | ||||
-rw-r--r-- | test/parallel/test-url-parse-format.js | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/url.js b/lib/url.js index edc55c87aa..fba5558edb 100644 --- a/lib/url.js +++ b/lib/url.js @@ -95,7 +95,11 @@ const slashedProtocol = new SafeSet([ 'gopher', 'gopher:', 'file', - 'file:' + 'file:', + 'ws', + 'ws:', + 'wss', + 'wss:' ]); const { CHAR_SPACE, diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index d802b0f6dc..43c459d936 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -923,6 +923,26 @@ const parseTests = { pathname: "alert(1);a='@white-listed.com'", path: "alert(1);a='@white-listed.com'", href: "javascript:alert(1);a='@white-listed.com'" + }, + + 'ws://www.example.com': { + protocol: 'ws:', + slashes: true, + hostname: 'www.example.com', + host: 'www.example.com', + pathname: '/', + path: '/', + href: 'ws://www.example.com/' + }, + + 'wss://www.example.com': { + protocol: 'wss:', + slashes: true, + hostname: 'www.example.com', + host: 'www.example.com', + pathname: '/', + path: '/', + href: 'wss://www.example.com/' } }; |