Chromium Code Reviews| Index: net/proxy/proxy_bypass_rules.cc |
| diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc |
| index 64a23c90389e836edb5565f1a1b2c7a20be004cf..eafaa98cc0593a82608be9d6d49ff99f6d99261b 100644 |
| --- a/net/proxy/proxy_bypass_rules.cc |
| +++ b/net/proxy/proxy_bypass_rules.cc |
| @@ -6,13 +6,13 @@ |
| #include "base/stl_util.h" |
| #include "base/strings/pattern.h" |
| -#include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_piece.h" |
| #include "base/strings/string_tokenizer.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "net/base/host_port_pair.h" |
| #include "net/base/ip_address.h" |
| +#include "net/base/parse_number.h" |
| #include "net/base/url_util.h" |
| namespace net { |
| @@ -317,13 +317,11 @@ bool ProxyBypassRules::AddRuleFromStringInternal( |
| // Otherwise assume we have <hostname-pattern>[:port]. |
| std::string::size_type pos_colon = raw.rfind(':'); |
| - host = raw; |
|
eroman
2016/03/23 22:41:53
This removal is not strictly part of this change.
|
| port = -1; |
| if (pos_colon != std::string::npos) { |
| - if (!base::StringToInt(base::StringPiece(raw.begin() + pos_colon + 1, |
| - raw.end()), |
| - &port) || |
| - (port < 0 || port > 0xFFFF)) { |
| + if (!ParseNonNegativeDecimalInt( |
| + base::StringPiece(raw.begin() + pos_colon + 1, raw.end()), &port) || |
| + port > 0xFFFF) { |
| return false; // Port was invalid. |
| } |
| raw = raw.substr(0, pos_colon); |