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_network_layer.h" | 5 #include "net/http/http_network_layer.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 "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 SpdySession::set_enable_ping_based_connection_checking(false); | 94 SpdySession::set_enable_ping_based_connection_checking(false); |
95 } else if (option == kExclude) { | 95 } else if (option == kExclude) { |
96 HttpStreamFactory::add_forced_spdy_exclusion(value); | 96 HttpStreamFactory::add_forced_spdy_exclusion(value); |
97 } else if (option == kDisableCompression) { | 97 } else if (option == kDisableCompression) { |
98 spdy::SpdyFramer::set_enable_compression_default(false); | 98 spdy::SpdyFramer::set_enable_compression_default(false); |
99 } else if (option == kEnableNPN) { | 99 } else if (option == kEnableNPN) { |
100 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols); | 100 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols); |
101 std::vector<std::string> next_protos; | 101 std::vector<std::string> next_protos; |
102 next_protos.push_back("http/1.1"); | 102 next_protos.push_back("http/1.1"); |
103 next_protos.push_back("spdy/2"); | 103 next_protos.push_back("spdy/2"); |
104 next_protos.push_back("spdy/2.1"); | 104 HttpStreamFactory::SetNextProtos(next_protos); |
105 HttpStreamFactory::set_next_protos(next_protos); | |
106 } else if (option == kEnableNpnHttpOnly) { | 105 } else if (option == kEnableNpnHttpOnly) { |
107 // Avoid alternate protocol in this case. Otherwise, browser will try SSL | 106 // Avoid alternate protocol in this case. Otherwise, browser will try SSL |
108 // and then fallback to http. This introduces extra load. | 107 // and then fallback to http. This introduces extra load. |
109 HttpStreamFactory::set_use_alternate_protocols(false); | 108 HttpStreamFactory::set_use_alternate_protocols(false); |
110 std::vector<std::string> next_protos; | 109 std::vector<std::string> next_protos; |
111 next_protos.push_back("http/1.1"); | 110 next_protos.push_back("http/1.1"); |
112 next_protos.push_back("http1.1"); | 111 next_protos.push_back("http1.1"); |
113 HttpStreamFactory::set_next_protos(next_protos); | 112 HttpStreamFactory::SetNextProtos(next_protos); |
114 } else if (option == kEnableVersionOne) { | 113 } else if (option == kEnableVersionOne) { |
115 spdy::SpdyFramer::set_protocol_version(1); | 114 spdy::SpdyFramer::set_protocol_version(1); |
116 std::vector<std::string> next_protos; | 115 std::vector<std::string> next_protos; |
117 // This is a temporary hack to pretend we support version 1. | 116 // This is a temporary hack to pretend we support version 1. |
118 next_protos.push_back("http/1.1"); | 117 next_protos.push_back("http/1.1"); |
119 next_protos.push_back("spdy/1"); | 118 next_protos.push_back("spdy/1"); |
120 HttpStreamFactory::set_next_protos(next_protos); | 119 HttpStreamFactory::SetNextProtos(next_protos); |
121 } else if (option == kDisableAltProtocols) { | 120 } else if (option == kDisableAltProtocols) { |
122 use_alt_protocols = false; | 121 use_alt_protocols = false; |
123 HttpStreamFactory::set_use_alternate_protocols(false); | 122 HttpStreamFactory::set_use_alternate_protocols(false); |
124 } else if (option == kEnableFlowControl) { | 123 } else if (option == kEnableFlowControl) { |
125 std::vector<std::string> next_protos; | 124 std::vector<std::string> next_protos; |
126 next_protos.push_back("http/1.1"); | 125 next_protos.push_back("http/1.1"); |
127 next_protos.push_back("spdy/2"); | 126 next_protos.push_back("spdy/2"); |
128 next_protos.push_back("spdy/2.1"); | 127 next_protos.push_back("spdy/2.1"); |
129 HttpStreamFactory::set_next_protos(next_protos); | 128 HttpStreamFactory::SetNextProtos(next_protos); |
130 } else if (option == kForceAltProtocols) { | 129 } else if (option == kForceAltProtocols) { |
131 PortAlternateProtocolPair pair; | 130 PortAlternateProtocolPair pair; |
132 pair.port = 443; | 131 pair.port = 443; |
133 pair.protocol = NPN_SPDY_21; | 132 pair.protocol = NPN_SPDY_2; |
134 HttpServerPropertiesImpl::ForceAlternateProtocol(pair); | 133 HttpServerPropertiesImpl::ForceAlternateProtocol(pair); |
135 } else if (option == kSingleDomain) { | 134 } else if (option == kSingleDomain) { |
136 SpdySessionPool::ForceSingleDomain(); | 135 SpdySessionPool::ForceSingleDomain(); |
137 LOG(ERROR) << "FORCING SINGLE DOMAIN"; | 136 LOG(ERROR) << "FORCING SINGLE DOMAIN"; |
138 } else if (option == kInitialMaxConcurrentStreams) { | 137 } else if (option == kInitialMaxConcurrentStreams) { |
139 int streams; | 138 int streams; |
140 if (base::StringToInt(value, &streams) && streams > 0) | 139 if (base::StringToInt(value, &streams) && streams > 0) |
141 SpdySession::set_init_max_concurrent_streams(streams); | 140 SpdySession::set_init_max_concurrent_streams(streams); |
142 } else if (option.empty() && it == spdy_options.begin()) { | 141 } else if (option.empty() && it == spdy_options.begin()) { |
143 continue; | 142 continue; |
(...skipping 26 matching lines...) Expand all Loading... |
170 | 169 |
171 if (session_) | 170 if (session_) |
172 session_->CloseIdleConnections(); | 171 session_->CloseIdleConnections(); |
173 } | 172 } |
174 | 173 |
175 void HttpNetworkLayer::OnResume() { | 174 void HttpNetworkLayer::OnResume() { |
176 suspended_ = false; | 175 suspended_ = false; |
177 } | 176 } |
178 | 177 |
179 } // namespace net | 178 } // namespace net |
OLD | NEW |