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

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

Issue 9766021: SPDY - Added enabling of SPDY/3 to about:flags. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « chrome/common/chrome_switches.cc ('k') | net/http/http_stream_factory.h » ('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) 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 28 matching lines...) Expand all
39 39
40 // static 40 // static
41 void HttpNetworkLayer::EnableSpdy(const std::string& mode) { 41 void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
42 static const char kOff[] = "off"; 42 static const char kOff[] = "off";
43 static const char kSSL[] = "ssl"; 43 static const char kSSL[] = "ssl";
44 static const char kDisableSSL[] = "no-ssl"; 44 static const char kDisableSSL[] = "no-ssl";
45 static const char kDisablePing[] = "no-ping"; 45 static const char kDisablePing[] = "no-ping";
46 static const char kExclude[] = "exclude"; // Hosts to exclude 46 static const char kExclude[] = "exclude"; // Hosts to exclude
47 static const char kDisableCompression[] = "no-compress"; 47 static const char kDisableCompression[] = "no-compress";
48 static const char kDisableAltProtocols[] = "no-alt-protocols"; 48 static const char kDisableAltProtocols[] = "no-alt-protocols";
49 static const char kEnableVersionThree[] = "v3";
50 static const char kForceAltProtocols[] = "force-alt-protocols"; 49 static const char kForceAltProtocols[] = "force-alt-protocols";
51 static const char kSingleDomain[] = "single-domain"; 50 static const char kSingleDomain[] = "single-domain";
52 51
53 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS
54 // messages are processed and outstanding window size is actually obeyed
55 // when sending data frames, and WINDOW_UPDATE messages are generated
56 // when data is consumed.
57 static const char kEnableFlowControl[] = "flow-control";
58
59 // We want an A/B experiment between SPDY enabled and SPDY disabled, 52 // We want an A/B experiment between SPDY enabled and SPDY disabled,
60 // but only for pages where SPDY *could have been* negotiated. To do 53 // but only for pages where SPDY *could have been* negotiated. To do
61 // this, we use NPN, but prevent it from negotiating SPDY. If the 54 // this, we use NPN, but prevent it from negotiating SPDY. If the
62 // server negotiates HTTP, rather than SPDY, today that will only happen 55 // server negotiates HTTP, rather than SPDY, today that will only happen
63 // on servers that installed NPN (and could have done SPDY). But this is 56 // on servers that installed NPN (and could have done SPDY). But this is
64 // a bit of a hack, as this correlation between NPN and SPDY is not 57 // a bit of a hack, as this correlation between NPN and SPDY is not
65 // really guaranteed. 58 // really guaranteed.
66 static const char kEnableNPN[] = "npn"; 59 static const char kEnableNPN[] = "npn";
67 static const char kEnableNpnHttpOnly[] = "npn-http"; 60 static const char kEnableNpnHttpOnly[] = "npn-http";
68 61
(...skipping 23 matching lines...) Expand all
92 HttpStreamFactory::set_force_spdy_over_ssl(true); 85 HttpStreamFactory::set_force_spdy_over_ssl(true);
93 HttpStreamFactory::set_force_spdy_always(true); 86 HttpStreamFactory::set_force_spdy_always(true);
94 } else if (option == kDisablePing) { 87 } else if (option == kDisablePing) {
95 SpdySession::set_enable_ping_based_connection_checking(false); 88 SpdySession::set_enable_ping_based_connection_checking(false);
96 } else if (option == kExclude) { 89 } else if (option == kExclude) {
97 HttpStreamFactory::add_forced_spdy_exclusion(value); 90 HttpStreamFactory::add_forced_spdy_exclusion(value);
98 } else if (option == kDisableCompression) { 91 } else if (option == kDisableCompression) {
99 spdy::SpdyFramer::set_enable_compression_default(false); 92 spdy::SpdyFramer::set_enable_compression_default(false);
100 } else if (option == kEnableNPN) { 93 } else if (option == kEnableNPN) {
101 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols); 94 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols);
102 std::vector<std::string> next_protos; 95 std::vector<std::string> next_protos;
willchan no longer on Chromium 2012/03/23 00:41:46 Wait, what about these guys?
103 next_protos.push_back("http/1.1"); 96 next_protos.push_back("http/1.1");
104 next_protos.push_back("spdy/2"); 97 next_protos.push_back("spdy/2");
105 HttpStreamFactory::SetNextProtos(next_protos); 98 HttpStreamFactory::SetNextProtos(next_protos);
106 } else if (option == kEnableVersionThree) {
107 std::vector<std::string> next_protos;
108 next_protos.push_back("http/1.1");
109 next_protos.push_back("spdy/2");
110 next_protos.push_back("spdy/2.1");
111 next_protos.push_back("spdy/3");
112 HttpStreamFactory::SetNextProtos(next_protos);
113 } else if (option == kEnableNpnHttpOnly) { 99 } else if (option == kEnableNpnHttpOnly) {
114 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 100 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
115 // and then fallback to http. This introduces extra load. 101 // and then fallback to http. This introduces extra load.
116 HttpStreamFactory::set_use_alternate_protocols(false); 102 HttpStreamFactory::set_use_alternate_protocols(false);
117 std::vector<std::string> next_protos; 103 std::vector<std::string> next_protos;
118 next_protos.push_back("http/1.1"); 104 next_protos.push_back("http/1.1");
119 next_protos.push_back("http1.1"); 105 next_protos.push_back("http1.1");
120 HttpStreamFactory::SetNextProtos(next_protos); 106 HttpStreamFactory::SetNextProtos(next_protos);
121 } else if (option == kDisableAltProtocols) { 107 } else if (option == kDisableAltProtocols) {
122 use_alt_protocols = false; 108 use_alt_protocols = false;
123 HttpStreamFactory::set_use_alternate_protocols(false); 109 HttpStreamFactory::set_use_alternate_protocols(false);
124 } else if (option == kEnableFlowControl) {
125 std::vector<std::string> next_protos;
126 next_protos.push_back("http/1.1");
127 next_protos.push_back("spdy/2");
128 next_protos.push_back("spdy/2.1");
129 HttpStreamFactory::SetNextProtos(next_protos);
130 } else if (option == kForceAltProtocols) { 110 } else if (option == kForceAltProtocols) {
131 PortAlternateProtocolPair pair; 111 PortAlternateProtocolPair pair;
132 pair.port = 443; 112 pair.port = 443;
133 pair.protocol = NPN_SPDY_2; 113 pair.protocol = NPN_SPDY_2;
134 HttpServerPropertiesImpl::ForceAlternateProtocol(pair); 114 HttpServerPropertiesImpl::ForceAlternateProtocol(pair);
135 } else if (option == kSingleDomain) { 115 } else if (option == kSingleDomain) {
136 SpdySessionPool::ForceSingleDomain(); 116 SpdySessionPool::ForceSingleDomain();
137 LOG(ERROR) << "FORCING SINGLE DOMAIN"; 117 LOG(ERROR) << "FORCING SINGLE DOMAIN";
138 } else if (option == kInitialMaxConcurrentStreams) { 118 } else if (option == kInitialMaxConcurrentStreams) {
139 int streams; 119 int streams;
(...skipping 30 matching lines...) Expand all
170 150
171 if (session_) 151 if (session_)
172 session_->CloseIdleConnections(); 152 session_->CloseIdleConnections();
173 } 153 }
174 154
175 void HttpNetworkLayer::OnResume() { 155 void HttpNetworkLayer::OnResume() {
176 suspended_ = false; 156 suspended_ = false;
177 } 157 }
178 158
179 } // namespace net 159 } // namespace net
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | net/http/http_stream_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698