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

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

Issue 9618002: SPDY - integration of spdy/3 code. (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
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 kEnableVersionOne[] = "v1"; 49 static const char kEnableVersionThree[] = "v3";
50 static const char kForceAltProtocols[] = "force-alt-protocols"; 50 static const char kForceAltProtocols[] = "force-alt-protocols";
51 static const char kSingleDomain[] = "single-domain"; 51 static const char kSingleDomain[] = "single-domain";
52 52
53 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS 53 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS
54 // messages are processed and outstanding window size is actually obeyed 54 // messages are processed and outstanding window size is actually obeyed
55 // when sending data frames, and WINDOW_UPDATE messages are generated 55 // when sending data frames, and WINDOW_UPDATE messages are generated
56 // when data is consumed. 56 // when data is consumed.
57 static const char kEnableFlowControl[] = "flow-control"; 57 static const char kEnableFlowControl[] = "flow-control";
58 58
59 // We want an A/B experiment between SPDY enabled and SPDY disabled, 59 // We want an A/B experiment between SPDY enabled and SPDY disabled,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 HttpStreamFactory::SetNextProtos(next_protos); 104 HttpStreamFactory::SetNextProtos(next_protos);
105 } else if (option == kEnableVersionThree) {
106 std::vector<std::string> next_protos;
107 next_protos.push_back("http/1.1");
108 next_protos.push_back("spdy/2");
Ryan Hamilton 2012/03/09 19:09:58 Why is spdy/2.1 not in this list?
ramant (doing other things) 2012/03/10 01:14:09 I thought if we enable spdy/3, we will disable spd
109 next_protos.push_back("spdy/3");
110 HttpStreamFactory::SetNextProtos(next_protos);
105 } else if (option == kEnableNpnHttpOnly) { 111 } else if (option == kEnableNpnHttpOnly) {
106 // Avoid alternate protocol in this case. Otherwise, browser will try SSL 112 // Avoid alternate protocol in this case. Otherwise, browser will try SSL
107 // and then fallback to http. This introduces extra load. 113 // and then fallback to http. This introduces extra load.
108 HttpStreamFactory::set_use_alternate_protocols(false); 114 HttpStreamFactory::set_use_alternate_protocols(false);
109 std::vector<std::string> next_protos; 115 std::vector<std::string> next_protos;
110 next_protos.push_back("http/1.1"); 116 next_protos.push_back("http/1.1");
111 next_protos.push_back("http1.1"); 117 next_protos.push_back("http1.1");
112 HttpStreamFactory::SetNextProtos(next_protos); 118 HttpStreamFactory::SetNextProtos(next_protos);
113 } else if (option == kEnableVersionOne) {
114 spdy::SpdyFramer::set_protocol_version(1);
115 std::vector<std::string> next_protos;
116 // This is a temporary hack to pretend we support version 1.
117 next_protos.push_back("http/1.1");
118 next_protos.push_back("spdy/1");
119 HttpStreamFactory::SetNextProtos(next_protos);
120 } else if (option == kDisableAltProtocols) { 119 } else if (option == kDisableAltProtocols) {
121 use_alt_protocols = false; 120 use_alt_protocols = false;
122 HttpStreamFactory::set_use_alternate_protocols(false); 121 HttpStreamFactory::set_use_alternate_protocols(false);
123 } else if (option == kEnableFlowControl) { 122 } else if (option == kEnableFlowControl) {
124 std::vector<std::string> next_protos; 123 std::vector<std::string> next_protos;
125 next_protos.push_back("http/1.1"); 124 next_protos.push_back("http/1.1");
126 next_protos.push_back("spdy/2"); 125 next_protos.push_back("spdy/2");
127 next_protos.push_back("spdy/2.1"); 126 next_protos.push_back("spdy/2.1");
128 HttpStreamFactory::SetNextProtos(next_protos); 127 HttpStreamFactory::SetNextProtos(next_protos);
129 } else if (option == kForceAltProtocols) { 128 } else if (option == kForceAltProtocols) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 168
170 if (session_) 169 if (session_)
171 session_->CloseIdleConnections(); 170 session_->CloseIdleConnections();
172 } 171 }
173 172
174 void HttpNetworkLayer::OnResume() { 173 void HttpNetworkLayer::OnResume() {
175 suspended_ = false; 174 suspended_ = false;
176 } 175 }
177 176
178 } // namespace net 177 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698