summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 02:05:09 +0000
committerpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 02:05:09 +0000
commit8b02bb8ac872a708da61332fa80fa6da0e162f03 (patch)
treef003cefdb51e21628157cc6848a04879201e1992 /chrome/browser/safe_browsing
parentf7eafd723ab7640c81ddb2309620bcc7963fe66d (diff)
downloadchromium_src-8b02bb8ac872a708da61332fa80fa6da0e162f03.zip
chromium_src-8b02bb8ac872a708da61332fa80fa6da0e162f03.tar.gz
chromium_src-8b02bb8ac872a708da61332fa80fa6da0e162f03.tar.bz2
Change the detection of the list name from parsing a URL
to storing it from the update in order to avoid breaking due to changes in the format. Review URL: http://codereview.chromium.org/7851 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc14
-rw-r--r--chrome/browser/safe_browsing/protocol_parser.cc1
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util.h1
3 files changed, 3 insertions, 13 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index caf2400..eeb1889 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -306,18 +306,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url,
break;
}
case CHUNK_REQUEST: {
- // Find list name from url.
- std::string url_path = url.ExtractFileName();
- if (url_path.empty())
- return false;
-
- std::string::size_type pos = url_path.find_first_of('_');
- if (pos == std::string::npos)
- return false;
-
const ChunkUrl chunk_url = chunk_request_urls_.front();
- DCHECK(url.spec().find(chunk_url.url) != std::string::npos);
-
bool re_key = false;
std::deque<SBChunk>* chunks = new std::deque<SBChunk>;
if (!parser.ParseChunk(data, length,
@@ -347,8 +336,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url,
delete chunks;
} else {
chunk_pending_to_write_ = true;
- std::string list_name(url_path, 0, pos);
- sb_service_->HandleChunk(list_name, chunks);
+ sb_service_->HandleChunk(chunk_url.list_name, chunks);
}
break;
diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc
index d1391c2..dcfd247 100644
--- a/chrome/browser/safe_browsing/protocol_parser.cc
+++ b/chrome/browser/safe_browsing/protocol_parser.cc
@@ -214,6 +214,7 @@ bool SafeBrowsingProtocolParser::ParseUpdate(
ChunkUrl chunk_url;
chunk_url.url = redirect_url;
+ chunk_url.list_name = list_name;
if (!key.empty())
chunk_url.mac = mac;
chunk_urls->push_back(chunk_url);
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h
index ec2f43d..3d8cfb7 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.h
+++ b/chrome/browser/safe_browsing/safe_browsing_util.h
@@ -34,6 +34,7 @@ class SBEntry;
typedef struct {
std::string url;
std::string mac;
+ std::string list_name;
} ChunkUrl;
// A truncated hash's type.