| 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_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 // Reset the other member variables. | 282 // Reset the other member variables. |
| 283 ResetStateForAuthRestart(); | 283 ResetStateForAuthRestart(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 bool HttpNetworkTransaction::IsReadyToRestartForAuth() { | 286 bool HttpNetworkTransaction::IsReadyToRestartForAuth() { |
| 287 return pending_auth_target_ != HttpAuth::AUTH_NONE && | 287 return pending_auth_target_ != HttpAuth::AUTH_NONE && |
| 288 HaveAuth(pending_auth_target_); | 288 HaveAuth(pending_auth_target_); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void HttpNetworkTransaction::Orphan(std::unique_ptr<HttpTransaction> trans) { |
| 292 // Orphan is needed to allow HttpCache::Transaction to be orphaned for shared |
| 293 // async operations, but it's consumer can also own HttpNetworkTransaction |
| 294 // for specific use cases like proxy script fetching, so it also needs an |
| 295 // implementation here. |
| 296 trans.reset(); |
| 297 } |
| 298 |
| 291 int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len, | 299 int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len, |
| 292 const CompletionCallback& callback) { | 300 const CompletionCallback& callback) { |
| 293 DCHECK(buf); | 301 DCHECK(buf); |
| 294 DCHECK_LT(0, buf_len); | 302 DCHECK_LT(0, buf_len); |
| 295 | 303 |
| 296 scoped_refptr<HttpResponseHeaders> headers(GetResponseHeaders()); | 304 scoped_refptr<HttpResponseHeaders> headers(GetResponseHeaders()); |
| 297 if (headers_valid_ && headers.get() && stream_request_.get()) { | 305 if (headers_valid_ && headers.get() && stream_request_.get()) { |
| 298 // We're trying to read the body of the response but we're still trying | 306 // We're trying to read the body of the response but we're still trying |
| 299 // to establish an SSL tunnel through an HTTP proxy. We can't read these | 307 // to establish an SSL tunnel through an HTTP proxy. We can't read these |
| 300 // bytes when establishing a tunnel because they might be controlled by | 308 // bytes when establishing a tunnel because they might be controlled by |
| (...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 DCHECK(stream_request_); | 1708 DCHECK(stream_request_); |
| 1701 | 1709 |
| 1702 // Since the transaction can restart with auth credentials, it may create a | 1710 // Since the transaction can restart with auth credentials, it may create a |
| 1703 // stream more than once. Accumulate all of the connection attempts across | 1711 // stream more than once. Accumulate all of the connection attempts across |
| 1704 // those streams by appending them to the vector: | 1712 // those streams by appending them to the vector: |
| 1705 for (const auto& attempt : stream_request_->connection_attempts()) | 1713 for (const auto& attempt : stream_request_->connection_attempts()) |
| 1706 connection_attempts_.push_back(attempt); | 1714 connection_attempts_.push_back(attempt); |
| 1707 } | 1715 } |
| 1708 | 1716 |
| 1709 } // namespace net | 1717 } // namespace net |
| OLD | NEW |