| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "update_engine/libcurl_http_fetcher.h" | 5 #include "update_engine/libcurl_http_fetcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include <base/logging.h> | 10 #include <base/logging.h> |
| 11 | 11 |
| 12 #include "update_engine/dbus_interface.h" | 12 #include "update_engine/dbus_interface.h" |
| 13 #include "update_engine/flimflam_proxy.h" | 13 #include "update_engine/flimflam_proxy.h" |
| 14 #include "update_engine/utils.h" | 14 #include "update_engine/utils.h" |
| 15 | 15 |
| 16 using std::max; | 16 using std::max; |
| 17 using std::make_pair; | 17 using std::make_pair; |
| 18 using std::string; | 18 using std::string; |
| 19 | 19 |
| 20 // This is a concrete implementation of HttpFetcher that uses libcurl to do the | 20 // This is a concrete implementation of HttpFetcher that uses libcurl to do the |
| 21 // http work. | 21 // http work. |
| 22 | 22 |
| 23 namespace chromeos_update_engine { | 23 namespace chromeos_update_engine { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 const int kMaxRetriesCount = 20; | 26 const int kMaxRetriesCount = 20; |
| 27 const char kCACertificatesPath[] = "/usr/share/update_engine/ca-certificates"; | 27 const char kCACertificatesPath[] = "/usr/share/chromeos-ca-certificates"; |
| 28 } // namespace {} | 28 } // namespace {} |
| 29 | 29 |
| 30 LibcurlHttpFetcher::~LibcurlHttpFetcher() { | 30 LibcurlHttpFetcher::~LibcurlHttpFetcher() { |
| 31 LOG_IF(ERROR, transfer_in_progress_) | 31 LOG_IF(ERROR, transfer_in_progress_) |
| 32 << "Destroying the fetcher while a transfer is in progress."; | 32 << "Destroying the fetcher while a transfer is in progress."; |
| 33 CleanUp(); | 33 CleanUp(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // On error, returns false. | 36 // On error, returns false. |
| 37 bool LibcurlHttpFetcher::ConnectionIsExpensive() const { | 37 bool LibcurlHttpFetcher::ConnectionIsExpensive() const { |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 void LibcurlHttpFetcher::GetHttpResponseCode() { | 379 void LibcurlHttpFetcher::GetHttpResponseCode() { |
| 380 long http_response_code = 0; | 380 long http_response_code = 0; |
| 381 if (curl_easy_getinfo(curl_handle_, | 381 if (curl_easy_getinfo(curl_handle_, |
| 382 CURLINFO_RESPONSE_CODE, | 382 CURLINFO_RESPONSE_CODE, |
| 383 &http_response_code) == CURLE_OK) { | 383 &http_response_code) == CURLE_OK) { |
| 384 http_response_code_ = static_cast<int>(http_response_code); | 384 http_response_code_ = static_cast<int>(http_response_code); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace chromeos_update_engine | 388 } // namespace chromeos_update_engine |
| OLD | NEW |