diff options
Diffstat (limited to 'lib/url.js')
-rw-r--r-- | lib/url.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/url.js b/lib/url.js index 56b1be9328..2231ea0ca7 100644 --- a/lib/url.js +++ b/lib/url.js @@ -72,8 +72,9 @@ var protocolPattern = /^([a-z0-9.+-]+:)/i, nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), hostEndingChars = ['/', '?', '#'], hostnameMaxLen = 255, - hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/, + hostnamePatternString = '[^' + nonHostChars.join('') + ']{0,63}', + hostnamePartPattern = new RegExp('^' + hostnamePatternString + '$'), + hostnamePartStart = new RegExp('^(' + hostnamePatternString + ')(.*)$'), // protocols that can allow "unsafe" and "unwise" chars. unsafeProtocol = { 'javascript': true, |