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