url: add ws: and wss: to slashedProtocol set
Fix cases where the pathname is incorrectly parsed as `null`. PR-URL: https://github.com/nodejs/node/pull/26941 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
7a547098d5
commit
6a34b85b05
@ -95,7 +95,11 @@ const slashedProtocol = new SafeSet([
|
|||||||
'gopher',
|
'gopher',
|
||||||
'gopher:',
|
'gopher:',
|
||||||
'file',
|
'file',
|
||||||
'file:'
|
'file:',
|
||||||
|
'ws',
|
||||||
|
'ws:',
|
||||||
|
'wss',
|
||||||
|
'wss:'
|
||||||
]);
|
]);
|
||||||
const {
|
const {
|
||||||
CHAR_SPACE,
|
CHAR_SPACE,
|
||||||
|
@ -923,6 +923,26 @@ const parseTests = {
|
|||||||
pathname: "alert(1);a='@white-listed.com'",
|
pathname: "alert(1);a='@white-listed.com'",
|
||||||
path: "alert(1);a='@white-listed.com'",
|
path: "alert(1);a='@white-listed.com'",
|
||||||
href: "javascript: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/'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user