Index: util/net/http_multipart_builder.cc |
diff --git a/util/net/http_multipart_builder.cc b/util/net/http_multipart_builder.cc |
index 07dd837fcbb1bf95815ada72543492856f807aea..3f66658c46ee54e54e123f5833d480b35396ac6c 100644 |
--- a/util/net/http_multipart_builder.cc |
+++ b/util/net/http_multipart_builder.cc |
@@ -14,6 +14,7 @@ |
#include "util/net/http_multipart_builder.h" |
+#include <utility> |
#include <vector> |
#include "base/logging.h" |
@@ -152,7 +153,7 @@ scoped_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() { |
std::vector<HTTPBodyStream*> streams; |
for (const auto& pair : form_data_) { |
- std::string field = GetFormDataBoundary(boundary(), pair.first); |
+ std::string field = GetFormDataBoundary(boundary_, pair.first); |
field += kBoundaryCRLF; |
field += pair.second; |
field += kCRLF; |
@@ -161,7 +162,7 @@ scoped_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() { |
for (const auto& pair : file_attachments_) { |
const FileAttachment& attachment = pair.second; |
- std::string header = GetFormDataBoundary(boundary(), pair.first); |
+ std::string header = GetFormDataBoundary(boundary_, pair.first); |
header += base::StringPrintf("; filename=\"%s\"%s", |
attachment.filename.c_str(), kCRLF); |
header += base::StringPrintf("Content-Type: %s%s", |
@@ -173,11 +174,17 @@ scoped_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() { |
} |
streams.push_back( |
- new StringHTTPBodyStream("--" + boundary() + "--" + kCRLF)); |
+ new StringHTTPBodyStream("--" + boundary_ + "--" + kCRLF)); |
return scoped_ptr<HTTPBodyStream>(new CompositeHTTPBodyStream(streams)); |
} |
+HTTPHeaders::value_type HTTPMultipartBuilder::GetContentType() const { |
+ std::string content_type = |
+ base::StringPrintf("multipart/form-data; boundary=%s", boundary_.c_str()); |
+ return std::make_pair(kContentType, content_type); |
+} |
+ |
void HTTPMultipartBuilder::EraseKey(const std::string& key) { |
auto data_it = form_data_.find(key); |
if (data_it != form_data_.end()) |