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

Unified Diff: third_party/crashpad/crashpad/util/net/http_multipart_builder.cc

Issue 2710663006: Update Crashpad to 4a2043ea65e2641ef1a921801c0aaa15ada02fc7 (Closed)
Patch Set: Update Crashpad to 4a2043ea65e2 Created 3 years, 10 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
Index: third_party/crashpad/crashpad/util/net/http_multipart_builder.cc
diff --git a/third_party/crashpad/crashpad/util/net/http_multipart_builder.cc b/third_party/crashpad/crashpad/util/net/http_multipart_builder.cc
index 46f6f09099c9556e2f6e96f83496619f22b7a0c4..640d540a6ed0d889b378c76cb491a6aad454b626 100644
--- a/third_party/crashpad/crashpad/util/net/http_multipart_builder.cc
+++ b/third_party/crashpad/crashpad/util/net/http_multipart_builder.cc
@@ -23,6 +23,7 @@
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "util/net/http_body.h"
+#include "util/net/http_body_gzip.h"
namespace crashpad {
@@ -116,12 +117,18 @@ void AssertSafeMIMEType(const std::string& string) {
} // namespace
HTTPMultipartBuilder::HTTPMultipartBuilder()
- : boundary_(GenerateBoundaryString()), form_data_(), file_attachments_() {
-}
+ : boundary_(GenerateBoundaryString()),
+ form_data_(),
+ file_attachments_(),
+ gzip_enabled_(false) {}
HTTPMultipartBuilder::~HTTPMultipartBuilder() {
}
+void HTTPMultipartBuilder::SetGzipEnabled(bool gzip_enabled) {
+ gzip_enabled_ = gzip_enabled;
+}
+
void HTTPMultipartBuilder::SetFormData(const std::string& key,
const std::string& value) {
EraseKey(key);
@@ -179,13 +186,24 @@ std::unique_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() {
streams.push_back(
new StringHTTPBodyStream("--" + boundary_ + "--" + kCRLF));
- return std::unique_ptr<HTTPBodyStream>(new CompositeHTTPBodyStream(streams));
+ auto composite =
+ std::unique_ptr<HTTPBodyStream>(new CompositeHTTPBodyStream(streams));
+ if (gzip_enabled_) {
+ return std::unique_ptr<HTTPBodyStream>(
+ new GzipHTTPBodyStream(std::move(composite)));
+ }
+ return composite;
}
-HTTPHeaders::value_type HTTPMultipartBuilder::GetContentType() const {
+void HTTPMultipartBuilder::PopulateContentHeaders(
+ HTTPHeaders* http_headers) const {
std::string content_type =
base::StringPrintf("multipart/form-data; boundary=%s", boundary_.c_str());
- return std::make_pair(kContentType, content_type);
+ (*http_headers)[kContentType] = content_type;
+
+ if (gzip_enabled_) {
+ (*http_headers)[kContentEncoding] = "gzip";
+ }
}
void HTTPMultipartBuilder::EraseKey(const std::string& key) {

Powered by Google App Engine
This is Rietveld 408576698