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 28 matching lines...) Expand all Loading... | |
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 Loading... | |
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 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); | |
Ryan Hamilton
2012/03/10 03:23:02
I don't think this belongs here. The default_pro
ramant (doing other things)
2012/03/10 19:45:29
+1. Will test chrome when kEnableNpnHttpOnly, kDis
| |
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); | |
105 } else if (option == kEnableNpnHttpOnly) { | 113 } else if (option == kEnableNpnHttpOnly) { |
106 // Avoid alternate protocol in this case. Otherwise, browser will try SSL | 114 // Avoid alternate protocol in this case. Otherwise, browser will try SSL |
107 // and then fallback to http. This introduces extra load. | 115 // and then fallback to http. This introduces extra load. |
108 HttpStreamFactory::set_use_alternate_protocols(false); | 116 HttpStreamFactory::set_use_alternate_protocols(false); |
109 std::vector<std::string> next_protos; | 117 std::vector<std::string> next_protos; |
110 next_protos.push_back("http/1.1"); | 118 next_protos.push_back("http/1.1"); |
111 next_protos.push_back("http1.1"); | 119 next_protos.push_back("http1.1"); |
112 HttpStreamFactory::SetNextProtos(next_protos); | 120 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) { | 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::SetNextProtos(next_protos); | 129 HttpStreamFactory::SetNextProtos(next_protos); |
129 } else if (option == kForceAltProtocols) { | 130 } else if (option == kForceAltProtocols) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |