summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-11-26 14:46:16 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-11-27 00:17:39 +0100
commit1061b3443ffbc5db0051074b428e59ba39fe24ca (patch)
tree47f3f4f36e371210e02931d536c5d2f7d3c27963 /ucb
parent2931d3aa1f8f8bcfb56f01e77f82223e29b137b9 (diff)
ucb: webdav-curl: don't use chunked encoding for PROPPATCH
Sharepoint 16 has the same problem with this as with PROPFIND. But this still doesn't work, trying to add dead properties results in HTTP/1.1 400 BAD REQUEST now. In fact, it has additional problems: request 3 properties Foo, Bar, Baz with one PROPFIND and it complains about Foo, FooBar, FooBarBaz... Change-Id: Ia0ce0f7b9422e0751839151a4c964f0437282c64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125907 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 78d14ff6ef230ba3433d50ba8ded1a7cd2689b0f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125891 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-curl/CurlSession.cxx30
1 files changed, 17 insertions, 13 deletions
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 5ea645f4d4ee..43bfa6cb85f8 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1588,25 +1588,17 @@ auto CurlSession::PROPPATCH(OUString const& rURIReference,
CurlUri const uri(CurlProcessor::URIReferenceToURI(*this, rURIReference));
// TODO: either set CURLOPT_INFILESIZE_LARGE or chunked?
- ::std::unique_ptr<curl_slist, deleter_from_fn<curl_slist, curl_slist_free_all>> pList(
- curl_slist_append(nullptr, "Transfer-Encoding: chunked"));
- if (!pList)
- {
- throw uno::RuntimeException("curl_slist_append failed");
- }
+ ::std::unique_ptr<curl_slist, deleter_from_fn<curl_slist, curl_slist_free_all>> pList;
pList.reset(curl_slist_append(pList.release(), "Content-Type: application/xml"));
if (!pList)
{
throw uno::RuntimeException("curl_slist_append failed");
}
- ::std::vector<CurlOption> const options{ { CURLOPT_CUSTOMREQUEST, "PROPPATCH",
- "CURLOPT_CUSTOMREQUEST" } };
-
// generate XML document for PROPPATCH
- uno::Reference<io::XInputStream> const xRequestInStream(io::Pipe::create(m_xContext));
- uno::Reference<io::XOutputStream> const xRequestOutStream(xRequestInStream, uno::UNO_QUERY);
- assert(xRequestInStream.is());
+ uno::Reference<io::XSequenceOutputStream> const xSeqOutStream(
+ io::SequenceOutputStream::create(m_xContext));
+ uno::Reference<io::XOutputStream> const xRequestOutStream(xSeqOutStream);
assert(xRequestOutStream.is());
uno::Reference<xml::sax::XWriter> const xWriter(xml::sax::Writer::create(m_xContext));
xWriter->setOutputStream(xRequestOutStream);
@@ -1657,7 +1649,19 @@ auto CurlSession::PROPPATCH(OUString const& rURIReference,
}
xWriter->endElement("propertyupdate");
xWriter->endDocument();
- xRequestOutStream->closeOutput();
+
+ uno::Reference<io::XInputStream> const xRequestInStream(
+ io::SequenceInputStream::createStreamFromSequence(m_xContext,
+ xSeqOutStream->getWrittenBytes()));
+ assert(xRequestInStream.is());
+
+ curl_off_t const len(xSeqOutStream->getWrittenBytes().getLength());
+
+ ::std::vector<CurlOption> const options{
+ { CURLOPT_CUSTOMREQUEST, "PROPPATCH", "CURLOPT_CUSTOMREQUEST" },
+ // note: Sharepoint cannot handle "Transfer-Encoding: chunked"
+ { CURLOPT_INFILESIZE_LARGE, len, nullptr, CurlOption::Type::CurlOffT }
+ };
CurlProcessor::ProcessRequest(*this, uri, options, &rEnv, ::std::move(pList), nullptr,
&xRequestInStream, nullptr);