Index: net/http/http_stream_factory.cc |
=================================================================== |
--- net/http/http_stream_factory.cc (revision 124201) |
+++ net/http/http_stream_factory.cc (working copy) |
@@ -10,7 +10,6 @@ |
#include "googleurl/src/gurl.h" |
#include "net/base/host_mapping_rules.h" |
#include "net/base/host_port_pair.h" |
-#include "net/http/http_server_properties.h" |
namespace net { |
@@ -22,6 +21,8 @@ |
// static |
std::vector<std::string>* HttpStreamFactory::next_protos_ = NULL; |
// static |
+bool HttpStreamFactory::supported_protocols_[NUM_ALTERNATE_PROTOCOLS]; |
+// static |
bool HttpStreamFactory::spdy_enabled_ = true; |
// static |
bool HttpStreamFactory::use_alternate_protocols_ = false; |
@@ -56,6 +57,8 @@ |
force_spdy_always_ = false; |
forced_spdy_exclusions_ = NULL; |
ignore_certificate_errors_ = false; |
+ for (int i = NPN_SPDY_1; i < NUM_ALTERNATE_PROTOCOLS; ++i) |
Ryan Hamilton
2012/03/02 16:46:53
Start at 0 just to be simple.
ramant (doing other things)
2012/03/02 18:40:41
Done.
|
+ supported_protocols_[i] = false; |
} |
void HttpStreamFactory::ProcessAlternateProtocol( |
@@ -83,8 +86,10 @@ |
AlternateProtocol protocol = ALTERNATE_PROTOCOL_BROKEN; |
// We skip NPN_SPDY_1 here, because we've rolled the protocol version to 2. |
for (int i = NPN_SPDY_2; i < NUM_ALTERNATE_PROTOCOLS; ++i) { |
Ryan Hamilton
2012/03/02 16:46:53
Please start at 0. If we want to avoid SPDY_1, ei
ramant (doing other things)
2012/03/02 18:40:41
Done.
|
- if (port_protocol_vector[1] == kAlternateProtocolStrings[i]) |
+ if (supported_protocols_[i] && |
+ port_protocol_vector[1] == kAlternateProtocolStrings[i]) { |
protocol = static_cast<AlternateProtocol>(i); |
+ } |
} |
if (protocol == ALTERNATE_PROTOCOL_BROKEN) { |
@@ -145,6 +150,27 @@ |
} |
// static |
+void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { |
+ if (!next_protos_) |
+ next_protos_ = new std::vector<std::string>; |
+ |
+ *next_protos_ = value; |
+ |
+ for (uint32 i = NPN_SPDY_1; i < NUM_ALTERNATE_PROTOCOLS; ++i) |
+ supported_protocols_[i] = false; |
+ |
+ for (uint32 i = 0; i < value.size(); ++i) { |
Ryan Hamilton
2012/03/02 16:46:53
Let's not hard-code the strings again, please. Ho
ramant (doing other things)
2012/03/02 18:40:41
As we had discussed, added a TODO and issue 116575
|
+ if (value[i] == "spdy/1") { |
+ supported_protocols_[NPN_SPDY_1] = true; |
+ } else if (value[i] == "spdy/2") { |
+ supported_protocols_[NPN_SPDY_2] = true; |
+ } else if (value[i] == "spdy/2.1") { |
+ supported_protocols_[NPN_SPDY_21] = true; |
+ } |
+ } |
+} |
+ |
+// static |
void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { |
HostMappingRules* host_mapping_rules = new HostMappingRules; |
host_mapping_rules->SetRulesFromString(rules); |