-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url: make urlToOptions() handle IPv6 literals #19720
Conversation
Strip the enclosing square brackets from the parsed hostname.
@@ -1312,7 +1312,9 @@ function domainToUnicode(domain) { | |||
function urlToOptions(url) { | |||
var options = { | |||
protocol: url.protocol, | |||
hostname: url.hostname, | |||
hostname: url.hostname.startsWith('[') ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: from a performance standpoint it would be better to use charCodeAt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be consistent with
Line 239 in 3650972
if (hostHeader.startsWith('[')) { |
Both can be changed in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this is a performance-relevant function anyway. The actual HTTP roundtrip will take much longer.
Landed in fa2d43b. |
Strip the enclosing square brackets from the parsed hostname. PR-URL: #19720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Strip the enclosing square brackets from the parsed hostname. PR-URL: #19720 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Strip the enclosing square brackets from the parsed hostname.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes