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() { | 183 void HttpStreamFactory::EnableNpnSpdy4a2() { |
184 set_use_alternate_protocols(true); | 184 set_use_alternate_protocols(true); |
185 std::vector<std::string> next_protos; | 185 std::vector<std::string> next_protos; |
186 next_protos.push_back("http/1.1"); | 186 next_protos.push_back("http/1.1"); |
187 next_protos.push_back("spdy/2"); | 187 next_protos.push_back("spdy/2"); |
188 next_protos.push_back("spdy/3"); | 188 next_protos.push_back("spdy/3"); |
189 next_protos.push_back("spdy/3.1"); | 189 next_protos.push_back("spdy/3.1"); |
190 next_protos.push_back("spdy/4a1"); | 190 next_protos.push_back("spdy/4a2"); |
Ryan Hamilton
2013/05/08 22:15:50
I think I might be more inclined to comment out th
akalin
2013/05/15 00:16:08
Done.
| |
191 SetNextProtos(next_protos); | 191 SetNextProtos(next_protos); |
192 } | 192 } |
193 | 193 |
194 // static | 194 // static |
195 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { | 195 void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { |
196 if (!next_protos_) | 196 if (!next_protos_) |
197 next_protos_ = new std::vector<std::string>; | 197 next_protos_ = new std::vector<std::string>; |
198 | 198 |
199 *next_protos_ = value; | 199 *next_protos_ = value; |
200 | 200 |
201 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) | 201 for (uint32 i = 0; i < NUM_ALTERNATE_PROTOCOLS; ++i) |
202 enabled_protocols_[i] = false; | 202 enabled_protocols_[i] = false; |
203 | 203 |
204 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY | 204 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY |
205 // versions in next_protos and kAlternateProtocolStrings. | 205 // versions in next_protos and kAlternateProtocolStrings. |
206 for (uint32 i = 0; i < value.size(); ++i) { | 206 for (uint32 i = 0; i < value.size(); ++i) { |
207 if (value[i] == "spdy/1") { | 207 if (value[i] == "spdy/1") { |
208 enabled_protocols_[NPN_SPDY_1] = true; | 208 enabled_protocols_[NPN_SPDY_1] = true; |
209 } else if (value[i] == "spdy/2") { | 209 } else if (value[i] == "spdy/2") { |
210 enabled_protocols_[NPN_SPDY_2] = true; | 210 enabled_protocols_[NPN_SPDY_2] = true; |
211 } else if (value[i] == "spdy/3") { | 211 } else if (value[i] == "spdy/3") { |
212 enabled_protocols_[NPN_SPDY_3] = true; | 212 enabled_protocols_[NPN_SPDY_3] = true; |
213 } else if (value[i] == "spdy/3.1") { | 213 } else if (value[i] == "spdy/3.1") { |
214 enabled_protocols_[NPN_SPDY_3_1] = true; | 214 enabled_protocols_[NPN_SPDY_3_1] = true; |
215 } else if (value[i] == "spdy/4a1") { | 215 } else if (value[i] == "spdy/4a2") { |
216 enabled_protocols_[NPN_SPDY_4a1] = true; | 216 enabled_protocols_[NPN_SPDY_4A2] = true; |
217 } else if (value[i] == "quic") { | 217 } else if (value[i] == "quic") { |
218 enabled_protocols_[QUIC] = true; | 218 enabled_protocols_[QUIC] = true; |
219 } | 219 } |
220 } | 220 } |
221 // TODO(rch): Remove all support for spdy/1. | 221 // TODO(rch): Remove all support for spdy/1. |
222 enabled_protocols_[NPN_SPDY_1] = false; | 222 enabled_protocols_[NPN_SPDY_1] = false; |
223 } | 223 } |
224 | 224 |
225 HttpStreamFactory::HttpStreamFactory() {} | 225 HttpStreamFactory::HttpStreamFactory() {} |
226 | 226 |
227 } // namespace net | 227 } // namespace net |
OLD | NEW |