summaryrefslogtreecommitdiffstats
path: root/chrome/common/resource_dispatcher.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 19:55:08 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 19:55:08 +0000
commitccf1ac4398aeb300bc3c005640aaf57500488e2d (patch)
tree35eadc64a003ec79f2fc77924f5b92928cede2d0 /chrome/common/resource_dispatcher.cc
parent059292e77d7fcfbf930ccb8cafdaaadd7a505a2e (diff)
downloadchromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.zip
chromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.tar.gz
chromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.tar.bz2
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
Diffstat (limited to 'chrome/common/resource_dispatcher.cc')
-rw-r--r--chrome/common/resource_dispatcher.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index e5c398b..1af4ab1 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -61,6 +61,7 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
virtual void AppendDataToUpload(const char* data, int data_len);
virtual void AppendFileRangeToUpload(const std::wstring& path,
uint64 offset, uint64 length);
+ virtual void SetUploadIdentifier(int64 identifier);
virtual bool Start(Peer* peer);
virtual void Cancel();
virtual void SetDefersLoading(bool value);
@@ -147,16 +148,26 @@ void IPCResourceLoaderBridge::AppendDataToUpload(const char* data,
if (data_len == 0)
return;
- request_.upload_content.push_back(net::UploadData::Element());
- request_.upload_content.back().SetToBytes(data, data_len);
+ if (!request_.upload_data)
+ request_.upload_data = new net::UploadData();
+ request_.upload_data->AppendBytes(data, data_len);
}
void IPCResourceLoaderBridge::AppendFileRangeToUpload(
const std::wstring& path, uint64 offset, uint64 length) {
DCHECK(request_id_ == -1) << "request already started";
- request_.upload_content.push_back(net::UploadData::Element());
- request_.upload_content.back().SetToFilePathRange(path, offset, length);
+ if (!request_.upload_data)
+ request_.upload_data = new net::UploadData();
+ request_.upload_data->AppendFileRange(path, offset, length);
+}
+
+void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) {
+ DCHECK(request_id_ == -1) << "request already started";
+
+ if (!request_.upload_data)
+ request_.upload_data = new net::UploadData();
+ request_.upload_data->set_identifier(identifier);
}
// Writes a footer on the message and sends it