RESOLVED FIXED 214218
Improve IPv6 detection when setting host/hostname
https://bugs.webkit.org/show_bug.cgi?id=214218
Summary Improve IPv6 detection when setting host/hostname
Rob Buis
Reported 2020-07-11 02:43:26 PDT
Improve IPv6 detection when setting host/hostname by checking for '[' and ']' as well as using reverse find for ':' separators, to ensure we are not finding a separator within the IPv6 section of the url.
Attachments
Patch (8.93 KB, patch)
2020-07-11 02:48 PDT, Rob Buis
no flags
Patch (9.26 KB, patch)
2020-07-11 08:50 PDT, Rob Buis
no flags
Patch (9.33 KB, patch)
2020-07-12 02:57 PDT, Rob Buis
no flags
Patch (9.33 KB, patch)
2020-07-12 04:54 PDT, Rob Buis
no flags
Patch (9.35 KB, patch)
2020-07-12 10:53 PDT, Rob Buis
no flags
Rob Buis
Comment 1 2020-07-11 02:48:57 PDT
Rob Buis
Comment 2 2020-07-11 08:50:47 PDT
Darin Adler
Comment 3 2020-07-11 12:09:53 PDT
Comment on attachment 404054 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404054&action=review Looks good, but I am not sure it’s perfect. > Source/WTF/wtf/URL.cpp:464 > + if (hostName.find(':') != notFound && !hostName.startsWith('[')) find != notFound is the same thing as contains; contains is preferred. Unless you meant to say != colonIndex here? If you did, then do we have enough test coverage, because somehow we missed that error? > Source/WebCore/html/URLDecomposition.cpp:110 > + size_t ipv6separator = value.reverseFind(']'); ipv6separator should not be all lowercase. I think the "s" should be capitalized.
Rob Buis
Comment 4 2020-07-12 02:57:09 PDT
Rob Buis
Comment 5 2020-07-12 04:54:31 PDT
Rob Buis
Comment 6 2020-07-12 06:55:34 PDT
Comment on attachment 404054 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404054&action=review >> Source/WTF/wtf/URL.cpp:464 >> + if (hostName.find(':') != notFound && !hostName.startsWith('[')) > > find != notFound is the same thing as contains; contains is preferred. > > Unless you meant to say != colonIndex here? If you did, then do we have enough test coverage, because somehow we missed that error? Yeah, contains is better. But I do not want != colonIndex here, since the hostName has been adjusted to not include the ':' separator for the port in the line above. >> Source/WebCore/html/URLDecomposition.cpp:110 >> + size_t ipv6separator = value.reverseFind(']'); > > ipv6separator should not be all lowercase. I think the "s" should be capitalized. Done.
Rob Buis
Comment 7 2020-07-12 10:53:22 PDT
EWS
Comment 8 2020-07-12 11:47:35 PDT
Committed r264282: <https://trac.webkit.org/changeset/264282> All reviewed patches have been landed. Closing bug and clearing flags on attachment 404105 [details].
Radar WebKit Bug Importer
Comment 9 2020-07-12 11:48:12 PDT
Note You need to log in before you can comment on or make changes to this bug.