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

Unified Diff: util/net/http_multipart_builder.cc

Issue 692963002: Add HTTPTransport, a Mac implementation, and an end-to-end test. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: For landing Created 6 years, 2 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 | « util/net/http_multipart_builder.h ('k') | util/net/http_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « util/net/http_multipart_builder.h ('k') | util/net/http_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698