diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-21 20:06:32 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-24 17:37:19 +0200 |
commit | 3725d51647b318b680a003afc7cf20c02dc06ef8 (patch) | |
tree | d128debacac40164c0090500d32c39db9ff55123 /ucb | |
parent | 23f7ef1c6d06262d1557f8978b48c5275b3d9585 (diff) |
ucb: webdav-curl: try to get the curl error message for more errors
Change-Id: Iad39deeeef55498628616762b6b8dddc5a8f7475
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169345
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-curl/CurlSession.cxx | 21 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavcontent.cxx | 11 |
2 files changed, 20 insertions, 12 deletions
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 183f8ad6f96a..65f5f684b9fb 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -992,13 +992,16 @@ auto CurlProcessor::ProcessRequestImpl( switch (rc) { case CURLE_UNSUPPORTED_PROTOCOL: - throw DAVException(DAVException::DAV_UNSUPPORTED); + throw DAVException(DAVException::DAV_UNSUPPORTED, u""_ustr, + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); case CURLE_COULDNT_RESOLVE_PROXY: - throw DAVException(DAVException::DAV_HTTP_LOOKUP, rSession.m_Proxy); + throw DAVException(DAVException::DAV_HTTP_LOOKUP, rSession.m_Proxy, + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); case CURLE_COULDNT_RESOLVE_HOST: throw DAVException( DAVException::DAV_HTTP_LOOKUP, - ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort())); + ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort()), + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); case CURLE_COULDNT_CONNECT: case CURLE_SSL_CONNECT_ERROR: case CURLE_SSL_CERTPROBLEM: @@ -1020,7 +1023,8 @@ auto CurlProcessor::ProcessRequestImpl( case CURLE_AUTH_ERROR: throw DAVException( DAVException::DAV_HTTP_AUTH, // probably? - ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort())); + ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort()), + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); case CURLE_WRITE_ERROR: case CURLE_READ_ERROR: // error returned from our callbacks case CURLE_OUT_OF_MEMORY: @@ -1033,13 +1037,16 @@ auto CurlProcessor::ProcessRequestImpl( case CURLE_RECURSIVE_API_CALL: throw DAVException( DAVException::DAV_HTTP_FAILED, - ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort())); + ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort()), + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); case CURLE_OPERATION_TIMEDOUT: throw DAVException( DAVException::DAV_HTTP_TIMEOUT, - ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort())); + ConnectionEndPointString(rSession.m_URI.GetHost(), rSession.m_URI.GetPort()), + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); default: // lots of generic errors - throw DAVException(DAVException::DAV_HTTP_ERROR, u""_ustr, 0); + throw DAVException(DAVException::DAV_HTTP_ERROR, u""_ustr, + rtl::OStringToOUString(errorString, RTL_TEXTENCODING_UTF8)); } } // error handling part 2: HTTP status codes diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index e2533fee9bca..96c0a4f1de61 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3913,6 +3913,9 @@ Content::ResourceType Content::getResourceType( break; case USC_CONNECTION_TIMED_OUT: e = DAVException::DAV_HTTP_TIMEOUT; + throw DAVException(e, + ConnectionEndPointString(aHostName, nPort), + aDAVOptions.getHttpResponseStatusText()); break; case USC_AUTH_FAILED: e = DAVException::DAV_HTTP_AUTH; @@ -4065,11 +4068,9 @@ void Content::getResourceOptions( // cache the internal unofficial status code aDAVOptions.setHttpResponseStatusCode(e.getError() == DAVException::DAV_HTTP_CONNECT ? USC_CONNECT_FAILED : USC_CONNECTION_TIMED_OUT); - if (e.getError() == DAVException::DAV_HTTP_CONNECT) - { // ugly: this is not a HTTP status from the server but message - // from libcurl but the string member is unused... - aDAVOptions.setHttpResponseStatusText(e.getMessage()); - } + // ugly: this is not a HTTP status from the server but message + // from libcurl but the string member is unused... + aDAVOptions.setHttpResponseStatusText(e.getMessage()); // used only internally, so the text doesn't really matter.. aStaticDAVOptionsCache.addDAVOptions( aDAVOptions, m_nOptsCacheLifeNotFound ); |