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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 DCHECK_EQ(STATE_NONE, next_state_); | 2291 DCHECK_EQ(STATE_NONE, next_state_); |
2290 | 2292 |
2291 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2293 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2292 int rv = network_trans_->RestartIgnoringLastError(io_callback_); | 2294 int rv = network_trans_->RestartIgnoringLastError(io_callback_); |
2293 if (rv != ERR_IO_PENDING) | 2295 if (rv != ERR_IO_PENDING) |
2294 return DoLoop(rv); | 2296 return DoLoop(rv); |
2295 return rv; | 2297 return rv; |
2296 } | 2298 } |
2297 | 2299 |
2298 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( | 2300 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( |
2299 X509Certificate* client_cert) { | 2301 X509Certificate* client_cert, |
| 2302 SSLPrivateKey* client_private_key) { |
2300 DCHECK(mode_ & WRITE || mode_ == NONE); | 2303 DCHECK(mode_ & WRITE || mode_ == NONE); |
2301 DCHECK(network_trans_.get()); | 2304 DCHECK(network_trans_.get()); |
2302 DCHECK_EQ(STATE_NONE, next_state_); | 2305 DCHECK_EQ(STATE_NONE, next_state_); |
2303 | 2306 |
2304 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2307 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2305 int rv = network_trans_->RestartWithCertificate(client_cert, io_callback_); | 2308 int rv = network_trans_->RestartWithCertificate( |
| 2309 client_cert, client_private_key, io_callback_); |
2306 if (rv != ERR_IO_PENDING) | 2310 if (rv != ERR_IO_PENDING) |
2307 return DoLoop(rv); | 2311 return DoLoop(rv); |
2308 return rv; | 2312 return rv; |
2309 } | 2313 } |
2310 | 2314 |
2311 int HttpCache::Transaction::RestartNetworkRequestWithAuth( | 2315 int HttpCache::Transaction::RestartNetworkRequestWithAuth( |
2312 const AuthCredentials& credentials) { | 2316 const AuthCredentials& credentials) { |
2313 DCHECK(mode_ & WRITE || mode_ == NONE); | 2317 DCHECK(mode_ & WRITE || mode_ == NONE); |
2314 DCHECK(network_trans_.get()); | 2318 DCHECK(network_trans_.get()); |
2315 DCHECK_EQ(STATE_NONE, next_state_); | 2319 DCHECK_EQ(STATE_NONE, next_state_); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 default: | 2953 default: |
2950 NOTREACHED(); | 2954 NOTREACHED(); |
2951 } | 2955 } |
2952 } | 2956 } |
2953 | 2957 |
2954 void HttpCache::Transaction::OnIOComplete(int result) { | 2958 void HttpCache::Transaction::OnIOComplete(int result) { |
2955 DoLoop(result); | 2959 DoLoop(result); |
2956 } | 2960 } |
2957 | 2961 |
2958 } // namespace net | 2962 } // namespace net |
OLD | NEW |