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 25 matching lines...) Expand all Loading... | |
36 #include "net/base/upload_data_stream.h" | 36 #include "net/base/upload_data_stream.h" |
37 #include "net/cert/cert_status_flags.h" | 37 #include "net/cert/cert_status_flags.h" |
38 #include "net/cert/x509_certificate.h" | 38 #include "net/cert/x509_certificate.h" |
39 #include "net/disk_cache/disk_cache.h" | 39 #include "net/disk_cache/disk_cache.h" |
40 #include "net/http/disk_based_cert_cache.h" | 40 #include "net/http/disk_based_cert_cache.h" |
41 #include "net/http/http_network_session.h" | 41 #include "net/http/http_network_session.h" |
42 #include "net/http/http_request_info.h" | 42 #include "net/http/http_request_info.h" |
43 #include "net/http/http_util.h" | 43 #include "net/http/http_util.h" |
44 #include "net/ssl/ssl_cert_request_info.h" | 44 #include "net/ssl/ssl_cert_request_info.h" |
45 #include "net/ssl/ssl_config_service.h" | 45 #include "net/ssl/ssl_config_service.h" |
46 #include "net/ssl/ssl_private_key.h" | |
davidben
2015/09/25 20:10:11
Not necessary
svaldez
2015/09/28 16:54:52
Done.
| |
46 | 47 |
47 using base::Time; | 48 using base::Time; |
48 using base::TimeDelta; | 49 using base::TimeDelta; |
49 using base::TimeTicks; | 50 using base::TimeTicks; |
50 | 51 |
51 namespace net { | 52 namespace net { |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 // TODO(ricea): Move this to HttpResponseHeaders once it is standardised. | 56 // TODO(ricea): Move this to HttpResponseHeaders once it is standardised. |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 int rv = RestartNetworkRequest(); | 400 int rv = RestartNetworkRequest(); |
400 | 401 |
401 if (rv == ERR_IO_PENDING) | 402 if (rv == ERR_IO_PENDING) |
402 callback_ = callback; | 403 callback_ = callback; |
403 | 404 |
404 return rv; | 405 return rv; |
405 } | 406 } |
406 | 407 |
407 int HttpCache::Transaction::RestartWithCertificate( | 408 int HttpCache::Transaction::RestartWithCertificate( |
408 X509Certificate* client_cert, | 409 X509Certificate* client_cert, |
410 SSLPrivateKey* client_pkey, | |
409 const CompletionCallback& callback) { | 411 const CompletionCallback& callback) { |
410 DCHECK(!callback.is_null()); | 412 DCHECK(!callback.is_null()); |
411 | 413 |
412 // Ensure that we only have one asynchronous call at a time. | 414 // Ensure that we only have one asynchronous call at a time. |
413 DCHECK(callback_.is_null()); | 415 DCHECK(callback_.is_null()); |
414 | 416 |
415 if (!cache_.get()) | 417 if (!cache_.get()) |
416 return ERR_UNEXPECTED; | 418 return ERR_UNEXPECTED; |
417 | 419 |
418 int rv = RestartNetworkRequestWithCertificate(client_cert); | 420 int rv = RestartNetworkRequestWithCertificate(client_cert, client_pkey); |
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_pkey) { | |
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(client_cert, client_pkey, |
2296 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 |