-
Notifications
You must be signed in to change notification settings - Fork 7.3k
url: % is a valid host character in IPv6 addresses #9411
Conversation
non-host chars are different for IPv6 addresses vs other hostnames detect the presence of an IPv6 address hostname before doing the non-host char check and select the non-host char set accordingly
% is a valid character in IPv6 link-local addresses. Test to make sure that these types of addresses are parsed correctly.
Adding to milestone 0.12.2 for the same reason its corresponding issue has been added to 0.12.2 too. |
Isn't |
Do any browsers support this? EDIT: I mean do any browsers properly support parsing this. e.g. var a = a.document.createElement('a');
a.href = 'http://[fe80::1%25lo0]:51877';
console.log(a.host); // output: ":0" |
Curl, at least, does.
|
Node.js allows the % character as well (just use a This is just an issue with |
Corresponding issues in Chromium's issues tracker and in Firefox's issue tracker. It seems that both of them are seriously considering implementing RFC 6874, but it hasn't been done yet. Removing from the 0.12.4 milestone as currently it's not supported by most major browsers, and thus doesn't seem to be a pressing issue. It seems it would make sense to have Node.js conform to that RFC though. |
I must say that it's a little frustrating having feature support (or bug fixes) for a server side language dictated by browser support. Currently, it's impossible to bind a server or connect a client to a link local address on the same machine when using any npm module that sanitizes it's URL's via Take This would sit much better with me if my tiny changes were breaking tests or something else rather than this change not being implemented (or deemed important) because browsers don't support this yet. Last I checked, node.js was a server side language and this issue essentially removes npm as a resource for a project I'm working on.
Just wanted to get my thoughts/feelings out there. Just frustrated as this issue is a big issue for me. |
If the 0.12.4 release is pressing then let's at least get the fix in for the 0.12.5 release. |
@cthayer @trevnorris v0.12.4 is not pressing, as we're currently working on v0.12.3. I don't have anything against adding this PR back to the 0.12.4 milestone if the impact of its changes are well understood. My understanding was that it was not the case. I also initially thought we had more issues still open in the 0.12.3 and 0.12.4 milestones and didn't want to add much more to it except for major issues that are well understood, but looking at them again it seems there's still some room for other issues. I apologize for the confusion. |
If this helps the parser more closely follow the spec, and it's only an additive change, then I don't see this merging this as an issue. @misterdjules You cool if this is added to the 0.12.4 milestone? |
@trevnorris Yes, I'm ok with adding it to the 0.12.4 milestone as long as we consider it's not an addition to the API, but a bug fix. In my opinion it is a bug fix. @trevnorris @cthayer As usual we still need to do a thorough review and after briefly looking at the code changes again I would already recommend adding more tests for invalid input, like an url with a valid IPv6 address, a |
@trevnorris @misterdjules Thanks for the additional input. I'm glad to see that this is being considered for the 0.12.4 release again. I'm happy to add more tests. I hadn't done actual validation of the hostname portion when a IPv6 zone-id is involved because it didn't appear that I'm all for making sure things are correct, so I'll add more tests and more logic for validating the zone-id. Also, since I'm validating the zone-id, is it cool if I add a parameter to the output called |
@cthayer Thank you for considering to add more tests! Just to make sure we're on the same page, I was not suggesting to validate IPv6 addresses if that's not already done for host names, just that a zone-id is provided after a I would suggest adding that additional Thank you! |
Add a test for IPv6 link local addresses that contain the '%' character, but are missing the zone id.
If the IPv6 hostname is a link local address that is missing the zone id (ends in '%]'), then remove the '%' character from the hostname
@misterdjules I've added a test (and supporting code) for a url with a valid IPv6 address, a My solution was to strip the I wasn't sure how much hostname validation you want to add, since there wasn't much there before, so I left it at that, but let me know if you'd like to be more thorough. |
% is a valid host character in IPv6 link-local addresses.
The % separates the address from the zone within the hostname section of the URL.
This fixes issue #9404