Make HostPortPair::FromString reject strings with invalid ports.
commit9f3e33daaac0f6c0835dd69ef57c89cb89e706f8
authormmenke <mmenke@chromium.org>
Mon, 17 Nov 2014 21:43:39 +0000 (17 13:43 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 17 Nov 2014 21:43:55 +0000 (17 21:43 +0000)
tree920df4a9a850f52dbf8f88ed4c637ab23d7d1a5a
parent1a3c6a75b272bc9fbee3e2f314a2bf5fd6a11f99
Make HostPortPair::FromString reject strings with invalid ports.

Previously, HostPortPair would reject (Return an empty HostPortPair)
strings that didn't contain <host>:int, but then just DCHECKed int
wasn't too large to be a valid port.

This is a little weird - in general, methods should either require
input be valid, or be robust enough to handle invalid input.  Since
this method is now also run on command line input, it seems like
handling bad ports makes the most sense, so this CL makes it return
empty HostPortPairs in that case.

BUG=433895

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

Cr-Commit-Position: refs/heads/master@{#304485}
net/base/host_port_pair.cc
net/base/host_port_pair_unittest.cc
net/base/net_util.cc
net/base/net_util.h