| 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> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 transfer_in_progress_ = true; | 149 transfer_in_progress_ = true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Begins the transfer, which must not have already been started. | 152 // Begins the transfer, which must not have already been started. |
| 153 void LibcurlHttpFetcher::BeginTransfer(const std::string& url) { | 153 void LibcurlHttpFetcher::BeginTransfer(const std::string& url) { |
| 154 transfer_size_ = -1; | 154 transfer_size_ = -1; |
| 155 resume_offset_ = 0; | 155 resume_offset_ = 0; |
| 156 retry_count_ = 0; | 156 retry_count_ = 0; |
| 157 no_network_retry_count_ = 0; | 157 no_network_retry_count_ = 0; |
| 158 http_response_code_ = 0; | 158 http_response_code_ = 0; |
| 159 terminate_requested_ = false; |
| 159 ResolveProxiesForUrl(url); | 160 ResolveProxiesForUrl(url); |
| 160 ResumeTransfer(url); | 161 ResumeTransfer(url); |
| 161 CurlPerformOnce(); | 162 CurlPerformOnce(); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void LibcurlHttpFetcher::ForceTransferTermination() { | 165 void LibcurlHttpFetcher::ForceTransferTermination() { |
| 165 CleanUp(); | 166 CleanUp(); |
| 166 if (delegate_) { | 167 if (delegate_) { |
| 167 // Note that after the callback returns this object may be destroyed. | 168 // Note that after the callback returns this object may be destroyed. |
| 168 delegate_->TransferTerminated(this); | 169 delegate_->TransferTerminated(this); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 void LibcurlHttpFetcher::GetHttpResponseCode() { | 441 void LibcurlHttpFetcher::GetHttpResponseCode() { |
| 441 long http_response_code = 0; | 442 long http_response_code = 0; |
| 442 if (curl_easy_getinfo(curl_handle_, | 443 if (curl_easy_getinfo(curl_handle_, |
| 443 CURLINFO_RESPONSE_CODE, | 444 CURLINFO_RESPONSE_CODE, |
| 444 &http_response_code) == CURLE_OK) { | 445 &http_response_code) == CURLE_OK) { |
| 445 http_response_code_ = static_cast<int>(http_response_code); | 446 http_response_code_ = static_cast<int>(http_response_code); |
| 446 } | 447 } |
| 447 } | 448 } |
| 448 | 449 |
| 449 } // namespace chromeos_update_engine | 450 } // namespace chromeos_update_engine |
| OLD | NEW |