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

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

Issue 25977005: [SPDY] Do not advertise SPDY/2 by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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/http/http_stream_factory_impl_request_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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "net/base/host_mapping_rules.h" 10 #include "net/base/host_mapping_rules.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return false; 150 return false;
151 151
152 std::list<HostPortPair>::const_iterator it; 152 std::list<HostPortPair>::const_iterator it;
153 for (it = exclusions->begin(); it != exclusions->end(); ++it) 153 for (it = exclusions->begin(); it != exclusions->end(); ++it)
154 if (it->Equals(endpoint)) 154 if (it->Equals(endpoint))
155 return true; 155 return true;
156 return false; 156 return false;
157 } 157 }
158 158
159 // static 159 // static
160 void HttpStreamFactory::EnableNpnSpdy() {
161 set_use_alternate_protocols(true);
162 std::vector<NextProto> next_protos;
163 next_protos.push_back(kProtoHTTP11);
164 next_protos.push_back(kProtoQUIC1SPDY3);
165 next_protos.push_back(kProtoSPDY2);
166 SetNextProtos(next_protos);
167 }
168
169 // static
170 void HttpStreamFactory::EnableNpnHttpOnly() { 160 void HttpStreamFactory::EnableNpnHttpOnly() {
171 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 161 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
172 // and then fallback to http. This introduces extra load. 162 // and then fallback to http. This introduces extra load.
173 set_use_alternate_protocols(false); 163 set_use_alternate_protocols(false);
174 std::vector<NextProto> next_protos; 164 std::vector<NextProto> next_protos;
175 next_protos.push_back(kProtoHTTP11); 165 next_protos.push_back(kProtoHTTP11);
176 SetNextProtos(next_protos); 166 SetNextProtos(next_protos);
177 } 167 }
178 168
179 // static 169 // static
180 void HttpStreamFactory::EnableNpnSpdy3() { 170 void HttpStreamFactory::EnableNpnSpdy3() {
181 set_use_alternate_protocols(true); 171 set_use_alternate_protocols(true);
182 std::vector<NextProto> next_protos; 172 std::vector<NextProto> next_protos;
183 next_protos.push_back(kProtoHTTP11); 173 next_protos.push_back(kProtoHTTP11);
184 next_protos.push_back(kProtoQUIC1SPDY3); 174 next_protos.push_back(kProtoQUIC1SPDY3);
185 next_protos.push_back(kProtoSPDY2);
186 next_protos.push_back(kProtoSPDY3); 175 next_protos.push_back(kProtoSPDY3);
187 SetNextProtos(next_protos); 176 SetNextProtos(next_protos);
188 } 177 }
189 178
190 // static 179 // static
191 void HttpStreamFactory::EnableNpnSpdy31() { 180 void HttpStreamFactory::EnableNpnSpdy31() {
192 set_use_alternate_protocols(true); 181 set_use_alternate_protocols(true);
193 std::vector<NextProto> next_protos; 182 std::vector<NextProto> next_protos;
194 next_protos.push_back(kProtoHTTP11); 183 next_protos.push_back(kProtoHTTP11);
195 next_protos.push_back(kProtoQUIC1SPDY3); 184 next_protos.push_back(kProtoQUIC1SPDY3);
196 next_protos.push_back(kProtoSPDY2);
197 next_protos.push_back(kProtoSPDY3); 185 next_protos.push_back(kProtoSPDY3);
198 next_protos.push_back(kProtoSPDY31); 186 next_protos.push_back(kProtoSPDY31);
199 SetNextProtos(next_protos); 187 SetNextProtos(next_protos);
188 }
189
190 // static
191 void HttpStreamFactory::EnableNpnSpdy31WithSpdy2() {
192 set_use_alternate_protocols(true);
193 std::vector<NextProto> next_protos;
194 next_protos.push_back(kProtoHTTP11);
195 next_protos.push_back(kProtoQUIC1SPDY3);
196 next_protos.push_back(kProtoDeprecatedSPDY2);
197 next_protos.push_back(kProtoSPDY3);
198 next_protos.push_back(kProtoSPDY31);
199 SetNextProtos(next_protos);
200 } 200 }
201 201
202 // static 202 // static
203 void HttpStreamFactory::EnableNpnSpdy4a2() { 203 void HttpStreamFactory::EnableNpnSpdy4a2() {
204 set_use_alternate_protocols(true); 204 set_use_alternate_protocols(true);
205 std::vector<NextProto> next_protos; 205 std::vector<NextProto> next_protos;
206 next_protos.push_back(kProtoHTTP11); 206 next_protos.push_back(kProtoHTTP11);
207 next_protos.push_back(kProtoQUIC1SPDY3); 207 next_protos.push_back(kProtoQUIC1SPDY3);
208 next_protos.push_back(kProtoSPDY2);
209 next_protos.push_back(kProtoSPDY3); 208 next_protos.push_back(kProtoSPDY3);
210 next_protos.push_back(kProtoSPDY31); 209 next_protos.push_back(kProtoSPDY31);
211 next_protos.push_back(kProtoSPDY4a2); 210 next_protos.push_back(kProtoSPDY4a2);
212 SetNextProtos(next_protos); 211 SetNextProtos(next_protos);
213 } 212 }
214 213
215 // static 214 // static
216 void HttpStreamFactory::EnableNpnHttp2Draft04() { 215 void HttpStreamFactory::EnableNpnHttp2Draft04() {
217 set_use_alternate_protocols(true); 216 set_use_alternate_protocols(true);
218 std::vector<NextProto> next_protos; 217 std::vector<NextProto> next_protos;
219 next_protos.push_back(kProtoHTTP11); 218 next_protos.push_back(kProtoHTTP11);
220 next_protos.push_back(kProtoQUIC1SPDY3); 219 next_protos.push_back(kProtoQUIC1SPDY3);
221 next_protos.push_back(kProtoSPDY2);
222 next_protos.push_back(kProtoSPDY3); 220 next_protos.push_back(kProtoSPDY3);
223 next_protos.push_back(kProtoSPDY31); 221 next_protos.push_back(kProtoSPDY31);
224 next_protos.push_back(kProtoSPDY4a2); 222 next_protos.push_back(kProtoSPDY4a2);
225 next_protos.push_back(kProtoHTTP2Draft04); 223 next_protos.push_back(kProtoHTTP2Draft04);
226 SetNextProtos(next_protos); 224 SetNextProtos(next_protos);
227 } 225 }
228 226
229 // static 227 // static
230 void HttpStreamFactory::SetNextProtos(const std::vector<NextProto>& value) { 228 void HttpStreamFactory::SetNextProtos(const std::vector<NextProto>& value) {
231 if (!next_protos_) 229 if (!next_protos_)
(...skipping 22 matching lines...) Expand all
254 continue; 252 continue;
255 } 253 }
256 SetProtocolEnabled(alternate); 254 SetProtocolEnabled(alternate);
257 } 255 }
258 } 256 }
259 } 257 }
260 258
261 HttpStreamFactory::HttpStreamFactory() {} 259 HttpStreamFactory::HttpStreamFactory() {}
262 260
263 } // namespace net 261 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/http/http_stream_factory_impl_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698