// curl is built with --with-secure-transport on macOS and iOS so doesn't need these // certs. Windows doesn't need them either, but let's assume everything else does #if !defined(SYSTEM_OPENSSL) && !defined(_WIN32) && !defined(MACOSX) && !defined(IOS) #include <com/sun/star/uno/RuntimeException.hpp>
#ifdefined(LO_CURL_NEEDS_CA_BUNDLE) charconst* const path = GetCABundleFile(); if (path == nullptr)
{ #ifdefined EMSCRIPTEN
SAL_WARN("ucb.ucp.webdav.curl", "no OpenSSL CA certificate bundle found"); #else throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr); #endif
} else
{
rc = curl_easy_setopt(pCURL, CURLOPT_CAINFO, path); if (rc != CURLE_OK) // only if OOM?
{ throw css::uno::RuntimeException(u"CURLOPT_CAINFO failed"_ustr);
}
} #endif
// curl: "If you have a CA cert for the server stored someplace else than // in the default bundle, then the CURLOPT_CAPATH option might come handy // for you" if (charconst* const capath = getenv("LO_CERTIFICATE_AUTHORITY_PATH"))
{
rc = curl_easy_setopt(pCURL, CURLOPT_CAPATH, capath); if (rc != CURLE_OK)
{ throw css::uno::RuntimeException("CURLOPT_CAPATH failed");
}
}
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/")
+ 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
rc = curl_easy_setopt(pCURL, CURLOPT_USERAGENT, useragent.getStr());
assert(rc == CURLE_OK);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.