summaryrefslogtreecommitdiff
path: root/ucb/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-11-10 15:36:45 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-11-11 08:42:57 +0100
commitf5926c8cfbd5af1fb7214428b4b03453b826f9a5 (patch)
tree17f50ec20fffa29b579f07745be1629017a71ae7 /ucb/source
parent50add2043752c7b07beccef9a509bea6c09619f8 (diff)
Move user agent initialization to InitCurl_easy
Places that didn't initialize it previously, would benefit automatically Change-Id: I2f1ff25fc58d9378462072bc92d7b37be2370fc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159299 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'ucb/source')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx2
-rw-r--r--ucb/source/ucp/webdav-curl/CurlSession.cxx28
2 files changed, 3 insertions, 27 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index b8ef0b77f734..1a499e1bdb3c 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -56,7 +56,7 @@
#include <ucbhelper/proxydecider.hxx>
#include <ucbhelper/macros.hxx>
#include <sax/tools/converter.hxx>
-#include <curlinit.hxx>
+#include <systools/curlinit.hxx>
#include <utility>
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index cc37f0b4da77..c07919b6d4b7 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -36,7 +36,7 @@
#include <rtl/uri.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
-#include <curlinit.hxx>
+#include <systools/curlinit.hxx>
#include <config_version.h>
#include <map>
@@ -613,33 +613,9 @@ CurlSession::CurlSession(uno::Reference<uno::XComponentContext> xContext,
throw DAVException(DAVException::DAV_SESSION_CREATE,
ConnectionEndPointString(m_URI.GetHost(), m_URI.GetPort()));
}
- curl_version_info_data const* const pVersion(curl_version_info(CURLVERSION_NOW));
- assert(pVersion);
- SAL_INFO("ucb.ucp.webdav.curl",
- "curl version: " << pVersion->version << " " << pVersion->host
- << " features: " << ::std::hex << pVersion->features << " ssl: "
- << pVersion->ssl_version << " libz: " << pVersion->libz_version);
- // Make sure a User-Agent header is always included, as at least
- // en.wikipedia.org:80 forces back 403 "Scripts should use an informative
- // User-Agent string with contact information, or they may be IP-blocked
- // without notice" otherwise:
- OString const useragent(
- OString::Concat("LibreOffice " LIBO_VERSION_DOTTED " denylistedbackend/")
- + ::std::string_view(pVersion->version, strlen(pVersion->version)) + " "
- + pVersion->ssl_version);
- // looks like an explicit "User-Agent" header in CURLOPT_HTTPHEADER
- // will override CURLOPT_USERAGENT, see Curl_http_useragent(), so no need
- // to check anything here
- auto rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_USERAGENT, useragent.getStr());
- if (rc != CURLE_OK)
- {
- SAL_WARN("ucb.ucp.webdav.curl", "CURLOPT_USERAGENT failed: " << GetErrorString(rc));
- throw DAVException(DAVException::DAV_SESSION_CREATE,
- ConnectionEndPointString(m_URI.GetHost(), m_URI.GetPort()));
- }
m_ErrorBuffer[0] = '\0';
// this supposedly gives the highest quality error reporting
- rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_ERRORBUFFER, m_ErrorBuffer);
+ auto rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_ERRORBUFFER, m_ErrorBuffer);
assert(rc == CURLE_OK);
#if 1
// just for debugging...