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/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 Loading... |
162 void HttpStreamFactory::EnableNpnSpdy3() { | 162 void HttpStreamFactory::EnableNpnSpdy3() { |
163 set_use_alternate_protocols(true); | 163 set_use_alternate_protocols(true); |
164 std::vector<std::string> next_protos; | 164 std::vector<std::string> next_protos; |
165 next_protos.push_back("http/1.1"); | 165 next_protos.push_back("http/1.1"); |
166 next_protos.push_back("spdy/2"); | 166 next_protos.push_back("spdy/2"); |
167 next_protos.push_back("spdy/3"); | 167 next_protos.push_back("spdy/3"); |
168 SetNextProtos(next_protos); | 168 SetNextProtos(next_protos); |
169 } | 169 } |
170 | 170 |
171 // static | 171 // static |
| 172 void HttpStreamFactory::EnableNpnSpdy31() { |
| 173 set_use_alternate_protocols(true); |
| 174 std::vector<std::string> next_protos; |
| 175 next_protos.push_back("http/1.1"); |
| 176 next_protos.push_back("spdy/2"); |
| 177 next_protos.push_back("spdy/3"); |
| 178 next_protos.push_back("spdy/3.1"); |
| 179 SetNextProtos(next_protos); |
| 180 } |
| 181 |
| 182 // static |
172 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { | 183 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { |
173 if (!next_protos_) | 184 if (!next_protos_) |
174 next_protos_ = new std::vector<std::string>; | 185 next_protos_ = new std::vector<std::string>; |
175 | 186 |
176 *next_protos_ = value; | 187 *next_protos_ = value; |
177 | 188 |
178 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) | 189 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) |
179 enabled_protocols_[i] = false; | 190 enabled_protocols_[i] = false; |
180 | 191 |
181 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY | 192 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY |
182 // versions in next_protos and kAlternateProtocolStrings. | 193 // versions in next_protos and kAlternateProtocolStrings. |
183 for (uint32 i = 0; i < value.size(); ++i) { | 194 for (uint32 i = 0; i < value.size(); ++i) { |
184 if (value[i] == "spdy/1") { | 195 if (value[i] == "spdy/1") { |
185 enabled_protocols_[NPN_SPDY_1] = true; | 196 enabled_protocols_[NPN_SPDY_1] = true; |
186 } else if (value[i] == "spdy/2") { | 197 } else if (value[i] == "spdy/2") { |
187 enabled_protocols_[NPN_SPDY_2] = true; | 198 enabled_protocols_[NPN_SPDY_2] = true; |
188 } else if (value[i] == "spdy/3") { | 199 } else if (value[i] == "spdy/3") { |
189 enabled_protocols_[NPN_SPDY_3] = true; | 200 enabled_protocols_[NPN_SPDY_3] = true; |
| 201 } else if (value[i] == "spdy/3.1") { |
| 202 enabled_protocols_[NPN_SPDY_3_1] = true; |
190 } else if (value[i] == "quic/1") { | 203 } else if (value[i] == "quic/1") { |
191 enabled_protocols_[QUIC_1] = true; | 204 enabled_protocols_[QUIC_1] = true; |
192 } | 205 } |
193 } | 206 } |
194 // TODO(rch): Remove all support for spdy/1. | 207 // TODO(rch): Remove all support for spdy/1. |
195 enabled_protocols_[NPN_SPDY_1] = false; | 208 enabled_protocols_[NPN_SPDY_1] = false; |
196 } | 209 } |
197 | 210 |
198 HttpStreamFactory::HttpStreamFactory() {} | 211 HttpStreamFactory::HttpStreamFactory() {} |
199 | 212 |
200 } // namespace net | 213 } // namespace net |
OLD | NEW |