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

Unified Diff: chrome_frame/urlmon_url_request.cc

Issue 10861036: net: Remove UploadElement::TYPE_CHUNK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused UploadElement::set_type() Created 8 years, 4 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 | content/public/common/common_param_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/urlmon_url_request.cc
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index 61b9636d1b479da8ed30240f30dbe9f603159bd0..b2ed8c7bc34c68d178fccd5c569a330ffd0559ce 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -1074,6 +1074,31 @@ void UrlmonUrlRequestManager::StartRequestHelper(
new_request = created_request;
}
+ // Format upload data if it's chunked.
+ if (request_info.upload_data && request_info.upload_data->is_chunked()) {
+ std::vector<net::UploadElement>* elements =
+ request_info.upload_data->elements_mutable();
+ for (size_t i = 0; i < elements->size(); ++i) {
+ net::UploadElement* element = &(*elements)[i];
+ DCHECK(element->type() == net::UploadElement::TYPE_BYTES);
+ std::string chunk_length = StringPrintf(
+ "%X\r\n", static_cast<unsigned int>(element->bytes_length()));
+ std::vector<char> bytes;
+ bytes.insert(bytes.end(), chunk_length.data(),
+ chunk_length.data() + chunk_length.length());
+ const char* data = element->bytes();
+ bytes.insert(bytes.end(), data, data + element->bytes_length());
+ const char* crlf = "\r\n";
+ bytes.insert(bytes.end(), crlf, crlf + strlen(crlf));
+ if (i == elements->size() - 1) {
+ const char* end_of_data = "0\r\n\r\n";
+ bytes.insert(bytes.end(), end_of_data,
+ end_of_data + strlen(end_of_data));
+ }
+ element->SetToBytes(&bytes[0], static_cast<int>(bytes.size()));
+ }
+ }
+
new_request->Initialize(static_cast<PluginUrlRequestDelegate*>(this),
request_id,
request_info.url,
« no previous file with comments | « no previous file | content/public/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698