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

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

Issue 17410014: Actually enable Alternate-Protocol support for QUIC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reorder Created 7 years, 6 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/quic/quic_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/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 "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (it->Equals(endpoint)) 136 if (it->Equals(endpoint))
137 return true; 137 return true;
138 return false; 138 return false;
139 } 139 }
140 140
141 // static 141 // static
142 void HttpStreamFactory::EnableNpnSpdy() { 142 void HttpStreamFactory::EnableNpnSpdy() {
143 set_use_alternate_protocols(true); 143 set_use_alternate_protocols(true);
144 std::vector<std::string> next_protos; 144 std::vector<std::string> next_protos;
145 next_protos.push_back("http/1.1"); 145 next_protos.push_back("http/1.1");
146 next_protos.push_back("quic");
146 next_protos.push_back("spdy/2"); 147 next_protos.push_back("spdy/2");
147 SetNextProtos(next_protos); 148 SetNextProtos(next_protos);
148 } 149 }
149 150
150 // static 151 // static
151 void HttpStreamFactory::EnableNpnHttpOnly() { 152 void HttpStreamFactory::EnableNpnHttpOnly() {
152 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 153 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
153 // and then fallback to http. This introduces extra load. 154 // and then fallback to http. This introduces extra load.
154 set_use_alternate_protocols(false); 155 set_use_alternate_protocols(false);
155 std::vector<std::string> next_protos; 156 std::vector<std::string> next_protos;
156 next_protos.push_back("http/1.1"); 157 next_protos.push_back("http/1.1");
157 next_protos.push_back("http1.1"); 158 next_protos.push_back("http1.1");
158 SetNextProtos(next_protos); 159 SetNextProtos(next_protos);
159 } 160 }
160 161
161 // static 162 // static
162 void HttpStreamFactory::EnableNpnSpdy3() { 163 void HttpStreamFactory::EnableNpnSpdy3() {
163 set_use_alternate_protocols(true); 164 set_use_alternate_protocols(true);
164 std::vector<std::string> next_protos; 165 std::vector<std::string> next_protos;
165 next_protos.push_back("http/1.1"); 166 next_protos.push_back("http/1.1");
167 next_protos.push_back("quic");
166 next_protos.push_back("spdy/2"); 168 next_protos.push_back("spdy/2");
167 next_protos.push_back("spdy/3"); 169 next_protos.push_back("spdy/3");
168 SetNextProtos(next_protos); 170 SetNextProtos(next_protos);
169 } 171 }
170 172
171 // static 173 // static
172 void HttpStreamFactory::EnableNpnSpdy31() { 174 void HttpStreamFactory::EnableNpnSpdy31() {
173 set_use_alternate_protocols(true); 175 set_use_alternate_protocols(true);
174 std::vector<std::string> next_protos; 176 std::vector<std::string> next_protos;
175 next_protos.push_back("http/1.1"); 177 next_protos.push_back("http/1.1");
178 next_protos.push_back("quic");
176 next_protos.push_back("spdy/2"); 179 next_protos.push_back("spdy/2");
177 next_protos.push_back("spdy/3"); 180 next_protos.push_back("spdy/3");
178 next_protos.push_back("spdy/3.1"); 181 next_protos.push_back("spdy/3.1");
179 SetNextProtos(next_protos); 182 SetNextProtos(next_protos);
180 } 183 }
181 184
182 // static 185 // static
183 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { 186 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) {
184 if (!next_protos_) 187 if (!next_protos_)
185 next_protos_ = new std::vector<std::string>; 188 next_protos_ = new std::vector<std::string>;
(...skipping 20 matching lines...) Expand all
206 enabled_protocols_[QUIC] = true; 209 enabled_protocols_[QUIC] = true;
207 } 210 }
208 } 211 }
209 // TODO(rch): Remove all support for spdy/1. 212 // TODO(rch): Remove all support for spdy/1.
210 enabled_protocols_[NPN_SPDY_1] = false; 213 enabled_protocols_[NPN_SPDY_1] = false;
211 } 214 }
212 215
213 HttpStreamFactory::HttpStreamFactory() {} 216 HttpStreamFactory::HttpStreamFactory() {}
214 217
215 } // namespace net 218 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698