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

Unified Diff: net/http/http_stream_factory.cc

Issue 1014043004: Clear alternate protocols on empty or invalid header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix in response to broken test Created 5 years, 9 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_network_transaction_unittest.cc ('k') | no next file » | 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 754372bb88aec3549c08266e07992ed455b8bce3..c4d0e728881a9981086814874eba57f5d69578b5 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -36,6 +36,7 @@ void HttpStreamFactory::ProcessAlternateProtocol(
AlternateProtocol protocol = UNINITIALIZED_ALTERNATE_PROTOCOL;
int port = 0;
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 (StartsWithASCII(alternate_protocol_str, "p=", true)) {
@@ -45,7 +46,8 @@ void HttpStreamFactory::ProcessAlternateProtocol(
DVLOG(1) << kAlternateProtocolHeader
<< " header has unrecognizable probability: "
<< alternate_protocol_values[i];
- return;
+ is_valid = false;
+ break;
}
continue;
}
@@ -56,7 +58,8 @@ void HttpStreamFactory::ProcessAlternateProtocol(
DVLOG(1) << kAlternateProtocolHeader
<< " header has too many tokens: "
<< alternate_protocol_str;
- return;
+ is_valid = false;
+ break;
}
if (!base::StringToInt(port_protocol_vector[0], &port) ||
@@ -64,7 +67,8 @@ void HttpStreamFactory::ProcessAlternateProtocol(
DVLOG(1) << kAlternateProtocolHeader
<< " header has unrecognizable port: "
<< port_protocol_vector[0];
- return;
+ is_valid = false;
+ break;
}
protocol = AlternateProtocolFromString(port_protocol_vector[1]);
@@ -74,12 +78,15 @@ void HttpStreamFactory::ProcessAlternateProtocol(
DVLOG(1) << kAlternateProtocolHeader
<< " header has unrecognized protocol: "
<< port_protocol_vector[1];
- return;
+ is_valid = false;
+ break;
}
}
- if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ if (!is_valid || protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
+ http_server_properties->ClearAlternateProtocol(http_host_port_pair);
return;
+ }
HostPortPair host_port(http_host_port_pair);
const HostMappingRules* mapping_rules = GetHostMappingRules();
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698