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

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
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::supported_spdy_version_ = NPN_SPDY_2;
42 43
43 HttpStreamFactory::~HttpStreamFactory() {} 44 HttpStreamFactory::~HttpStreamFactory() {}
44 45
45 // static 46 // static
46 void HttpStreamFactory::ResetStaticSettingsToInit() { 47 void HttpStreamFactory::ResetStaticSettingsToInit() {
47 // WARNING: These must match the initializers above. 48 // WARNING: These must match the initializers above.
48 delete host_mapping_rules_; 49 delete host_mapping_rules_;
49 delete next_protos_; 50 delete next_protos_;
50 delete forced_spdy_exclusions_; 51 delete forced_spdy_exclusions_;
51 host_mapping_rules_ = NULL; 52 host_mapping_rules_ = NULL;
52 next_protos_ = NULL; 53 next_protos_ = NULL;
53 spdy_enabled_ = true; 54 spdy_enabled_ = true;
54 use_alternate_protocols_ = false; 55 use_alternate_protocols_ = false;
55 force_spdy_over_ssl_ = true; 56 force_spdy_over_ssl_ = true;
56 force_spdy_always_ = false; 57 force_spdy_always_ = false;
57 forced_spdy_exclusions_ = NULL; 58 forced_spdy_exclusions_ = NULL;
58 ignore_certificate_errors_ = false; 59 ignore_certificate_errors_ = false;
60 supported_spdy_version_ = NPN_SPDY_2;
59 } 61 }
60 62
61 void HttpStreamFactory::ProcessAlternateProtocol( 63 void HttpStreamFactory::ProcessAlternateProtocol(
62 HttpServerProperties* http_server_properties, 64 HttpServerProperties* http_server_properties,
63 const std::string& alternate_protocol_str, 65 const std::string& alternate_protocol_str,
64 const HostPortPair& http_host_port_pair) { 66 const HostPortPair& http_host_port_pair) {
65 std::vector<std::string> port_protocol_vector; 67 std::vector<std::string> port_protocol_vector;
66 base::SplitString(alternate_protocol_str, ':', &port_protocol_vector); 68 base::SplitString(alternate_protocol_str, ':', &port_protocol_vector);
67 if (port_protocol_vector.size() != 2) { 69 if (port_protocol_vector.size() != 2) {
68 DLOG(WARNING) << kAlternateProtocolHeader 70 DLOG(WARNING) << kAlternateProtocolHeader
(...skipping 11 matching lines...) Expand all
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 < NUM_ALTERNATE_PROTOCOLS; ++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 != supported_spdy_version_ ||
Ryan Hamilton 2012/03/01 18:56:20 As we discussed offline, this approach only allows
willchan no longer on Chromium 2012/03/01 18:57:54 Whew, good catch! I didn't notice this. This is im
93 protocol == ALTERNATE_PROTOCOL_BROKEN) {
91 // Currently, we only recognize the npn-spdy protocol. 94 // Currently, we only recognize the npn-spdy protocol.
92 DLOG(WARNING) << kAlternateProtocolHeader 95 DLOG(WARNING) << kAlternateProtocolHeader
93 << " header has unrecognized protocol: " 96 << " header has unrecognized protocol: "
94 << port_protocol_vector[1]; 97 << port_protocol_vector[1];
95 return; 98 return;
96 } 99 }
97 100
98 HostPortPair host_port(http_host_port_pair); 101 HostPortPair host_port(http_host_port_pair);
99 host_mapping_rules().RewriteHost(&host_port); 102 host_mapping_rules().RewriteHost(&host_port);
100 103
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 HttpStreamFactory::HttpStreamFactory() {} 158 HttpStreamFactory::HttpStreamFactory() {}
156 159
157 // static 160 // static
158 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { 161 const HostMappingRules& HttpStreamFactory::host_mapping_rules() {
159 if (!host_mapping_rules_) 162 if (!host_mapping_rules_)
160 host_mapping_rules_ = new HostMappingRules; 163 host_mapping_rules_ = new HostMappingRules;
161 return *host_mapping_rules_; 164 return *host_mapping_rules_;
162 } 165 }
163 166
164 } // namespace net 167 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698