Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: net/http/http_network_layer.cc

Issue 9252029: SPDY - default to SPDY/2.1 protocol in unittests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync with trunk Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
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::set_next_protos(next_protos); 105 HttpStreamFactory::set_next_protos(next_protos);
105 } else if (option == kEnableNpnHttpOnly) { 106 } else if (option == kEnableNpnHttpOnly) {
106 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 107 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
107 // and then fallback to http. This introduces extra load. 108 // and then fallback to http. This introduces extra load.
108 HttpStreamFactory::set_use_alternate_protocols(false); 109 HttpStreamFactory::set_use_alternate_protocols(false);
109 std::vector<std::string> next_protos; 110 std::vector<std::string> next_protos;
110 next_protos.push_back("http/1.1"); 111 next_protos.push_back("http/1.1");
111 next_protos.push_back("http1.1"); 112 next_protos.push_back("http1.1");
112 HttpStreamFactory::set_next_protos(next_protos); 113 HttpStreamFactory::set_next_protos(next_protos);
113 } else if (option == kEnableVersionOne) { 114 } else if (option == kEnableVersionOne) {
114 spdy::SpdyFramer::set_protocol_version(1); 115 spdy::SpdyFramer::set_protocol_version(1);
115 std::vector<std::string> next_protos; 116 std::vector<std::string> next_protos;
116 // This is a temporary hack to pretend we support version 1. 117 // This is a temporary hack to pretend we support version 1.
117 next_protos.push_back("http/1.1"); 118 next_protos.push_back("http/1.1");
118 next_protos.push_back("spdy/1"); 119 next_protos.push_back("spdy/1");
119 HttpStreamFactory::set_next_protos(next_protos); 120 HttpStreamFactory::set_next_protos(next_protos);
120 } else if (option == kDisableAltProtocols) { 121 } else if (option == kDisableAltProtocols) {
121 use_alt_protocols = false; 122 use_alt_protocols = false;
122 HttpStreamFactory::set_use_alternate_protocols(false); 123 HttpStreamFactory::set_use_alternate_protocols(false);
123 } else if (option == kEnableFlowControl) { 124 } else if (option == kEnableFlowControl) {
124 std::vector<std::string> next_protos; 125 std::vector<std::string> next_protos;
125 next_protos.push_back("http/1.1"); 126 next_protos.push_back("http/1.1");
126 next_protos.push_back("spdy/2"); 127 next_protos.push_back("spdy/2");
127 next_protos.push_back("spdy/2.1"); 128 next_protos.push_back("spdy/2.1");
128 HttpStreamFactory::set_next_protos(next_protos); 129 HttpStreamFactory::set_next_protos(next_protos);
129 } else if (option == kForceAltProtocols) { 130 } else if (option == kForceAltProtocols) {
130 PortAlternateProtocolPair pair; 131 PortAlternateProtocolPair pair;
131 pair.port = 443; 132 pair.port = 443;
132 pair.protocol = NPN_SPDY_2; 133 pair.protocol = NPN_SPDY_21;
133 HttpServerPropertiesImpl::ForceAlternateProtocol(pair); 134 HttpServerPropertiesImpl::ForceAlternateProtocol(pair);
134 } else if (option == kSingleDomain) { 135 } else if (option == kSingleDomain) {
135 SpdySessionPool::ForceSingleDomain(); 136 SpdySessionPool::ForceSingleDomain();
136 LOG(ERROR) << "FORCING SINGLE DOMAIN"; 137 LOG(ERROR) << "FORCING SINGLE DOMAIN";
137 } else if (option == kInitialMaxConcurrentStreams) { 138 } else if (option == kInitialMaxConcurrentStreams) {
138 int streams; 139 int streams;
139 if (base::StringToInt(value, &streams) && streams > 0) 140 if (base::StringToInt(value, &streams) && streams > 0)
140 SpdySession::set_init_max_concurrent_streams(streams); 141 SpdySession::set_init_max_concurrent_streams(streams);
141 } else if (option.empty() && it == spdy_options.begin()) { 142 } else if (option.empty() && it == spdy_options.begin()) {
142 continue; 143 continue;
(...skipping 26 matching lines...) Expand all
169 170
170 if (session_) 171 if (session_)
171 session_->CloseIdleConnections(); 172 session_->CloseIdleConnections();
172 } 173 }
173 174
174 void HttpNetworkLayer::OnResume() { 175 void HttpNetworkLayer::OnResume() {
175 suspended_ = false; 176 suspended_ = false;
176 } 177 }
177 178
178 } // namespace net 179 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698