Resolve RFC 6761 localhost names to loopback

Per section 6.3, HostResolverImpl should recognize localhost names as
special and resolve as loopback without sending the query over the
network.

This CL also modifies IsLocalhost() to allow trailing dots (bug 460331),
so that IsLocalhost() can be used to detect localhost names that should
resolve to loopback.

BUG=496479,460331

Review URL: https://codereview.chromium.org/1177933002

Cr-Commit-Position: refs/heads/master@{#335402}
7 files changed