| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_network_layer.h" | 5 #include "net/http/http_network_layer.h" |
| 6 | 6 |
| 7 #include "base/field_trial.h" | 7 #include "base/field_trial.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // will choose the first overlapping protocol in the server's list, since | 188 // will choose the first overlapping protocol in the server's list, since |
| 189 // it presumedly has a better understanding of which protocol we should | 189 // it presumedly has a better understanding of which protocol we should |
| 190 // use, therefore the rest of the ordering here is not important. | 190 // use, therefore the rest of the ordering here is not important. |
| 191 static const char kNpnProtosFull[] = "\x08http/1.1\x06spdy/2"; | 191 static const char kNpnProtosFull[] = "\x08http/1.1\x06spdy/2"; |
| 192 // This is a temporary hack to pretend we support version 1. | 192 // This is a temporary hack to pretend we support version 1. |
| 193 static const char kNpnProtosFullV1[] = "\x08http/1.1\x06spdy/1"; | 193 static const char kNpnProtosFullV1[] = "\x08http/1.1\x06spdy/1"; |
| 194 // No spdy specified. | 194 // No spdy specified. |
| 195 static const char kNpnProtosHttpOnly[] = "\x08http/1.1\x07http1.1"; | 195 static const char kNpnProtosHttpOnly[] = "\x08http/1.1\x07http1.1"; |
| 196 | 196 |
| 197 std::vector<std::string> spdy_options; | 197 std::vector<std::string> spdy_options; |
| 198 SplitString(mode, ',', &spdy_options); | 198 base::SplitString(mode, ',', &spdy_options); |
| 199 | 199 |
| 200 bool use_alt_protocols = true; | 200 bool use_alt_protocols = true; |
| 201 | 201 |
| 202 for (std::vector<std::string>::iterator it = spdy_options.begin(); | 202 for (std::vector<std::string>::iterator it = spdy_options.begin(); |
| 203 it != spdy_options.end(); ++it) { | 203 it != spdy_options.end(); ++it) { |
| 204 const std::string& option = *it; | 204 const std::string& option = *it; |
| 205 if (option == kDisableSSL) { | 205 if (option == kDisableSSL) { |
| 206 SpdySession::SetSSLMode(false); // Disable SSL | 206 SpdySession::SetSSLMode(false); // Disable SSL |
| 207 HttpStreamFactory::set_force_spdy_over_ssl(false); | 207 HttpStreamFactory::set_force_spdy_over_ssl(false); |
| 208 HttpStreamFactory::set_force_spdy_always(true); | 208 HttpStreamFactory::set_force_spdy_always(true); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 233 pair.protocol = HttpAlternateProtocols::NPN_SPDY_2; | 233 pair.protocol = HttpAlternateProtocols::NPN_SPDY_2; |
| 234 HttpAlternateProtocols::ForceAlternateProtocol(pair); | 234 HttpAlternateProtocols::ForceAlternateProtocol(pair); |
| 235 } else if (option.empty() && it == spdy_options.begin()) { | 235 } else if (option.empty() && it == spdy_options.begin()) { |
| 236 continue; | 236 continue; |
| 237 } else { | 237 } else { |
| 238 LOG(DFATAL) << "Unrecognized spdy option: " << option; | 238 LOG(DFATAL) << "Unrecognized spdy option: " << option; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } // namespace net | 242 } // namespace net |
| OLD | NEW |