mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 09:55:40 +01:00
Back out trunk r1367.
Compile error: https://bugzilla.mozilla.org/show_bug.cgi?id=1048091#c15 Review URL: https://breakpad.appspot.com/9694002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1369 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
1335417f9f
commit
a58de86bcd
@ -59,7 +59,7 @@ CrashReportSender::CrashReportSender(const wstring &checkpoint_file)
|
||||
|
||||
ReportResult CrashReportSender::SendCrashReport(
|
||||
const wstring &url, const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files, wstring *report_code) {
|
||||
const wstring &dump_file_name, wstring *report_code) {
|
||||
int today = GetCurrentDate();
|
||||
if (today == last_sent_date_ &&
|
||||
max_reports_per_day_ != -1 &&
|
||||
@ -69,7 +69,7 @@ ReportResult CrashReportSender::SendCrashReport(
|
||||
|
||||
int http_response = 0;
|
||||
bool result = HTTPUpload::SendRequest(
|
||||
url, parameters, files, NULL, report_code,
|
||||
url, parameters, dump_file_name, L"upload_file_minidump", NULL, report_code,
|
||||
&http_response);
|
||||
|
||||
if (result) {
|
||||
|
@ -77,7 +77,7 @@ class CrashReportSender {
|
||||
|
||||
int max_reports_per_day() const { return max_reports_per_day_; }
|
||||
|
||||
// Sends the specified files, along with the map of
|
||||
// Sends the specified minidump file, along with the map of
|
||||
// name value pairs, as a multipart POST request to the given URL.
|
||||
// Parameter names must contain only printable ASCII characters,
|
||||
// and may not contain a quote (") character.
|
||||
@ -89,7 +89,7 @@ class CrashReportSender {
|
||||
// (Otherwise, report_code will be unchanged.)
|
||||
ReportResult SendCrashReport(const wstring &url,
|
||||
const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files,
|
||||
const wstring &dump_file_name,
|
||||
wstring *report_code);
|
||||
|
||||
private:
|
||||
|
@ -56,7 +56,8 @@ static const char kUserAgent[] = "Breakpad/1.0 (Linux)";
|
||||
// static
|
||||
bool HTTPUpload::SendRequest(const string &url,
|
||||
const map<string, string> ¶meters,
|
||||
const map<string, string> &files,
|
||||
const string &upload_file,
|
||||
const string &file_part_name,
|
||||
const string &proxy,
|
||||
const string &proxy_user_pwd,
|
||||
const string &ca_certificate_file,
|
||||
@ -134,13 +135,11 @@ bool HTTPUpload::SendRequest(const string &url,
|
||||
CURLFORM_COPYCONTENTS, iter->second.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
// Add form files.
|
||||
for (iter = files.begin(); iter != files.end(); ++iter) {
|
||||
// Add form file.
|
||||
(*curl_formadd)(&formpost, &lastptr,
|
||||
CURLFORM_COPYNAME, iter->first.c_str(),
|
||||
CURLFORM_FILE, iter->second.c_str(),
|
||||
CURLFORM_COPYNAME, file_part_name.c_str(),
|
||||
CURLFORM_FILE, upload_file.c_str(),
|
||||
CURLFORM_END);
|
||||
}
|
||||
|
||||
(*curl_easy_setopt)(curl, CURLOPT_HTTPPOST, formpost);
|
||||
|
||||
|
@ -45,9 +45,9 @@ using std::map;
|
||||
|
||||
class HTTPUpload {
|
||||
public:
|
||||
// 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
|
||||
// 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
|
||||
// (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,7 +60,8 @@ class HTTPUpload {
|
||||
// returned in error_description.
|
||||
static bool SendRequest(const string &url,
|
||||
const map<string, string> ¶meters,
|
||||
const map<string, string> &files,
|
||||
const string &upload_file,
|
||||
const string &file_part_name,
|
||||
const string &proxy,
|
||||
const string &proxy_user_pwd,
|
||||
const string &ca_certificate_file,
|
||||
|
@ -64,7 +64,8 @@ class HTTPUpload::AutoInternetHandle {
|
||||
// static
|
||||
bool HTTPUpload::SendRequest(const wstring &url,
|
||||
const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
int *timeout,
|
||||
wstring *response_body,
|
||||
int *response_code) {
|
||||
@ -142,7 +143,8 @@ bool HTTPUpload::SendRequest(const wstring &url,
|
||||
HTTP_ADDREQ_FLAG_ADD);
|
||||
|
||||
string request_body;
|
||||
if (!GenerateRequestBody(parameters, files, boundary, &request_body)) {
|
||||
if (!GenerateRequestBody(parameters, upload_file,
|
||||
file_part_name, boundary, &request_body)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -266,9 +268,15 @@ wstring HTTPUpload::GenerateRequestHeader(const wstring &boundary) {
|
||||
|
||||
// static
|
||||
bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
const wstring &boundary,
|
||||
string *request_body) {
|
||||
vector<char> contents;
|
||||
if (!GetFileContents(upload_file, &contents)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
string boundary_str = WideToUTF8(boundary);
|
||||
if (boundary_str.empty()) {
|
||||
return false;
|
||||
@ -285,20 +293,13 @@ bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
||||
WideToUTF8(pos->second) + "\r\n");
|
||||
}
|
||||
|
||||
for (map<wstring, wstring>::const_iterator pos = files.begin();
|
||||
pos != files.end(); ++pos) {
|
||||
vector<char> contents;
|
||||
if (!GetFileContents(pos->second, &contents)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now append the upload files as a binary (octet-stream) part
|
||||
string filename_utf8 = WideToUTF8(pos->second);
|
||||
// Now append the upload file as a binary (octet-stream) part
|
||||
string filename_utf8 = WideToUTF8(upload_file);
|
||||
if (filename_utf8.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
string file_part_name_utf8 = WideToUTF8(pos->first);
|
||||
string file_part_name_utf8 = WideToUTF8(file_part_name);
|
||||
if (file_part_name_utf8.empty()) {
|
||||
return false;
|
||||
}
|
||||
@ -314,7 +315,6 @@ bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
||||
request_body->append(&(contents[0]), contents.size());
|
||||
}
|
||||
request_body->append("\r\n");
|
||||
}
|
||||
request_body->append("--" + boundary_str + "--\r\n");
|
||||
return true;
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ using std::vector;
|
||||
|
||||
class HTTPUpload {
|
||||
public:
|
||||
// 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
|
||||
// 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
|
||||
// (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.
|
||||
@ -67,7 +67,8 @@ class HTTPUpload {
|
||||
// received (or 0 if the request failed before getting an HTTP response).
|
||||
static bool SendRequest(const wstring &url,
|
||||
const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
int *timeout,
|
||||
wstring *response_body,
|
||||
int *response_code);
|
||||
@ -87,11 +88,12 @@ class HTTPUpload {
|
||||
// Generates a HTTP request header for a multipart form submit.
|
||||
static wstring GenerateRequestHeader(const wstring &boundary);
|
||||
|
||||
// Given a set of parameters, a set of upload files, and a file part name,
|
||||
// Given a set of parameters, an upload filename, and a file part name,
|
||||
// generates a multipart request body string with these parameters
|
||||
// and minidump contents. Returns true on success.
|
||||
static bool GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
||||
const map<wstring, wstring> &files,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
const wstring &boundary,
|
||||
string *request_body);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user