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

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

Issue 3195015: Add option to simulate alternate protocol always being present.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 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
OLDNEW
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_util.h" 9 #include "base/string_util.h"
10 #include "net/http/http_network_session.h" 10 #include "net/http/http_network_session.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return session_; 141 return session_;
142 } 142 }
143 143
144 // static 144 // static
145 void HttpNetworkLayer::EnableSpdy(const std::string& mode) { 145 void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
146 static const char kSSL[] = "ssl"; 146 static const char kSSL[] = "ssl";
147 static const char kDisableSSL[] = "no-ssl"; 147 static const char kDisableSSL[] = "no-ssl";
148 static const char kDisableCompression[] = "no-compress"; 148 static const char kDisableCompression[] = "no-compress";
149 static const char kDisableAltProtocols[] = "no-alt-protocols"; 149 static const char kDisableAltProtocols[] = "no-alt-protocols";
150 static const char kEnableVersionOne[] = "v1"; 150 static const char kEnableVersionOne[] = "v1";
151 static const char kForceAltProtocols[] = "force-alt-protocols";
152
151 153
152 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS 154 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS
153 // messages are processed and outstanding window size is actually obeyed 155 // messages are processed and outstanding window size is actually obeyed
154 // when sending data frames, and WINDOW_UPDATE messages are generated 156 // when sending data frames, and WINDOW_UPDATE messages are generated
155 // when data is consumed. 157 // when data is consumed.
156 static const char kEnableFlowControl[] = "flow-control"; 158 static const char kEnableFlowControl[] = "flow-control";
157 159
158 // We want an A/B experiment between SPDY enabled and SPDY disabled, 160 // We want an A/B experiment between SPDY enabled and SPDY disabled,
159 // but only for pages where SPDY *could have been* negotiated. To do 161 // but only for pages where SPDY *could have been* negotiated. To do
160 // this, we use NPN, but prevent it from negotiating SPDY. If the 162 // this, we use NPN, but prevent it from negotiating SPDY. If the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 HttpStreamFactory::set_use_alternate_protocols(false); 205 HttpStreamFactory::set_use_alternate_protocols(false);
204 HttpStreamFactory::set_next_protos(kNpnProtosHttpOnly); 206 HttpStreamFactory::set_next_protos(kNpnProtosHttpOnly);
205 } else if (option == kEnableVersionOne) { 207 } else if (option == kEnableVersionOne) {
206 spdy::SpdyFramer::set_protocol_version(1); 208 spdy::SpdyFramer::set_protocol_version(1);
207 HttpStreamFactory::set_next_protos(kNpnProtosFullV1); 209 HttpStreamFactory::set_next_protos(kNpnProtosFullV1);
208 } else if (option == kDisableAltProtocols) { 210 } else if (option == kDisableAltProtocols) {
209 use_alt_protocols = false; 211 use_alt_protocols = false;
210 HttpStreamFactory::set_use_alternate_protocols(false); 212 HttpStreamFactory::set_use_alternate_protocols(false);
211 } else if (option == kEnableFlowControl) { 213 } else if (option == kEnableFlowControl) {
212 SpdySession::SetFlowControl(true); 214 SpdySession::SetFlowControl(true);
215 } else if (option == kForceAltProtocols) {
216 HttpAlternateProtocols::PortProtocolPair pair;
217 pair.port = 443;
218 pair.protocol = HttpAlternateProtocols::NPN_SPDY_2;
219 HttpAlternateProtocols::ForceAlternateProtocol(pair);
213 } else if (option.empty() && it == spdy_options.begin()) { 220 } else if (option.empty() && it == spdy_options.begin()) {
214 continue; 221 continue;
215 } else { 222 } else {
216 LOG(DFATAL) << "Unrecognized spdy option: " << option; 223 LOG(DFATAL) << "Unrecognized spdy option: " << option;
217 } 224 }
218 } 225 }
219 } 226 }
220 } // namespace net 227 } // namespace net
OLDNEW
« net/http/http_alternate_protocols.cc ('K') | « net/http/http_alternate_protocols_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698