aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorDavid Major <dmajor@mozilla.com>2015-10-06 10:58:50 -0400
committerTed Mielczarek <ted@mielczarek.org>2015-10-06 11:05:12 -0400
commit7685dfc567dc45e523864a0e9177d003e1b46276 (patch)
treee0699555089d2d2be98abc35b6071ac1c7bdc559 /src/common/linux
parentFix MSVC build (including on 2015), drop some workarounds for MSVC older than... (diff)
downloadbreakpad-7685dfc567dc45e523864a0e9177d003e1b46276.tar.xz
Support for multiple upload files in CrashReportSender/HTTPUpload
A=David Major <dmajor@mozilla.com> BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1048091 R=ted@mielczarek.org Review URL: https://bugzilla.mozilla.org/show_bug.cgi?id=1048091 .
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/http_upload.cc15
-rw-r--r--src/common/linux/http_upload.h9
2 files changed, 12 insertions, 12 deletions
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
index d49f2276..4492fe84 100644
--- a/src/common/linux/http_upload.cc
+++ b/src/common/linux/http_upload.cc
@@ -56,8 +56,7 @@ static const char kUserAgent[] = "Breakpad/1.0 (Linux)";
// static
bool HTTPUpload::SendRequest(const string &url,
const map<string, string> &parameters,
- const string &upload_file,
- const string &file_part_name,
+ const map<string, string> &files,
const string &proxy,
const string &proxy_user_pwd,
const string &ca_certificate_file,
@@ -135,11 +134,13 @@ bool HTTPUpload::SendRequest(const string &url,
CURLFORM_COPYCONTENTS, iter->second.c_str(),
CURLFORM_END);
- // Add form file.
- (*curl_formadd)(&formpost, &lastptr,
- CURLFORM_COPYNAME, file_part_name.c_str(),
- CURLFORM_FILE, upload_file.c_str(),
- CURLFORM_END);
+ // Add form files.
+ for (iter = files.begin(); iter != files.end(); ++iter) {
+ (*curl_formadd)(&formpost, &lastptr,
+ CURLFORM_COPYNAME, iter->first.c_str(),
+ CURLFORM_FILE, iter->second.c_str(),
+ CURLFORM_END);
+ }
(*curl_easy_setopt)(curl, CURLOPT_HTTPPOST, formpost);
diff --git a/src/common/linux/http_upload.h b/src/common/linux/http_upload.h
index 6dd36ea0..4f0e452f 100644
--- a/src/common/linux/http_upload.h
+++ b/src/common/linux/http_upload.h
@@ -45,9 +45,9 @@ using std::map;
class HTTPUpload {
public:
- // Sends the given set of parameters, along with the contents of
- // upload_file, as a multipart POST request to the given URL.
- // file_part_name contains the name of the file part of the request
+ // Sends the given sets of parameters and files as a multipart POST
+ // request to the given URL.
+ // Each key in |files| is the name of the file part of the request
// (i.e. it corresponds to the name= attribute on an <input type="file">.
// Parameter names must contain only printable ASCII characters,
// and may not contain a quote (") character.
@@ -60,8 +60,7 @@ class HTTPUpload {
// returned in error_description.
static bool SendRequest(const string &url,
const map<string, string> &parameters,
- const string &upload_file,
- const string &file_part_name,
+ const map<string, string> &files,
const string &proxy,
const string &proxy_user_pwd,
const string &ca_certificate_file,