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/chrome_proxy_resolver.h" | 12 #include "update_engine/chrome_proxy_resolver.h" |
13 #include "update_engine/dbus_interface.h" | 13 #include "update_engine/dbus_interface.h" |
14 #include "update_engine/flimflam_proxy.h" | 14 #include "update_engine/flimflam_proxy.h" |
15 #include "update_engine/utils.h" | 15 #include "update_engine/utils.h" |
16 | 16 |
17 using std::max; | 17 using std::max; |
18 using std::make_pair; | 18 using std::make_pair; |
19 using std::string; | 19 using std::string; |
20 | 20 |
21 // This is a concrete implementation of HttpFetcher that uses libcurl to do the | 21 // This is a concrete implementation of HttpFetcher that uses libcurl to do the |
22 // http work. | 22 // http work. |
23 | 23 |
24 namespace chromeos_update_engine { | 24 namespace chromeos_update_engine { |
25 | 25 |
26 namespace { | 26 namespace { |
27 const int kMaxRetriesCount = 20; | 27 const int kMaxRetriesCount = 20; |
28 const int kNoNetworkRetrySeconds = 30; | 28 const int kNoNetworkRetrySeconds = 10; |
29 const char kCACertificatesPath[] = "/usr/share/chromeos-ca-certificates"; | 29 const char kCACertificatesPath[] = "/usr/share/chromeos-ca-certificates"; |
30 } // namespace {} | 30 } // namespace {} |
31 | 31 |
32 LibcurlHttpFetcher::~LibcurlHttpFetcher() { | 32 LibcurlHttpFetcher::~LibcurlHttpFetcher() { |
33 LOG_IF(ERROR, transfer_in_progress_) | 33 LOG_IF(ERROR, transfer_in_progress_) |
34 << "Destroying the fetcher while a transfer is in progress."; | 34 << "Destroying the fetcher while a transfer is in progress."; |
35 CleanUp(); | 35 CleanUp(); |
36 } | 36 } |
37 | 37 |
38 // On error, returns false. | 38 // On error, returns false. |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 void LibcurlHttpFetcher::GetHttpResponseCode() { | 439 void LibcurlHttpFetcher::GetHttpResponseCode() { |
440 long http_response_code = 0; | 440 long http_response_code = 0; |
441 if (curl_easy_getinfo(curl_handle_, | 441 if (curl_easy_getinfo(curl_handle_, |
442 CURLINFO_RESPONSE_CODE, | 442 CURLINFO_RESPONSE_CODE, |
443 &http_response_code) == CURLE_OK) { | 443 &http_response_code) == CURLE_OK) { |
444 http_response_code_ = static_cast<int>(http_response_code); | 444 http_response_code_ = static_cast<int>(http_response_code); |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 } // namespace chromeos_update_engine | 448 } // namespace chromeos_update_engine |
OLD | NEW |