diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-27 00:37:41 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-27 00:37:41 +0000 |
commit | 4670de0e4ab9e02165d2b0d0c24ff9825e5bbff9 (patch) | |
tree | 7f9f84dbf83a84cb570dddd57288cdcac325319e /chrome/browser/renderer_host/resource_dispatcher_host.h | |
parent | 63a73b573200ed543c34625808b4297d7d4a87e1 (diff) | |
download | chromium_src-4670de0e4ab9e02165d2b0d0c24ff9825e5bbff9.zip chromium_src-4670de0e4ab9e02165d2b0d0c24ff9825e5bbff9.tar.gz chromium_src-4670de0e4ab9e02165d2b0d0c24ff9825e5bbff9.tar.bz2 |
Rework SafeBrowsingResourceHandler.
Most notably, don't start the request until the URL has been verified.
The previous behavior was to overlap the retrieval of the request's headers with the URL check.
This meant that cookies from blocked pages got applied, and also that the renderer received the headers for blocked pages, and other awkwardness.
Blocking before the request has started also has the advantage of protecting against malware URLs that might exploit bugs in the HTTP stack itself (as the request is never started).
In terms of performance, overlapping had the benefit that the request gets a head start while the URL is being verified.
In practice I don't think this is actually significant, since we rely on low bloom filter false positives to avoid these extended checks in the first place. Hence optimizing for the uncommon case of extended checks isn't fruitful, especially when it comes at the cost of complexity.
I don't have unit-tests for this yet since there wasn't an existing framework to put them in (apparantly there are no safe browsing unit tests for ResourceDispatcherHost?).
I will follow up with another CL that does the necessary surgery to add such tests in resource_dispatcher_host_unittest.cc.
BUG=33572,36046
TEST=see bugs.
Review URL: http://codereview.chromium.org/661072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/resource_dispatcher_host.h')
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h index c410f3a..121265f 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.h +++ b/chrome/browser/renderer_host/resource_dispatcher_host.h @@ -139,6 +139,9 @@ class ResourceDispatcherHost : public URLRequest::Delegate { bool has_new_first_party_for_cookies, const GURL& new_first_party_for_cookies); + // Starts a request that was deferred during ResourceHandler::OnWillStart(). + void StartDeferredRequest(int process_unique_id, int request_id); + // Returns true if it's ok to send the data. If there are already too many // data messages pending, it pauses the request and returns false. In this // case the caller should not send the data. @@ -318,6 +321,11 @@ class ResourceDispatcherHost : public URLRequest::Delegate { // Helper function for regular and download requests. void BeginRequestInternal(URLRequest* request); + // Helper function that inserts |request| into the resource queue. + void InsertIntoResourceQueue( + URLRequest* request, + const ResourceDispatcherHostRequestInfo& request_info); + // Updates the "cost" of outstanding requests for |process_unique_id|. // The "cost" approximates how many bytes are consumed by all the in-memory // data structures supporting this request (URLRequest object, |