[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - desktop/Library_crashreport.mk desktop/source

Aron Budea aron.budea at collabora.com
Fri Jun 29 09:50:49 UTC 2018


 desktop/Library_crashreport.mk       |    5 ++++-
 desktop/source/app/crashreport.cxx   |   21 +++++++++++++++++++--
 desktop/source/minidump/minidump.cxx |   11 +++++++++--
 3 files changed, 32 insertions(+), 5 deletions(-)

New commits:
commit 554dacb8647f5305c155590a631e1efc5ad84ce2
Author: Aron Budea <aron.budea at collabora.com>
Date:   Mon Mar 19 23:56:54 2018 +0100

    tdf#114227: set better proxy params in cURL for crash reporting
    
    Take proxy server from internet settings, and pass to cURL.
    Allow forwarding authentication as well (explicitely setting
    user/password is still missing).
    
    Change-Id: I19a6c9057a11a5911a6117f71060d3f386953602
    Reviewed-on: https://gerrit.libreoffice.org/51621
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/56471
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

diff --git a/desktop/Library_crashreport.mk b/desktop/Library_crashreport.mk
index ba2f3483a416..a19b9915e535 100644
--- a/desktop/Library_crashreport.mk
+++ b/desktop/Library_crashreport.mk
@@ -30,13 +30,16 @@ $(eval $(call gb_Library_add_libs,crashreport,\
     ) \
 ))
 
+$(eval $(call gb_Library_use_sdk_api,crashreport))
+
 $(eval $(call gb_Library_use_libraries,crashreport,\
     comphelper \
     cppu \
     cppuhelper \
     sal \
     salhelper \
-	$(gb_UWINAPI) \
+    ucbhelper \
+    $(gb_UWINAPI) \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,crashreport,\
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index ef8e856b9199..009947d2c1a1 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -10,6 +10,8 @@
 #include <desktop/crashreport.hxx>
 #include <rtl/bootstrap.hxx>
 #include <osl/file.hxx>
+#include <comphelper/processfactory.hxx>
+#include <ucbhelper/proxydecider.hxx>
 
 #include <config_version.h>
 #include <config_folders.h>
@@ -68,12 +70,27 @@ void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue)
 void CrashReporter::writeCommonInfo()
 {
     osl::MutexGuard aGuard(maMutex);
+
+    ucbhelper::InternetProxyDecider proxy_decider(::comphelper::getProcessComponentContext());
+
+    const OUString protocol = "https";
+    const OUString url = "crashreport.collaboraoffice.com";
+    const sal_Int32 port = 443;
+
+    const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port);
+
     // limit the amount of code that needs to be executed before the crash reporting
     std::string ini_path = CrashReporter::getIniFileName();
     std::ofstream minidump_file(ini_path, std::ios_base::trunc);
-    minidump_file << "ProductName=LibreOffice\n";
+    minidump_file << "ProductName=CollaboraOffice\n";
     minidump_file << "Version=" LIBO_VERSION_DOTTED "\n";
-    minidump_file << "URL=https://crashreport.collaboraoffice.com/submit/\n";
+    minidump_file << "URL=" << protocol << "://" << url << "/submit/\n";
+
+    if (proxy_server.aName != OUString())
+    {
+        minidump_file << "Proxy=" << proxy_server.aName << ":" << proxy_server.nPort << "\n";
+    }
+
     for (auto& keyValue : maKeyValues)
     {
         writeToStream(minidump_file, keyValue.first, keyValue.second);
diff --git a/desktop/source/minidump/minidump.cxx b/desktop/source/minidump/minidump.cxx
index ac63bd41096c..295d485eefd8 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -111,9 +111,16 @@ bool uploadContent(std::map<std::string, std::string>& parameters, std::string&
     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
     // Set proxy information if necessary.
     if (!proxy.empty())
+    {
         curl_easy_setopt(curl, CURLOPT_PROXY, proxy.c_str());
-    if (!proxy_user_pwd.empty())
-        curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxy_user_pwd.c_str());
+
+        curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANYSAFE);
+
+        if (!proxy_user_pwd.empty())
+            curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxy_user_pwd.c_str());
+        else
+            curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, ":");
+    }
 
     if (!ca_certificate_file.empty())
         curl_easy_setopt(curl, CURLOPT_CAINFO, ca_certificate_file.c_str());


More information about the Libreoffice-commits mailing list