| 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_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 int rv = RestartNetworkRequest(); | 399 int rv = RestartNetworkRequest(); |
| 400 | 400 |
| 401 if (rv == ERR_IO_PENDING) | 401 if (rv == ERR_IO_PENDING) |
| 402 callback_ = callback; | 402 callback_ = callback; |
| 403 | 403 |
| 404 return rv; | 404 return rv; |
| 405 } | 405 } |
| 406 | 406 |
| 407 int HttpCache::Transaction::RestartWithCertificate( | 407 int HttpCache::Transaction::RestartWithCertificate( |
| 408 X509Certificate* client_cert, | 408 X509Certificate* client_cert, |
| 409 SSLPrivateKey* client_private_key, |
| 409 const CompletionCallback& callback) { | 410 const CompletionCallback& callback) { |
| 410 DCHECK(!callback.is_null()); | 411 DCHECK(!callback.is_null()); |
| 411 | 412 |
| 412 // Ensure that we only have one asynchronous call at a time. | 413 // Ensure that we only have one asynchronous call at a time. |
| 413 DCHECK(callback_.is_null()); | 414 DCHECK(callback_.is_null()); |
| 414 | 415 |
| 415 if (!cache_.get()) | 416 if (!cache_.get()) |
| 416 return ERR_UNEXPECTED; | 417 return ERR_UNEXPECTED; |
| 417 | 418 |
| 418 int rv = RestartNetworkRequestWithCertificate(client_cert); | 419 int rv = |
| 420 RestartNetworkRequestWithCertificate(client_cert, client_private_key); |
| 419 | 421 |
| 420 if (rv == ERR_IO_PENDING) | 422 if (rv == ERR_IO_PENDING) |
| 421 callback_ = callback; | 423 callback_ = callback; |
| 422 | 424 |
| 423 return rv; | 425 return rv; |
| 424 } | 426 } |
| 425 | 427 |
| 426 int HttpCache::Transaction::RestartWithAuth( | 428 int HttpCache::Transaction::RestartWithAuth( |
| 427 const AuthCredentials& credentials, | 429 const AuthCredentials& credentials, |
| 428 const CompletionCallback& callback) { | 430 const CompletionCallback& callback) { |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 DCHECK_EQ(STATE_NONE, next_state_); | 2278 DCHECK_EQ(STATE_NONE, next_state_); |
| 2277 | 2279 |
| 2278 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2280 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| 2279 int rv = network_trans_->RestartIgnoringLastError(io_callback_); | 2281 int rv = network_trans_->RestartIgnoringLastError(io_callback_); |
| 2280 if (rv != ERR_IO_PENDING) | 2282 if (rv != ERR_IO_PENDING) |
| 2281 return DoLoop(rv); | 2283 return DoLoop(rv); |
| 2282 return rv; | 2284 return rv; |
| 2283 } | 2285 } |
| 2284 | 2286 |
| 2285 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( | 2287 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( |
| 2286 X509Certificate* client_cert) { | 2288 X509Certificate* client_cert, |
| 2289 SSLPrivateKey* client_private_key) { |
| 2287 DCHECK(mode_ & WRITE || mode_ == NONE); | 2290 DCHECK(mode_ & WRITE || mode_ == NONE); |
| 2288 DCHECK(network_trans_.get()); | 2291 DCHECK(network_trans_.get()); |
| 2289 DCHECK_EQ(STATE_NONE, next_state_); | 2292 DCHECK_EQ(STATE_NONE, next_state_); |
| 2290 | 2293 |
| 2291 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2294 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| 2292 int rv = network_trans_->RestartWithCertificate(client_cert, io_callback_); | 2295 int rv = network_trans_->RestartWithCertificate( |
| 2296 client_cert, client_private_key, io_callback_); |
| 2293 if (rv != ERR_IO_PENDING) | 2297 if (rv != ERR_IO_PENDING) |
| 2294 return DoLoop(rv); | 2298 return DoLoop(rv); |
| 2295 return rv; | 2299 return rv; |
| 2296 } | 2300 } |
| 2297 | 2301 |
| 2298 int HttpCache::Transaction::RestartNetworkRequestWithAuth( | 2302 int HttpCache::Transaction::RestartNetworkRequestWithAuth( |
| 2299 const AuthCredentials& credentials) { | 2303 const AuthCredentials& credentials) { |
| 2300 DCHECK(mode_ & WRITE || mode_ == NONE); | 2304 DCHECK(mode_ & WRITE || mode_ == NONE); |
| 2301 DCHECK(network_trans_.get()); | 2305 DCHECK(network_trans_.get()); |
| 2302 DCHECK_EQ(STATE_NONE, next_state_); | 2306 DCHECK_EQ(STATE_NONE, next_state_); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2934 default: | 2938 default: |
| 2935 NOTREACHED(); | 2939 NOTREACHED(); |
| 2936 } | 2940 } |
| 2937 } | 2941 } |
| 2938 | 2942 |
| 2939 void HttpCache::Transaction::OnIOComplete(int result) { | 2943 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2940 DoLoop(result); | 2944 DoLoop(result); |
| 2941 } | 2945 } |
| 2942 | 2946 |
| 2943 } // namespace net | 2947 } // namespace net |
| OLD | NEW |