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

Side by Side Diff: net/http/http_stream_factory.cc

Issue 9516009: SPDY - disable spdy/2.1 (flow control) by default (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_factory.h" 5 #include "net/http/http_stream_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "net/base/host_mapping_rules.h" 11 #include "net/base/host_mapping_rules.h"
12 #include "net/base/host_port_pair.h" 12 #include "net/base/host_port_pair.h"
13 #include "net/http/http_server_properties.h"
14 13
15 namespace net { 14 namespace net {
16 15
17 // WARNING: If you modify or add any static flags, you must keep them in sync 16 // WARNING: If you modify or add any static flags, you must keep them in sync
18 // with |ResetStaticSettingsToInit|. This is critical for unit test isolation. 17 // with |ResetStaticSettingsToInit|. This is critical for unit test isolation.
19 18
20 // static 19 // static
21 const HostMappingRules* HttpStreamFactory::host_mapping_rules_ = NULL; 20 const HostMappingRules* HttpStreamFactory::host_mapping_rules_ = NULL;
22 // static 21 // static
23 std::vector<std::string>* HttpStreamFactory::next_protos_ = NULL; 22 std::vector<std::string>* HttpStreamFactory::next_protos_ = NULL;
24 // static 23 // static
25 bool HttpStreamFactory::spdy_enabled_ = true; 24 bool HttpStreamFactory::spdy_enabled_ = true;
26 // static 25 // static
27 bool HttpStreamFactory::use_alternate_protocols_ = false; 26 bool HttpStreamFactory::use_alternate_protocols_ = false;
28 // static 27 // static
29 bool HttpStreamFactory::force_spdy_over_ssl_ = true; 28 bool HttpStreamFactory::force_spdy_over_ssl_ = true;
30 // static 29 // static
31 bool HttpStreamFactory::force_spdy_always_ = false; 30 bool HttpStreamFactory::force_spdy_always_ = false;
32 // static 31 // static
33 std::list<HostPortPair>* HttpStreamFactory::forced_spdy_exclusions_ = NULL; 32 std::list<HostPortPair>* HttpStreamFactory::forced_spdy_exclusions_ = NULL;
34 // static 33 // static
35 bool HttpStreamFactory::ignore_certificate_errors_ = false; 34 bool HttpStreamFactory::ignore_certificate_errors_ = false;
36 // static 35 // static
37 bool HttpStreamFactory::http_pipelining_enabled_ = false; 36 bool HttpStreamFactory::http_pipelining_enabled_ = false;
38 // static 37 // static
39 uint16 HttpStreamFactory::testing_fixed_http_port_ = 0; 38 uint16 HttpStreamFactory::testing_fixed_http_port_ = 0;
40 // static 39 // static
41 uint16 HttpStreamFactory::testing_fixed_https_port_ = 0; 40 uint16 HttpStreamFactory::testing_fixed_https_port_ = 0;
41 // static
42 AlternateProtocol HttpStreamFactory::highest_supported_alternate_protocol_ =
43 NPN_SPDY_2;
42 44
43 HttpStreamFactory::~HttpStreamFactory() {} 45 HttpStreamFactory::~HttpStreamFactory() {}
44 46
45 // static 47 // static
46 void HttpStreamFactory::ResetStaticSettingsToInit() { 48 void HttpStreamFactory::ResetStaticSettingsToInit() {
47 // WARNING: These must match the initializers above. 49 // WARNING: These must match the initializers above.
48 delete host_mapping_rules_; 50 delete host_mapping_rules_;
49 delete next_protos_; 51 delete next_protos_;
50 delete forced_spdy_exclusions_; 52 delete forced_spdy_exclusions_;
51 host_mapping_rules_ = NULL; 53 host_mapping_rules_ = NULL;
(...skipping 23 matching lines...) Expand all
75 if (!base::StringToInt(port_protocol_vector[0], &port) || 77 if (!base::StringToInt(port_protocol_vector[0], &port) ||
76 port <= 0 || port >= 1 << 16) { 78 port <= 0 || port >= 1 << 16) {
77 DLOG(WARNING) << kAlternateProtocolHeader 79 DLOG(WARNING) << kAlternateProtocolHeader
78 << " header has unrecognizable port: " 80 << " header has unrecognizable port: "
79 << port_protocol_vector[0]; 81 << port_protocol_vector[0];
80 return; 82 return;
81 } 83 }
82 84
83 AlternateProtocol protocol = ALTERNATE_PROTOCOL_BROKEN; 85 AlternateProtocol protocol = ALTERNATE_PROTOCOL_BROKEN;
84 // We skip NPN_SPDY_1 here, because we've rolled the protocol version to 2. 86 // We skip NPN_SPDY_1 here, because we've rolled the protocol version to 2.
85 for (int i = NPN_SPDY_2; i < NUM_ALTERNATE_PROTOCOLS; ++i) { 87 for (int i = NPN_SPDY_2; i <= highest_supported_alternate_protocol_; ++i) {
86 if (port_protocol_vector[1] == kAlternateProtocolStrings[i]) 88 if (port_protocol_vector[1] == kAlternateProtocolStrings[i])
87 protocol = static_cast<AlternateProtocol>(i); 89 protocol = static_cast<AlternateProtocol>(i);
88 } 90 }
89 91
90 if (protocol == ALTERNATE_PROTOCOL_BROKEN) { 92 if (protocol == ALTERNATE_PROTOCOL_BROKEN) {
91 // Currently, we only recognize the npn-spdy protocol. 93 // Currently, we only recognize the npn-spdy protocol.
92 DLOG(WARNING) << kAlternateProtocolHeader 94 DLOG(WARNING) << kAlternateProtocolHeader
93 << " header has unrecognized protocol: " 95 << " header has unrecognized protocol: "
94 << port_protocol_vector[1]; 96 << port_protocol_vector[1];
95 return; 97 return;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 HttpStreamFactory::HttpStreamFactory() {} 157 HttpStreamFactory::HttpStreamFactory() {}
156 158
157 // static 159 // static
158 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { 160 const HostMappingRules& HttpStreamFactory::host_mapping_rules() {
159 if (!host_mapping_rules_) 161 if (!host_mapping_rules_)
160 host_mapping_rules_ = new HostMappingRules; 162 host_mapping_rules_ = new HostMappingRules;
161 return *host_mapping_rules_; 163 return *host_mapping_rules_;
162 } 164 }
163 165
164 } // namespace net 166 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698