| OLD | NEW |
| 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/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" |
| 11 #include "net/http/http_network_session.h" | 11 #include "net/http/http_network_session.h" |
| 12 #include "net/http/http_network_transaction.h" | 12 #include "net/http/http_network_transaction.h" |
| 13 #include "net/socket/sctp_support.h" |
| 13 #include "net/spdy/spdy_framer.h" | 14 #include "net/spdy/spdy_framer.h" |
| 14 #include "net/spdy/spdy_session.h" | 15 #include "net/spdy/spdy_session.h" |
| 15 #include "net/spdy/spdy_session_pool.h" | 16 #include "net/spdy/spdy_session_pool.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 //----------------------------------------------------------------------------- | 20 //----------------------------------------------------------------------------- |
| 20 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) | 21 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) |
| 21 : session_(session), | 22 : session_(session), |
| 22 suspended_(false) { | 23 suspended_(false) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 SpdySessionPool::ForceSingleDomain(); | 128 SpdySessionPool::ForceSingleDomain(); |
| 128 LOG(ERROR) << "FORCING SINGLE DOMAIN"; | 129 LOG(ERROR) << "FORCING SINGLE DOMAIN"; |
| 129 } else if (option.empty() && it == spdy_options.begin()) { | 130 } else if (option.empty() && it == spdy_options.begin()) { |
| 130 continue; | 131 continue; |
| 131 } else { | 132 } else { |
| 132 LOG(DFATAL) << "Unrecognized spdy option: " << option; | 133 LOG(DFATAL) << "Unrecognized spdy option: " << option; |
| 133 } | 134 } |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 | 137 |
| 138 void HttpNetworkLayer::EnableSctp(const std::string& sctp_mode) { |
| 139 static const char kSctpControlStream[] = "control-stream"; |
| 140 static const char kNoSctpControlStream[] = "no-control-stream"; |
| 141 |
| 142 set_sctp_enabled(); |
| 143 if (sctp_mode == kSctpControlStream) { |
| 144 set_sctp_control_stream_enabled(); |
| 145 } else if (sctp_mode == kNoSctpControlStream || sctp_mode == "") { |
| 146 // noop |
| 147 } else { |
| 148 LOG(WARNING) << "Invalid SCTP mode -> " << sctp_mode << ". Defaulting to " |
| 149 << "mode = no-control-stream."; |
| 150 } |
| 151 } |
| 152 |
| 137 //----------------------------------------------------------------------------- | 153 //----------------------------------------------------------------------------- |
| 138 | 154 |
| 139 int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { | 155 int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { |
| 140 if (suspended_) | 156 if (suspended_) |
| 141 return ERR_NETWORK_IO_SUSPENDED; | 157 return ERR_NETWORK_IO_SUSPENDED; |
| 142 | 158 |
| 143 trans->reset(new HttpNetworkTransaction(GetSession())); | 159 trans->reset(new HttpNetworkTransaction(GetSession())); |
| 144 return OK; | 160 return OK; |
| 145 } | 161 } |
| 146 | 162 |
| 147 HttpCache* HttpNetworkLayer::GetCache() { | 163 HttpCache* HttpNetworkLayer::GetCache() { |
| 148 return NULL; | 164 return NULL; |
| 149 } | 165 } |
| 150 | 166 |
| 151 HttpNetworkSession* HttpNetworkLayer::GetSession() { | 167 HttpNetworkSession* HttpNetworkLayer::GetSession() { |
| 152 return session_; | 168 return session_; |
| 153 } | 169 } |
| 154 | 170 |
| 155 void HttpNetworkLayer::Suspend(bool suspend) { | 171 void HttpNetworkLayer::Suspend(bool suspend) { |
| 156 suspended_ = suspend; | 172 suspended_ = suspend; |
| 157 | 173 |
| 158 if (suspend && session_) | 174 if (suspend && session_) |
| 159 session_->CloseIdleConnections(); | 175 session_->CloseIdleConnections(); |
| 160 } | 176 } |
| 161 | 177 |
| 162 } // namespace net | 178 } // namespace net |
| OLD | NEW |