diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 20:22:17 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 20:22:17 +0000 |
commit | 3c3f4ac55dfce051c2530ba8e014db89b559f9e1 (patch) | |
tree | 43712ea7915f3866b4dd0b7db85da74e2d97d825 /chrome/browser/safe_browsing | |
parent | dc714a8fc38ee88f330094cff5c76106542b00fa (diff) | |
download | chromium_src-3c3f4ac55dfce051c2530ba8e014db89b559f9e1.zip chromium_src-3c3f4ac55dfce051c2530ba8e014db89b559f9e1.tar.gz chromium_src-3c3f4ac55dfce051c2530ba8e014db89b559f9e1.tar.bz2 |
Fix for Debug crasher in safe browsing updater.
BUG= 20411
TEST= none
Review URL: http://codereview.chromium.org/463047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.cc | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index e27b46b..42c6158 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -22,6 +22,7 @@ #include "chrome/common/env_vars.h" #include "net/base/escape.h" #include "net/base/load_flags.h" +#include "net/url_request/url_request_status.h" using base::Time; using base::TimeDelta; @@ -221,10 +222,15 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( if (re_key) HandleReKey(); } - } else if (response_code >= 300) { + } else { HandleGetHashError(Time::Now()); - SB_DLOG(INFO) << "SafeBrowsing GetHash request for: " << source->url() - << ", failed with error: " << response_code; + if (status.status() == URLRequestStatus::FAILED) { + SB_DLOG(INFO) << "SafeBrowsing GetHash request for: " << source->url() + << " failed with os error: " << status.os_error(); + } else { + SB_DLOG(INFO) << "SafeBrowsing GetHash request for: " << source->url() + << " failed with error: " << response_code; + } } // Call back the SafeBrowsingService with full_hashes, even if there was a @@ -286,15 +292,19 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( NOTREACHED(); break; } - - } else if (response_code >= 300) { - // The SafeBrowsing service error: back off. + } else { + // The SafeBrowsing service error, or very bad response code: back off. must_back_off = true; if (request_type_ == CHUNK_REQUEST) chunk_request_urls_.clear(); UpdateFinished(false); - SB_DLOG(INFO) << "SafeBrowsing request for: " << source->url() - << ", failed with error: " << response_code; + if (status.status() == URLRequestStatus::FAILED) { + SB_DLOG(INFO) << "SafeBrowsing request for: " << source->url() + << " failed with os error: " << status.os_error(); + } else { + SB_DLOG(INFO) << "SafeBrowsing request for: " << source->url() + << " failed with error: " << response_code; + } } } @@ -533,10 +543,9 @@ void SafeBrowsingProtocolManager::IssueKeyRequest() { void SafeBrowsingProtocolManager::OnGetChunksComplete( const std::vector<SBListChunkRanges>& lists, bool database_error) { DCHECK(request_type_ == UPDATE_REQUEST); - if (database_error) { - ScheduleNextUpdate(false); UpdateFinished(false); + ScheduleNextUpdate(false); return; } @@ -590,8 +599,8 @@ void SafeBrowsingProtocolManager::OnGetChunksComplete( void SafeBrowsingProtocolManager::UpdateResponseTimeout() { DCHECK(request_type_ == UPDATE_REQUEST); request_.reset(); - ScheduleNextUpdate(false); UpdateFinished(false); + ScheduleNextUpdate(false); } void SafeBrowsingProtocolManager::OnChunkInserted() { |