Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1429)

Unified Diff: net/http/http_stream_factory.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory.cc
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index e3d35b74abe641227b91ef9c115939a14627e300..b2b0274fdcdfe43de80c3fd056794a0b7303bc94 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -38,9 +38,10 @@ void HttpStreamFactory::ProcessAlternateProtocol(
double probability = 1;
bool is_valid = true;
for (size_t i = 0; i < alternate_protocol_values.size(); ++i) {
- const std::string& alternate_protocol_str = alternate_protocol_values[i];
- if (base::StartsWithASCII(alternate_protocol_str, "p=", true)) {
- if (!base::StringToDouble(alternate_protocol_str.substr(2),
+ base::StringPiece alternate_protocol_str = alternate_protocol_values[i];
+ if (base::StartsWith(alternate_protocol_str, "p=",
+ base::CompareCase::SENSITIVE)) {
+ if (!base::StringToDouble(alternate_protocol_str.substr(2).as_string(),
&probability) ||
probability < 0 || probability > 1) {
DVLOG(1) << kAlternateProtocolHeader
@@ -52,8 +53,9 @@ void HttpStreamFactory::ProcessAlternateProtocol(
continue;
}
- std::vector<std::string> port_protocol_vector;
- base::SplitString(alternate_protocol_str, ':', &port_protocol_vector);
+ std::vector<base::StringPiece> port_protocol_vector =
+ base::SplitStringPiece(alternate_protocol_str, ":",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (port_protocol_vector.size() != 2) {
DVLOG(1) << kAlternateProtocolHeader
<< " header has too many tokens: "
@@ -71,7 +73,7 @@ void HttpStreamFactory::ProcessAlternateProtocol(
break;
}
- protocol = AlternateProtocolFromString(port_protocol_vector[1]);
+ protocol = AlternateProtocolFromString(port_protocol_vector[1].as_string());
if (IsAlternateProtocolValid(protocol) &&
!session.IsProtocolEnabled(protocol)) {
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698