• Eric Orth's avatar
    Differentiate malformed DNS names and empty (root) name · ad67ec1e
    Eric Orth authored
    Change the return type of DNSDomainToString() to
    base::Optional<std::string>, so it can return nullopt on malformed and
    empty string on root.  This is needed because HTTPS records can have
    root names in some cases, so we need to be able to differentiate that
    from actual malformed names.
    
    While messing with the method interface, also fixed the camelcasing in
    the method name, and changed the type to StringPiece value instead of
    the unnecessary const&.
    
    A subsequent CL will have more substantive fixes to make
    DnsDomainToString() stricter to the standards validations we need, but
    I wanted to get the mostly-mechanical stuff out of the way first in a
    separate CL.
    
    Bug: 1138620
    Change-Id: I23d092051fe48826972a5fb5b3279dedf473ee1c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495296
    Commit-Queue: Eric Orth <ericorth@chromium.org>
    Reviewed-by: default avatarDan McArdle <dmcardle@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#820454}
    ad67ec1e
dns_query.cc 9.25 KB