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

Unified Diff: download_action.cc

Issue 3499004: AU: Verify that the actual download size matches the size reported by Omaha. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: extra ; Created 10 years, 3 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 | « action_processor.h ('k') | download_action_unittest.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 9779f2af704686592b527cd11063ec2c8a3016d2..6b277224b59ead8678f026dcfe0e4fabdb6be8d2 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -138,13 +138,18 @@ void DownloadAction::TransferComplete(HttpFetcher *fetcher, bool successful) {
ActionExitCode code =
successful ? kActionCodeSuccess : kActionCodeDownloadTransferError;
if (code == kActionCodeSuccess) {
- // Make sure hash is correct
+ // 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. Expect hash " << install_plan_.download_hash
+ << " 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 | « action_processor.h ('k') | download_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698