From ad3c98809c228f4d35ac570e7a904059625b540e Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Sat, 27 May 2023 09:05:23 +0200 Subject: [PATCH] feat: crashpad handler http-proxy support (#847) --- CHANGELOG.md | 1 + external/crashpad | 2 +- src/backends/sentry_backend_crashpad.cpp | 22 ++++++++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0c31af4..f43a8014c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Disable PC adjustment in the backend for libunwindstack ([#839](https://github.com/getsentry/sentry-native/pull/839)) - Crashpad backend allows inspection and enrichment of the crash event in the on_crash/before_send hooks ([#843](https://github.com/getsentry/sentry-native/pull/843)) +- Add http-proxy support to the `crashpad_handler` ([#847](https://github.com/getsentry/sentry-native/pull/847), [crashpad#86](https://github.com/getsentry/crashpad/pull/86)) **Internal**: diff --git a/external/crashpad b/external/crashpad index 1904ae143..704134973 160000 --- a/external/crashpad +++ b/external/crashpad @@ -1 +1 @@ -Subproject commit 1904ae14360bb3115e098950733a4fd3da93b25a +Subproject commit 7041349732770d0902e156deaba6e86bfdee1a0a diff --git a/src/backends/sentry_backend_crashpad.cpp b/src/backends/sentry_backend_crashpad.cpp index ddb93f2ca..b3bc19440 100644 --- a/src/backends/sentry_backend_crashpad.cpp +++ b/src/backends/sentry_backend_crashpad.cpp @@ -319,15 +319,25 @@ crashpad_backend_startup( // `sentry_init` will persist the upload flag. data->db = crashpad::CrashReportDatabase::Initialize(database).release(); + bool success; crashpad::CrashpadClient client; char *minidump_url = sentry__dsn_get_minidump_url(options->dsn, options->user_agent); - SENTRY_TRACEF("using minidump url \"%s\"", minidump_url); - std::string url = minidump_url ? std::string(minidump_url) : std::string(); - sentry_free(minidump_url); - bool success = client.StartHandler(handler, database, database, url, - annotations, arguments, /* restartable */ true, - /* asynchronous_start */ false, attachments); + if (minidump_url) { + SENTRY_TRACEF("using minidump URL \"%s\"", minidump_url); + success = client.StartHandler(handler, database, database, minidump_url, + options->http_proxy ? options->http_proxy : "", annotations, + arguments, + /* restartable */ true, + /* asynchronous_start */ false, attachments); + sentry_free(minidump_url); + } else { + SENTRY_WARN( + "failed to construct minidump URL (check DSN or user-agent)"); + delete data->db; + data->db = nullptr; + return 1; + } #ifdef CRASHPAD_WER_ENABLED sentry_path_t *handler_dir = sentry__path_dir(absolute_handler_path);