From ccf1ac4398aeb300bc3c005640aaf57500488e2d Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Wed, 25 Mar 2009 19:55:08 +0000 Subject: Chrome changes to support cached form submissions. The solution is to add a user-defined identifier to UploadData. If that identifier is set, and if the request method is POST, then HttpCache will enable caching for the response. (The cache key will be a composition of the identifier and the URL.) A subsequent POST request to the same URL with the same identifier will "hit" the previously generated cache entry. Reuse from the cache is subject to all of the standard rules. For reference, here are the corresponding net changes: http://codereview.chromium.org/52028 Here are the corresponding WebKit changes: http://trac.webkit.org/changeset/41919 BUG=2636 R=sky Review URL: http://codereview.chromium.org/52040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12485 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_host/resource_dispatcher_host.cc | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'chrome/browser/renderer_host/resource_dispatcher_host.cc') diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index e8e8d3b..9d4f7bd 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -116,14 +116,16 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type, } // Check if the renderer is permitted to upload the requested files. - const std::vector& uploads = - request_data.upload_content; - std::vector::const_iterator iter; - for (iter = uploads.begin(); iter != uploads.end(); ++iter) { - if (iter->type() == net::UploadData::TYPE_FILE && - !policy->CanUploadFile(process_id, iter->file_path())) { - NOTREACHED() << "Denied unauthorized upload of " << iter->file_path(); - return false; + if (request_data.upload_data) { + const std::vector& uploads = + request_data.upload_data->elements(); + std::vector::const_iterator iter; + for (iter = uploads.begin(); iter != uploads.end(); ++iter) { + if (iter->type() == net::UploadData::TYPE_FILE && + !policy->CanUploadFile(process_id, iter->file_path())) { + NOTREACHED() << "Denied unauthorized upload of " << iter->file_path(); + return false; + } } } @@ -330,11 +332,9 @@ void ResourceDispatcherHost::BeginRequest( // Set upload data. uint64 upload_size = 0; - if (!request_data.upload_content.empty()) { - scoped_refptr upload = new net::UploadData(); - upload->set_elements(request_data.upload_content); // Deep copy. - request->set_upload(upload); - upload_size = upload->GetContentLength(); + if (request_data.upload_data) { + request->set_upload(request_data.upload_data); + upload_size = request_data.upload_data->GetContentLength(); } // Install a CrossSiteResourceHandler if this request is coming from a -- cgit v1.1