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

Unified Diff: net/base/mime_util.cc

Issue 15076008: Move AddMultipartValueForUpload to net/base/mime_util.h/cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 | « net/base/mime_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 67c7242c815b7283ae09d8a65a3713ea9aaa10ff..3212b5c133cb5f16ae192b0d2f86a84ea98d8885 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -987,4 +987,29 @@ bool IsSupportedCertificateMimeType(const std::string& mime_type) {
return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN;
}
+void AddMultipartValueForUpload(const std::string& value_name,
+ const std::string& value,
+ const std::string& mime_boundary,
+ const std::string& content_type,
+ std::string* post_data) {
+ DCHECK(post_data);
+ // First line is the boundary.
+ post_data->append("--" + mime_boundary + "\r\n");
+ // Next line is the Content-disposition.
+ post_data->append("Content-Disposition: form-data; name=\"" +
+ value_name + "\"\r\n");
+ if (!content_type.empty()) {
+ // If Content-type is specified, the next line is that.
+ post_data->append("Content-Type: " + content_type + "\r\n");
+ }
+ // Leave an empty line and append the value.
+ post_data->append("\r\n" + value + "\r\n");
+}
+
+void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
+ std::string* post_data) {
+ DCHECK(post_data);
+ post_data->append("--" + mime_boundary + "--\r\n");
+}
+
} // namespace net
« no previous file with comments | « net/base/mime_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698