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

New commits:
commit a6c21346d4374ea9a0c1e4e1b05e443f48cef65b
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Nov 1 13:27:36 2021 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Nov 1 19:03:14 2021 +0100

    ucb: webdav-curl: fix MOVE/COPY/DELETE crash
    
    These need "nobody"; some errors like 401 will return a body that should
    be ignored.
    
    Change-Id: If2f726aa34d4d3fae1bd61bc87b62e2d55a7ff26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124561
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    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 a3426f7ddd89..d7a0f62ce606 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1915,8 +1915,9 @@ auto CurlSession::MKCOL(OUString const& rURIReference, 
DAVRequestEnvironment con
 
     CurlUri const uri(CurlProcessor::URIReferenceToURI(*this, rURIReference));
 
-    ::std::vector<CurlOption> const options{ { CURLOPT_CUSTOMREQUEST, "MKCOL",
-                                               "CURLOPT_CUSTOMREQUEST" } };
+    ::std::vector<CurlOption> const options{
+        { CURLOPT_NOBODY, 1L, nullptr }, { CURLOPT_CUSTOMREQUEST, "MKCOL", 
"CURLOPT_CUSTOMREQUEST" }
+    };
 
     CurlProcessor::ProcessRequest(*this, uri, options, &rEnv, nullptr, 
nullptr, nullptr, nullptr);
 }
@@ -1943,8 +1944,9 @@ auto CurlProcessor::MoveOrCopy(CurlSession& rSession, 
OUString const& rSourceURI
         throw uno::RuntimeException("curl_slist_append failed");
     }
 
-    ::std::vector<CurlOption> const options{ { CURLOPT_CUSTOMREQUEST, pMethod,
-                                               "CURLOPT_CUSTOMREQUEST" } };
+    ::std::vector<CurlOption> const options{
+        { CURLOPT_NOBODY, 1L, nullptr }, { CURLOPT_CUSTOMREQUEST, pMethod, 
"CURLOPT_CUSTOMREQUEST" }
+    };
 
     CurlProcessor::ProcessRequest(rSession, uriSource, options, &rEnv, 
::std::move(pList), nullptr,
                                   nullptr, nullptr);
@@ -1974,7 +1976,8 @@ auto CurlSession::DESTROY(OUString const& rURIReference, 
DAVRequestEnvironment c
 
     CurlUri const uri(CurlProcessor::URIReferenceToURI(*this, rURIReference));
 
-    ::std::vector<CurlOption> const options{ { CURLOPT_CUSTOMREQUEST, "DELETE",
+    ::std::vector<CurlOption> const options{ { CURLOPT_NOBODY, 1L, nullptr },
+                                             { CURLOPT_CUSTOMREQUEST, "DELETE",
                                                "CURLOPT_CUSTOMREQUEST" } };
 
     CurlProcessor::ProcessRequest(*this, uri, options, &rEnv, nullptr, 
nullptr, nullptr, nullptr);

Reply via email to