OLD | NEW |
---|---|
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/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 set_use_alternate_protocols(true); | 173 set_use_alternate_protocols(true); |
174 std::vector<std::string> next_protos; | 174 std::vector<std::string> next_protos; |
175 next_protos.push_back("http/1.1"); | 175 next_protos.push_back("http/1.1"); |
176 next_protos.push_back("spdy/2"); | 176 next_protos.push_back("spdy/2"); |
177 next_protos.push_back("spdy/3"); | 177 next_protos.push_back("spdy/3"); |
178 next_protos.push_back("spdy/3.1"); | 178 next_protos.push_back("spdy/3.1"); |
179 SetNextProtos(next_protos); | 179 SetNextProtos(next_protos); |
180 } | 180 } |
181 | 181 |
182 // static | 182 // static |
183 void HttpStreamFactory::EnableNpnSpdy4a1() { | |
184 set_use_alternate_protocols(true); | |
185 std::vector<std::string> next_protos; | |
186 next_protos.push_back("http/1.1"); | |
187 next_protos.push_back("spdy/2"); | |
188 next_protos.push_back("spdy/3"); | |
Ryan Hamilton
2013/04/10 23:07:53
We could also consider adding spdy/3.1 in this lis
akalin
2013/04/10 23:20:04
Done.
| |
189 next_protos.push_back("spdy/4a1"); | |
190 SetNextProtos(next_protos); | |
191 } | |
192 | |
193 // static | |
183 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { | 194 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { |
184 if (!next_protos_) | 195 if (!next_protos_) |
185 next_protos_ = new std::vector<std::string>; | 196 next_protos_ = new std::vector<std::string>; |
186 | 197 |
187 *next_protos_ = value; | 198 *next_protos_ = value; |
188 | 199 |
189 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) | 200 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) |
190 enabled_protocols_[i] = false; | 201 enabled_protocols_[i] = false; |
191 | 202 |
192 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY | 203 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY |
193 // versions in next_protos and kAlternateProtocolStrings. | 204 // versions in next_protos and kAlternateProtocolStrings. |
194 for (uint32 i = 0; i < value.size(); ++i) { | 205 for (uint32 i = 0; i < value.size(); ++i) { |
195 if (value[i] == "spdy/1") { | 206 if (value[i] == "spdy/1") { |
196 enabled_protocols_[NPN_SPDY_1] = true; | 207 enabled_protocols_[NPN_SPDY_1] = true; |
197 } else if (value[i] == "spdy/2") { | 208 } else if (value[i] == "spdy/2") { |
198 enabled_protocols_[NPN_SPDY_2] = true; | 209 enabled_protocols_[NPN_SPDY_2] = true; |
199 } else if (value[i] == "spdy/3") { | 210 } else if (value[i] == "spdy/3") { |
200 enabled_protocols_[NPN_SPDY_3] = true; | 211 enabled_protocols_[NPN_SPDY_3] = true; |
201 } else if (value[i] == "spdy/3.1") { | 212 } else if (value[i] == "spdy/3.1") { |
202 enabled_protocols_[NPN_SPDY_3_1] = true; | 213 enabled_protocols_[NPN_SPDY_3_1] = true; |
214 } else if (value[i] == "spdy/4a1") { | |
215 enabled_protocols_[NPN_SPDY_4a1] = true; | |
203 } else if (value[i] == "quic") { | 216 } else if (value[i] == "quic") { |
204 enabled_protocols_[QUIC] = true; | 217 enabled_protocols_[QUIC] = true; |
205 } | 218 } |
206 } | 219 } |
207 // TODO(rch): Remove all support for spdy/1. | 220 // TODO(rch): Remove all support for spdy/1. |
208 enabled_protocols_[NPN_SPDY_1] = false; | 221 enabled_protocols_[NPN_SPDY_1] = false; |
209 } | 222 } |
210 | 223 |
211 HttpStreamFactory::HttpStreamFactory() {} | 224 HttpStreamFactory::HttpStreamFactory() {} |
212 | 225 |
213 } // namespace net | 226 } // namespace net |
OLD | NEW |