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

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

Issue 10005041: Remove SPDY 2.1 support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove references to deleted flags from chrome/browser Created 8 years, 8 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/net.gyp » ('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"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 162 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
163 // and then fallback to http. This introduces extra load. 163 // and then fallback to http. This introduces extra load.
164 set_use_alternate_protocols(false); 164 set_use_alternate_protocols(false);
165 std::vector<std::string> next_protos; 165 std::vector<std::string> next_protos;
166 next_protos.push_back("http/1.1"); 166 next_protos.push_back("http/1.1");
167 next_protos.push_back("http1.1"); 167 next_protos.push_back("http1.1");
168 SetNextProtos(next_protos); 168 SetNextProtos(next_protos);
169 } 169 }
170 170
171 // static 171 // static
172 void HttpStreamFactory::EnableFlowControl() {
173 std::vector<std::string> next_protos;
174 next_protos.push_back("http/1.1");
175 next_protos.push_back("spdy/2");
176 next_protos.push_back("spdy/2.1");
177 SetNextProtos(next_protos);
178 }
179
180 // static
181 void HttpStreamFactory::EnableNpnSpdy3() { 172 void HttpStreamFactory::EnableNpnSpdy3() {
182 std::vector<std::string> next_protos; 173 std::vector<std::string> next_protos;
183 next_protos.push_back("http/1.1"); 174 next_protos.push_back("http/1.1");
184 next_protos.push_back("spdy/2"); 175 next_protos.push_back("spdy/2");
185 next_protos.push_back("spdy/2.1");
186 next_protos.push_back("spdy/3"); 176 next_protos.push_back("spdy/3");
187 SetNextProtos(next_protos); 177 SetNextProtos(next_protos);
188 } 178 }
189 179
190 // static 180 // static
191 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { 181 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) {
192 if (!next_protos_) 182 if (!next_protos_)
193 next_protos_ = new std::vector<std::string>; 183 next_protos_ = new std::vector<std::string>;
194 184
195 *next_protos_ = value; 185 *next_protos_ = value;
196 186
197 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) 187 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i)
198 enabled_protocols_[i] = false; 188 enabled_protocols_[i] = false;
199 189
200 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY 190 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY
201 // versions in next_protos and kAlternateProtocolStrings. 191 // versions in next_protos and kAlternateProtocolStrings.
202 for (uint32 i = 0; i < value.size(); ++i) { 192 for (uint32 i = 0; i < value.size(); ++i) {
203 if (value[i] == "spdy/1") { 193 if (value[i] == "spdy/1") {
204 enabled_protocols_[NPN_SPDY_1] = true; 194 enabled_protocols_[NPN_SPDY_1] = true;
205 } else if (value[i] == "spdy/2") { 195 } else if (value[i] == "spdy/2") {
206 enabled_protocols_[NPN_SPDY_2] = true; 196 enabled_protocols_[NPN_SPDY_2] = true;
207 } else if (value[i] == "spdy/2.1") {
208 enabled_protocols_[NPN_SPDY_21] = true;
209 } else if (value[i] == "spdy/3") { 197 } else if (value[i] == "spdy/3") {
210 enabled_protocols_[NPN_SPDY_3] = true; 198 enabled_protocols_[NPN_SPDY_3] = true;
211 } 199 }
212 } 200 }
213 enabled_protocols_[NPN_SPDY_1] = false; 201 enabled_protocols_[NPN_SPDY_1] = false;
214 } 202 }
215 203
216 // static 204 // static
217 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { 205 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) {
218 HostMappingRules* host_mapping_rules = new HostMappingRules; 206 HostMappingRules* host_mapping_rules = new HostMappingRules;
219 host_mapping_rules->SetRulesFromString(rules); 207 host_mapping_rules->SetRulesFromString(rules);
220 delete host_mapping_rules_; 208 delete host_mapping_rules_;
221 host_mapping_rules_ = host_mapping_rules; 209 host_mapping_rules_ = host_mapping_rules;
222 } 210 }
223 211
224 HttpStreamFactory::HttpStreamFactory() {} 212 HttpStreamFactory::HttpStreamFactory() {}
225 213
226 // static 214 // static
227 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { 215 const HostMappingRules& HttpStreamFactory::host_mapping_rules() {
228 if (!host_mapping_rules_) 216 if (!host_mapping_rules_)
229 host_mapping_rules_ = new HostMappingRules; 217 host_mapping_rules_ = new HostMappingRules;
230 return *host_mapping_rules_; 218 return *host_mapping_rules_;
231 } 219 }
232 220
233 } // namespace net 221 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698