diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-18 13:49:54 +0200 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2023-09-28 21:11:19 +0200 |
commit | 6dbc41a6a7c27e98d28f4a4280cb054f5056cee3 (patch) | |
tree | f21bcf2b41fa0594a269d99fcae90d7bde869b0d | |
parent | 29aeafb25efcba6c3dab3b7842f383fcb0eab700 (diff) |
Fix curl proxy access for non-authenticated proxy
If rSession.m_Proxy.aName is a simple host-name, the CurlUri constructor
will fail with CURLUE_BAD_SCHEME, so just ignore the error here,
we only care about parsing out the username/password
Change-Id: Iec2d6e7315a5899ddddf6120a43199b75bf62db2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155834
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 9b30b4b1678e8be15ba51d236bd9a3e693d8d3d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157318
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 4b5e94e3d718b6afc571db3cff8321c44436c1ad)
-rw-r--r-- | ucb/source/ucp/webdav-curl/CurlSession.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 347eb25789e7..ca6f93744c7b 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -1207,11 +1207,18 @@ auto CurlProcessor::ProcessRequest( ::std::optional<Auth> oAuthProxy; if (pEnv && !rSession.m_isAuthenticatedProxy && !rSession.m_Proxy.aName.isEmpty()) { - // the hope is that this must be a URI - CurlUri const uri(rSession.m_Proxy.aName); - if (!uri.GetUser().isEmpty() || !uri.GetPassword().isEmpty()) + try + { + // the hope is that this must be a URI + CurlUri const uri(rSession.m_Proxy.aName); + if (!uri.GetUser().isEmpty() || !uri.GetPassword().isEmpty()) + { + oAuthProxy.emplace(uri.GetUser(), uri.GetPassword(), CURLAUTH_ANY); + } + } + catch (DAVException&) { - oAuthProxy.emplace(uri.GetUser(), uri.GetPassword(), CURLAUTH_ANY); + // ignore any parsing failure here } } decltype(CURLAUTH_ANY) const authSystem(CURLAUTH_NEGOTIATE | CURLAUTH_NTLM | CURLAUTH_NTLM_WB); |