Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: chrome/common/common_param_traits.cc

Issue 6357017: Add support for chunked encoding in ChromeFrame for POST requests. This fixes... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome_frame/plugin_url_request.h » ('j') | net/base/upload_data.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/common_param_traits.cc
===================================================================
--- chrome/common/common_param_traits.cc (revision 72508)
+++ chrome/common/common_param_traits.cc (working copy)
@@ -350,8 +350,14 @@
typedef net::UploadData::Element param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.type()));
- if (p.type() == net::UploadData::TYPE_BYTES) {
+ if (p.type() == net::UploadData::TYPE_BYTES ||
+ p.type() == net::UploadData::TYPE_CHUNK) {
m->WriteData(&p.bytes()[0], static_cast<int>(p.bytes().size()));
+ if (p.type() == net::UploadData::TYPE_CHUNK) {
+ // If this element is part of a chunk upload then send over information
+ // indicating if this is the last chunk.
+ WriteParam(m, p.is_last_chunk());
+ }
} else if (p.type() == net::UploadData::TYPE_FILE) {
WriteParam(m, p.file_path());
WriteParam(m, p.file_range_offset());
@@ -365,12 +371,22 @@
int type;
if (!ReadParam(m, iter, &type))
return false;
- if (type == net::UploadData::TYPE_BYTES) {
+ if (type == net::UploadData::TYPE_BYTES ||
+ type == net::UploadData::TYPE_CHUNK) {
const char* data;
int len;
if (!m->ReadData(iter, &data, &len))
return false;
r->SetToBytes(data, len);
+ if (type == net::UploadData::TYPE_CHUNK) {
+ // If this element is part of a chunk upload then we need to explicitly
+ // set the type of the element and whether it is the last chunk.
+ bool is_last_chunk = false;
+ if (!ReadParam(m, iter, &is_last_chunk))
+ return false;
+ r->set_type(net::UploadData::TYPE_CHUNK);
+ r->set_is_last_chunk(is_last_chunk);
+ }
} else if (type == net::UploadData::TYPE_FILE) {
FilePath file_path;
uint64 offset, length;
@@ -405,6 +421,7 @@
if (p) {
WriteParam(m, *p->elements());
WriteParam(m, p->identifier());
+ WriteParam(m, p->is_chunked());
}
}
@@ -422,9 +439,13 @@
int64 identifier;
if (!ReadParam(m, iter, &identifier))
return false;
+ bool is_chunked = false;
+ if (!ReadParam(m, iter, &is_chunked))
+ return false;
*r = new net::UploadData;
(*r)->swap_elements(&elements);
(*r)->set_identifier(identifier);
+ (*r)->set_is_chunked(is_chunked);
return true;
}
« no previous file with comments | « no previous file | chrome_frame/plugin_url_request.h » ('j') | net/base/upload_data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698