Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: download_action.cc

Issue 3547019: AU: DeltaPerformer performs the download size/hash check now. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « delta_performer_unittest.cc ('k') | prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_action.cc
diff --git a/download_action.cc b/download_action.cc
index 4462ab889da9ae7bf90f0ed55454ffe1e715b92a..b88e44825a3644d4b593838c387d128947a40d8a 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -140,23 +140,28 @@ void DownloadAction::TransferComplete(HttpFetcher *fetcher, bool successful) {
ActionExitCode code =
successful ? kActionCodeSuccess : kActionCodeDownloadTransferError;
if (code == kActionCodeSuccess) {
- // Makes sure the hash and size are correct.
- omaha_hash_calculator_.Finalize();
- if (omaha_hash_calculator_.hash() != install_plan_.download_hash) {
- LOG(ERROR) << "Download of " << install_plan_.download_url
- << " failed. Expected hash " << install_plan_.download_hash
- << " but got hash " << omaha_hash_calculator_.hash();
- code = kActionCodeDownloadHashMismatchError;
- } else if (bytes_received_ != install_plan_.size) {
- LOG(ERROR) << "Download of " << install_plan_.download_url
- << " failed. Expected size " << install_plan_.size
- << " but got size " << bytes_received_;
- code = kActionCodeDownloadSizeMismatchError;
- } else if (!install_plan_.is_full_update &&
- !delta_performer_->VerifyPayload("")) {
- LOG(ERROR) << "Download of " << install_plan_.download_url
- << " failed due to payload verification error.";
- code = kActionCodeDownloadPayloadVerificationError;
+ if (!install_plan_.is_full_update) {
+ if (!delta_performer_->VerifyPayload("",
+ install_plan_.download_hash,
+ install_plan_.size)) {
+ LOG(ERROR) << "Download of " << install_plan_.download_url
+ << " failed due to payload verification error.";
+ code = kActionCodeDownloadPayloadVerificationError;
+ }
+ } else {
+ // Makes sure the hash and size are correct for an old-style full update.
+ omaha_hash_calculator_.Finalize();
+ if (omaha_hash_calculator_.hash() != install_plan_.download_hash) {
+ LOG(ERROR) << "Download of " << install_plan_.download_url
+ << " failed. Expected hash " << install_plan_.download_hash
+ << " but got hash " << omaha_hash_calculator_.hash();
+ code = kActionCodeDownloadHashMismatchError;
+ } else if (bytes_received_ != install_plan_.size) {
+ LOG(ERROR) << "Download of " << install_plan_.download_url
+ << " failed. Expected size " << install_plan_.size
+ << " but got size " << bytes_received_;
+ code = kActionCodeDownloadSizeMismatchError;
+ }
}
}
« no previous file with comments | « delta_performer_unittest.cc ('k') | prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698