Skip to content
  • brettw's avatar
    Reduce buggy usage of the registry controlled domain service. · 5a36380e
    brettw authored
    GetRegistryLength for host names canonicalizes the input for the caller, but
    then returns the length in the canonicalized input, which is not necessarily
    the same as the length in the original string. As a result, computations
    performed by the caller based on this value can be wrong (see the bug for
    more).
    
    All callers of this function were audited and changed to use on of the
    following:
    
    - Many callers don't need the offsets. A new function
      HostHasRegistryControlledDomain is added to check for the presence of
      a R.C.D. without the risk of returning incorrect string lengths.
    
    - Many callers already have guaranteed-canonical strings (they came out of
      a GURL or KURL object soon before the call) These were changed to use a
      new GetCanonicalHostRegistryLength function. A further advantage is that
      these calls will be faster.
    
    - A new Permissive function is added that handles cases where the input
      is necessarily non-canonical.
    
    Adds an IDN test case to the unit tests.
    
    Removes checking for IP addresses in the already-known-canonical cases.
    This requires a separate full canonicalization and IP addresses should
    never match the R.C.D. list.
    
    Reland of https://codereview.chromium.org/2451353002/ with fix which was a
    reland of https://codereview.chromium.org/2446273004/ with fix which was a
    reland of https://codereview.chromium.org/2433583002/ with fix.
    
    TBR=pkasting@chromium.org
    BUG=657199
    
    Review-Url: https://codereview.chromium.org/2456643005
    Cr-Commit-Position: refs/heads/master@{#428116}
    5a36380e