ucb/source/ucp/webdav-curl/CurlSession.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 9b5894e67d6ba820443c9f1130231be8c0278f82
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Jan 31 13:47:50 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Jan 31 16:55:21 2022 +0100

    ucb: webdav-curl: suppress libcurl proxy detection
    
    The UCP already reads proxy configuration from configmgr, including a
    list of hosts that should ignore proxy: Inet::Settings::ooInetNoProxy
    
    Hence also set an empty string with CURLOPT_PROXY, disabling the
    detect_proxy() function.
    
    (The neon library was never built with the libproxy dependency it
    needs to detect proxies.)
    
    Change-Id: I279d1b85dbdd2455791d393e634a1fa7c1c17ce0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129220
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 542aba73edcf..90ce91c3cddc 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -679,18 +679,19 @@ 
CurlSession::CurlSession(uno::Reference<uno::XComponentContext> const& xContext,
     assert(rc == CURLE_OK);
     rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_HTTPAUTH, CURLAUTH_ANY);
     assert(rc == CURLE_OK); // ANY is always available
+    // always set CURLOPT_PROXY to suppress proxy detection in libcurl
+    OString const utf8Proxy(OUStringToOString(m_Proxy.aName, 
RTL_TEXTENCODING_UTF8));
+    rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_PROXY, utf8Proxy.getStr());
+    if (rc != CURLE_OK)
+    {
+        SAL_WARN("ucb.ucp.webdav.curl", "CURLOPT_PROXY failed: " << 
GetErrorString(rc));
+        throw DAVException(DAVException::DAV_SESSION_CREATE,
+                           ConnectionEndPointString(m_Proxy.aName, 
m_Proxy.nPort));
+    }
     if (!m_Proxy.aName.isEmpty())
     {
         rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_PROXYPORT, 
static_cast<long>(m_Proxy.nPort));
         assert(rc == CURLE_OK);
-        OString const utf8Proxy(OUStringToOString(m_Proxy.aName, 
RTL_TEXTENCODING_UTF8));
-        rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_PROXY, 
utf8Proxy.getStr());
-        if (rc != CURLE_OK)
-        {
-            SAL_WARN("ucb.ucp.webdav.curl", "CURLOPT_PROXY failed: " << 
GetErrorString(rc));
-            throw DAVException(DAVException::DAV_SESSION_CREATE,
-                               ConnectionEndPointString(m_Proxy.aName, 
m_Proxy.nPort));
-        }
         // set this initially, may be overwritten during authentication
         rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_PROXYAUTH, CURLAUTH_ANY);
         assert(rc == CURLE_OK); // ANY is always available

Reply via email to