[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Mike Kaganski (via logerrit)
 ucb/source/cacher/cachedcontentresultset.cxx |   14 ++-
 ucb/source/cacher/cachedcontentresultsetstub.cxx |8 +
 ucb/source/core/ucb.cxx  |4 
 ucb/source/core/ucbcmds.cxx  |   98 +-
 ucb/source/core/ucbstore.cxx |3 
 ucb/source/ucp/cmis/cmis_content.cxx |   57 +---
 ucb/source/ucp/ext/ucpext_content.cxx|6 -
 ucb/source/ucp/file/bc.cxx   |7 -
 ucb/source/ucp/file/filglob.cxx  |   19 ++--
 ucb/source/ucp/file/filnot.cxx   |3 
 ucb/source/ucp/file/filprp.cxx   |3 
 ucb/source/ucp/file/filrow.cxx   |2 
 ucb/source/ucp/file/filtask.cxx  |  101 +++
 ucb/source/ucp/file/prov.cxx |   17 +--
 ucb/source/ucp/ftp/ftpcontent.cxx|   31 +++
 ucb/source/ucp/gio/gio_content.cxx   |   23 ++---
 ucb/source/ucp/hierarchy/hierarchycontent.cxx|   35 ---
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx |   17 +--
 ucb/source/ucp/hierarchy/hierarchyprovider.cxx   |3 
 ucb/source/ucp/package/pkgcontent.cxx|   48 +-
 ucb/source/ucp/package/pkgprovider.cxx   |3 
 ucb/source/ucp/tdoc/tdoc_content.cxx |   35 ---
 ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx |9 +-
 ucb/source/ucp/webdav-neon/LinkSequence.cxx  |2 
 ucb/source/ucp/webdav-neon/LockEntrySequence.cxx |2 
 ucb/source/ucp/webdav-neon/LockSequence.cxx  |4 
 ucb/source/ucp/webdav-neon/NeonSession.cxx   |7 -
 ucb/source/ucp/webdav-neon/webdavcontent.cxx |   70 ---
 ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx |   45 --
 29 files changed, 326 insertions(+), 350 deletions(-)

New commits:
commit 5e7e62b937721850ff762c063e9e58c58ce2fb80
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:19:55 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 08:23:16 2021 +0100

Prepare for removal of non-const operator[] from Sequence in ucb

Change-Id: I16f3de8398323a308e20d04643a11dd9c3ec59f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124404
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/ucb/source/cacher/cachedcontentresultset.cxx 
b/ucb/source/cacher/cachedcontentresultset.cxx
index 3adfcc45a225..c169a3734b58 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -212,7 +212,7 @@ Any& CachedContentResultSet::CCRS_Cache
 if( nDiff < 0 )
 nDiff *= -1;
 
-return (m_pResult->Rows)[nDiff];
+return m_pResult->Rows.getArray()[nDiff];
 }
 
 void CachedContentResultSet::CCRS_Cache
@@ -226,7 +226,10 @@ void CachedContentResultSet::CCRS_Cache
 nDiff *= -1;
 Sequence< sal_Bool >& rMappedReminder = getMappedReminder();
 if( nDiff < rMappedReminder.getLength() )
-rMappedReminder[nDiff] = true;
+{
+sal_Bool* pMappedReminder = rMappedReminder.getArray();
+pMappedReminder[nDiff] = true;
+}
 }
 
 bool CachedContentResultSet::CCRS_Cache
@@ -449,15 +452,16 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
 sal_Int32 nOrigProps = aOrigProps.getLength();
 
 m_xProperties->realloc( nOrigProps + 2 - nDeleted );//note that nDeleted 
is <= 2
+auto pProperties = m_xProperties->getArray();
 for( sal_Int32 n = 0, m = 0; n < nOrigProps; n++, m++ )
 {
 if( n == nFetchSize || n == nFetchDirection )
 m--;
 else
-(*m_xProperties)[ m ] = aOrigProps[ n ];
+pProperties[ m ] = aOrigProps[ n ];
 }
 {
-Property& rMyProp = (*m_xProperties)[ nOrigProps - nDeleted ];
+Property& rMyProp = pProperties[ nOrigProps - nDeleted ];
 rMyProp.Name = g_sPropertyNameForFetchSize;
 rMyProp.Type = cppu::UnoType::get();
 rMyProp.Attributes = PropertyAttribute::BOUND | 
PropertyAttribute::MAYBEDEFAULT;
@@ -471,7 +475,7 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
 
 }
 {
-Property& rMyProp = (*m_xProperties)[ nOrigProps - nDeleted + 1 ];
+Property& rMyProp = pProperties[ nOrigProps - nDeleted + 1 ];
 rMyProp.Name = g_sPropertyNameForFetchDirection;
 rMyProp.Type = cppu::UnoType::get();
 rMyProp.Attributes = PropertyAttribute::BOUND | 
PropertyAttribute::MAYBEDEFAULT;
diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx 
b/ucb/source/cacher/cachedcontentresultsetstub.cxx
index 19ca0dd060f8..a84d8f98f5bf 100644
--- a/ucb/source/cacher/cachedcontentresultsetstub.cxx
+++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx
@@ -211,7 +211,7 @@ FetchResult CachedContentResultSetStub::impl_fetchHelper(
 
 try
 {
-impl_loadRow( aRet.Rows[0] );
+impl_loadRow( aRet.Rows.getArray()[0] );
 }
 catch( SQLException& 

Re: Windows build problem, access denied

2021-11-01 Thread Gabor Kelemen
Hi Ilmari

Recently I had the opportunity to meet the error in your thread starting
message, and it was not solved by using the sn tool as documented (but
interestingly on another machine it helped).

I added a new section about how I solved it:

https://wiki.documentfoundation.org/Development/BuildingOnWindows#.NET_exception_occurred:_System.IO.IOException:_Access_is_denied


Cheers
Gabor

2021. 10. 11. 11:18 keltezéssel, Ilmari Lauhakangas írta:
> On 11.10.2021 9.36, Miklos Vajna wrote:
>> I have a note from 2020-05 that some kind of cli_ure access denied
>> problem I had was solved by following the instructions from
>> .
>>
>>
>> Give it a try, perhaps it'll help in your case as well.
>
> The mentee had tried the registry editing advice earlier, but there
> was another tip buried in the comments: after doing both the 32-bit
> and 64-bit edits, the problem was solved.
>
> I see the advice in our wiki does mention touching both using the sn
> tool:
> https://wiki.documentfoundation.org/Development/BuildingOnWindows#ALINK_:_error_AL1078:_Error_signing_assembly_--_Access_is_denied
>
> Ilmari





OpenPGP_signature
Description: OpenPGP digital signature


[Libreoffice-commits] core.git: solenv/gbuild

2021-11-01 Thread Luboš Luňák (via logerrit)
 solenv/gbuild/LinkTarget.mk |   20 ++--
 solenv/gbuild/platform/com_GCC_class.mk |6 +++---
 solenv/gbuild/platform/com_MSC_class.mk |4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit fef55498e05717c51c3b3a9222fa460d609a9d3d
Author: Luboš Luňák 
AuthorDate: Sun Oct 31 20:17:13 2021 +0100
Commit: Luboš Luňák 
CommitDate: Mon Nov 1 09:44:53 2021 +0100

remove unused gb_CObject__command_pattern parameter

Usage removed in bc39f6b0e62b0a54500bf3986f971a43fe8f843d .

Change-Id: Ie2d8782f84ae39360698885d238ec2154a5b0d82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124533
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index b1cd59892b1d..0216802d271b 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -267,7 +267,7 @@ else
 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
$(call gb_Output_announce,$*.c,$(true),$(if $(COMPILER_TEST),C? ,C  ),3)
$(call gb_Trace_StartRange,$*.c,$(if $(COMPILER_TEST),C? ,C  ))
-   $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) 
$(T_CFLAGS_APPEND),$<,$(call 
gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CC))
+   $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) 
$(T_CFLAGS_APPEND),$<,$(call 
gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))
$(call gb_Trace_EndRange,$*.c,$(if $(COMPILER_TEST),C? ,C  ))
 endif
 
@@ -330,7 +330,7 @@ $(call gb_CxxObject_get_target,%) : $(call 
gb_CxxObject_get_source,$(SRCDIR),%)
$(call gb_Output_announce,$*.cxx,$(true),$(if 
$(COMPILER_TEST),CPT,CXX),3)
$(call gb_Trace_StartRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
$(eval $(gb_CxxObject__set_pchflags))
-   $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) 
$(T_CXXFLAGS_APPEND) $(if $(COMPILER_TEST),$(gb_COMPILER_TEST_FLAGS)),$<,$(call 
gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CXX))
+   $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) 
$(T_CXXFLAGS_APPEND) $(if $(COMPILER_TEST),$(gb_COMPILER_TEST_FLAGS)),$<,$(call 
gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CXX))
$(call gb_Trace_EndRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
 endif
 
@@ -363,7 +363,7 @@ $(call gb_GenCObject_get_target,%) :
$(call gb_Output_announce,$*.c,$(true),C  ,3)
$(call gb_Trace_StartRange,$*.c,C  )
test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated 
source file $(call gb_GenCObject_get_source,$*)" && false)
-   $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) 
$(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call 
gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CC))
+   $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) 
$(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call 
gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))
$(call gb_Trace_EndRange,$*.c,C  )
 endif
 
@@ -397,7 +397,7 @@ $(call gb_GenCxxObject_get_target,%) :
$(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file 
$(GEN_CXX_SOURCE)" && false)
$(eval $(gb_CxxObject__set_pchflags))
-   $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) 
$(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call 
gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CXX))
+   $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) 
$(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call 
gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CXX))
$(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
 endif
 
@@ -430,7 +430,7 @@ $(call gb_GenCxxClrObject_get_target,%) :
$(call gb_Output_announce,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),$(true),CLR,3)
$(call gb_Trace_StartRange,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
test -f $(GEN_CXXCLR_SOURCE) || (echo "Missing generated source file 
$(GEN_CXXCLR_SOURCE)" && false)
-   $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) 
$(T_CXXCLRFLAGS_APPEND),$(GEN_CXXCLR_SOURCE),$(call 
gb_GenCxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS))
+   $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) 
$(T_CXXCLRFLAGS_APPEND),$(GEN_CXXCLR_SOURCE),$(call 
gb_GenCxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
$(call gb_Trace_EndRange,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
 endif
 
@@ -520,7 +520,7 @@ else
 $(call gb_ObjCxxObject_get_target,%) : $(call 
gb_ObjCxxObject_get_source,$(SRCDIR),%)
$(call gb_Output_announce,$*.mm,$(true),$(if 
$(COMPILER_TEST),O?X,OCX),3)
$(call gb_Trace_StartRange,$*.mm,$(if $(COMPILER_TEST),O?X,OCX))
-   $(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) 
$(T_OBJCXXFLAGS_APPEND),$<,$(c

[Libreoffice-commits] core.git: sfx2/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 sfx2/source/doc/objserv.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 1e3cc6d8dfe95f9f4c37f583c3de582464159698
Author: Caolán McNamara 
AuthorDate: Sun Oct 31 21:06:52 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 09:51:41 2021 +0100

Resolves: tdf#145464 ensure the SfxViewFrame is activated

before dispatching SID_SIGNATURE, its normally activated on getting
focus, but its possible to move focus into the button of the infobar
without the frame getting focus.

Change-Id: Id353e23b595e14614361c0c25976c788940c67eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124534
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 1182ad519d22..6f7e3fc829b5 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1512,6 +1512,13 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
 
 IMPL_LINK_NOARG(SfxObjectShell, SignDocumentHandler, weld::Button&, void)
 {
+SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this);
+if (!pFrame)
+{
+SAL_WARN("sfx.appl", "There should be some SfxViewFrame associated 
here");
+return;
+}
+pFrame->MakeActive_Impl(false);
 GetDispatcher()->Execute(SID_SIGNATURE);
 }
 


[Libreoffice-commits] core.git: sfx2/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 sfx2/source/doc/objserv.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f16f35d40948bd4bbe835e0ba3c2f75aa0de23f7
Author: Caolán McNamara 
AuthorDate: Sun Oct 31 21:18:30 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 09:52:15 2021 +0100

Related: tdf#145464 pass an explicit DocFrame for SID_SIGNATURE

Change-Id: I352e0d92720cd002cbe3f25d4fa0c07b69c88cf2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124535
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 6f7e3fc829b5..67de2f96a547 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1512,14 +1512,14 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
 
 IMPL_LINK_NOARG(SfxObjectShell, SignDocumentHandler, weld::Button&, void)
 {
-SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this);
-if (!pFrame)
+SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst(this);
+if (!pViewFrm)
 {
 SAL_WARN("sfx.appl", "There should be some SfxViewFrame associated 
here");
 return;
 }
-pFrame->MakeActive_Impl(false);
-GetDispatcher()->Execute(SID_SIGNATURE);
+SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
pViewFrm->GetFrame().GetFrameInterface());
+pViewFrm->GetDispatcher()->ExecuteList(SID_SIGNATURE, SfxCallMode::SLOT, 
{}, { &aDocFrame });
 }
 
 void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq)


[Libreoffice-commits] core.git: xmlsecurity/source

2021-11-01 Thread Mike Kaganski (via logerrit)
 xmlsecurity/source/framework/saxeventkeeperimpl.cxx   |   15 
+--
 xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx |   12 --
 xmlsecurity/source/gpg/SecurityEnvironment.cxx|3 
 xmlsecurity/source/helper/pdfsignaturehelper.cxx  |3 
 xmlsecurity/source/helper/xmlsignaturehelper.cxx  |5 -
 xmlsecurity/source/helper/xsecctl.cxx |   12 +-
 xmlsecurity/source/helper/xsecverify.cxx  |5 -
 xmlsecurity/source/xmlsec/biginteger.cxx  |8 -
 xmlsecurity/source/xmlsec/certificateextension_certextn.cxx   |   15 
---
 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx|   12 --
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |9 +
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |   21 
++--
 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx   |5 -
 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx|6 -
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   18 
---
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |   47 
++
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx   |5 -
 17 files changed, 78 insertions(+), 123 deletions(-)

New commits:
commit d12f25905c3d7e474b603a716669b12143b6c34a
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:29:41 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 09:55:03 2021 +0100

Prepare for removal of non-const operator[] from Sequence in xmlsecurity

Change-Id: I7cfcf9f9ea307bd737292e6f4f37a29f453167c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124418
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx 
b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index b1d960241702..b5a7f027287f 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -30,6 +30,8 @@
 #include 
 #include 
 
+#include 
+
 SAXEventKeeperImpl::SAXEventKeeperImpl( )
 :m_pCurrentBufferNode(nullptr),
  m_nNextElementMarkId(1),
@@ -345,12 +347,8 @@ css::uno::Sequence< css::uno::Reference< 
css::xml::wrapper::XXMLElementWrapper >
 css::uno::Sequence < css::uno::Reference<
 css::xml::wrapper::XXMLElementWrapper > > aChildrenCollection ( 
vChildren.size());
 
-sal_Int32 nIndex = 0;
-for( const auto& i : vChildren )
-{
-aChildrenCollection[nIndex] = i->getXMLElement();
-nIndex++;
-}
+std::transform(vChildren.begin(), vChildren.end(), 
aChildrenCollection.getArray(),
+   [](const auto& i) { return i->getXMLElement(); });
 
 return aChildrenCollection;
 }
@@ -998,11 +996,12 @@ void SAL_CALL SAXEventKeeperImpl::startElement(
 {
 sal_Int32 nLength = xAttribs->getLength();
 css::uno::Sequence< css::xml::csax::XMLAttribute > aAttributes 
(nLength);
+auto aAttributesRange = asNonConstRange(aAttributes);
 
 for ( int i = 0; igetNameByIndex(static_cast(i));
-aAttributes[i].sValue 
=xAttribs->getValueByIndex(static_cast(i));
+aAttributesRange[i].sName = 
xAttribs->getNameByIndex(static_cast(i));
+aAttributesRange[i].sValue 
=xAttribs->getValueByIndex(static_cast(i));
 }
 
 m_xCompressedDocumentHandler->compressedStartElement(aName, 
aAttributes);
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx 
b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
index de6cf54cd206..203f0fea2072 100644
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
@@ -56,17 +56,7 @@ void SAL_CALL XMLSignatureTemplateImpl::setTarget( const 
css::uno::Reference< cs
 
 css::uno::Sequence< css::uno::Reference< css::xml::wrapper::XXMLElementWrapper 
> > SAL_CALL XMLSignatureTemplateImpl::getTargets()
 {
-sal_Int32 length = targets.size();
-css::uno::Sequence< css::uno::Reference< 
css::xml::wrapper::XXMLElementWrapper > > aTargets (length);
-
-sal_Int32 i;
-
-for (i=0; i > 
SecurityEnvironmentGpg::getCertificatesIm
 }
 
 Sequence< Reference< XCertificate > > 
xCertificateSequence(certsList.size());
+auto xCertificateSequenceRange = asNonConstRange(xCertificateSequence);
 int i = 0;
 for (const auto& cert : certsList) {
-xCertificateSequence[i++] = cert;
+xCertificateSequenceRange[i++] = cert;
 }
 
 return xCertificateSequence;
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 95fca26f5945..5aa2088ea7fd 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/p

[Libreoffice-commits] core.git: xmlsecurity/source

2021-11-01 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   20 
+-
 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx   |2 -
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 7d936a98cd8f44e3a99f121b610b9040ae2e8381
Author: Stephan Bergmann 
AuthorDate: Fri Oct 29 14:09:46 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Nov 1 09:57:13 2021 +0100

Fix more misuses of NULL across Windows-only code

...that had inadvertently been missing from
a5cea74034a8e029bfdf0f2b82ea8800bf5bd206 °Fix misuses of NULL across
Windows-only code"

Change-Id: I8f60cd6114ceb7c6413fb099778bfb06407bbb24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124431
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index bd1de6cbf85d..f198f839f76b 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -110,16 +110,16 @@ static void traceTrustStatus(DWORD err)
 }
 }
 
-SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const 
uno::Reference< uno::XComponentContext >& xContext ) : m_hProv( NULL ) , 
m_pszContainer( nullptr ) , m_hKeyStore( nullptr ), m_hCertStore( nullptr ), 
m_hMySystemStore(nullptr), m_hRootSystemStore(nullptr), 
m_hTrustSystemStore(nullptr), m_hCaSystemStore(nullptr), m_bEnableDefault( 
false ){
+SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const 
uno::Reference< uno::XComponentContext >& xContext ) : m_hProv( 0 ) , 
m_pszContainer( nullptr ) , m_hKeyStore( nullptr ), m_hCertStore( nullptr ), 
m_hMySystemStore(nullptr), m_hRootSystemStore(nullptr), 
m_hTrustSystemStore(nullptr), m_hCaSystemStore(nullptr), m_bEnableDefault( 
false ){
 
 m_xServiceManager.set(xContext, uno::UNO_QUERY);
 }
 
 SecurityEnvironment_MSCryptImpl::~SecurityEnvironment_MSCryptImpl() {
 
-if( m_hProv != NULL ) {
+if( m_hProv != 0 ) {
 CryptReleaseContext( m_hProv, 0 ) ;
-m_hProv = NULL ;
+m_hProv = 0 ;
 }
 
 if( m_pszContainer != nullptr ) {
@@ -181,12 +181,12 @@ HCRYPTPROV 
SecurityEnvironment_MSCryptImpl::getCryptoProvider() {
 }
 
 void SecurityEnvironment_MSCryptImpl::setCryptoProvider( HCRYPTPROV aProv ) {
-if( m_hProv != NULL ) {
+if( m_hProv != 0 ) {
 CryptReleaseContext( m_hProv, 0 ) ;
-m_hProv = NULL ;
+m_hProv = 0 ;
 }
 
-if( aProv != NULL ) {
+if( aProv != 0 ) {
 m_hProv = aProv ;
 }
 }
@@ -607,7 +607,7 @@ uno::Sequence< uno::Reference < XCertificate > > 
SecurityEnvironment_MSCryptImpl
 hCollectionStore = CertOpenStore(
 CERT_STORE_PROV_COLLECTION ,
 0 ,
-NULL ,
+0 ,
 0 ,
 nullptr
 ) ;
@@ -722,7 +722,7 @@ uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificat
 static HCERTSTORE getCertStoreForIntermediatCerts(
 const uno::Sequence< uno::Reference< css::security::XCertificate > >& 
seqCerts)
 {
-HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, 
nullptr);
+HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, 0, nullptr);
 if (store == nullptr)
 return nullptr;
 
@@ -764,7 +764,7 @@ static bool CheckUnitTestStore(PCCERT_CHAIN_CONTEXT const 
pChainContext, DWORD i
 static HCERTSTORE const hExtra = CertOpenStore(
 CERT_STORE_PROV_FILENAME_A,
 PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
-NULL,
+0,
 CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG,
 OString(OString::Concat(pVar) + "/test.p7b").getStr());
 assert(hExtra != nullptr);
@@ -844,7 +844,7 @@ sal_Int32 
SecurityEnvironment_MSCryptImpl::verifyCertificate(
 hCollectionStore = CertOpenStore(
 CERT_STORE_PROV_COLLECTION ,
 0 ,
-NULL ,
+0 ,
 0 ,
 nullptr
 ) ;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index e626beeffaaa..08143f992379 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -59,7 +59,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
 {
 sCertDir = OString(sCertDB.getStr(), sCertDB.getLength(), 
RTL_TEXTENCODING_ASCII_US);
 n_pCertStore = sCertDir.getStr();
-n_hStoreHandle = CertOpenSystemStoreW( NULL, 
o3tl::toW(sCertDB.getStr())) ;
+n_hStoreHandle = CertOpenSystemStoreW( 0, o3tl::toW(sCertDB.getStr())) 
;
 if( n_hStoreHandle == nullptr 

[Libreoffice-commits] core.git: emfio/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 emfio/source/reader/mtftools.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9948e9e736d005f1a5a5ad4955e55aefddc8ef54
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 08:47:22 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 10:44:52 2021 +0100

ofz#40575 Integer-overflow

Change-Id: I4b6b6f2ba0c4dd013489b334822e6639f265c6b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124539
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 4a3242c65451..b98fa7c11d19 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1686,7 +1686,7 @@ namespace emfio
 
 if (pDXArry)
 {
-sal_Int32 nSumX = 0, nSumY = 0;
+sal_Int64 nSumX = 0, nSumY = 0;
 for (sal_Int32 i = 0; i < rText.getLength(); i++ )
 {
 nSumX += (*pDXArry)[i];


[Libreoffice-commits] core.git: vcl/workben

2021-11-01 Thread Caolán McNamara (via logerrit)
 vcl/workben/dbffuzzer.options |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a2bc467b4c0c0da71a8c213ac61477cd7697cdc0
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 08:50:06 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 11:26:49 2021 +0100

ofz#40404 try smaller documents to avoid timeouts

Change-Id: Iac495993a219507fe2b6d50b11973ad8d078497e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124540
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/workben/dbffuzzer.options b/vcl/workben/dbffuzzer.options
index bf169a74ba63..f41b545a43a4 100644
--- a/vcl/workben/dbffuzzer.options
+++ b/vcl/workben/dbffuzzer.options
@@ -1,2 +1,2 @@
 [libfuzzer]
-max_len = 49152
+max_len = 32768


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - cui/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 cui/source/dialogs/scriptdlg.cxx |9 +
 cui/source/inc/scriptdlg.hxx |1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 68e3ed223eec7ccfe1a0a1f0cd8e09b88ca9e313
Author: Caolán McNamara 
AuthorDate: Fri Oct 29 12:54:26 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 12:10:00 2021 +0100

Resolves: tdf#145377 don't use dismissed dialog as parent for error dialogs

the script dialog is dismissed before the error dialogs get executed

Change-Id: I9e143a7e65077d09f436c4744759c78a9970f1d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124467
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 1258ee54d432..b000b4b34ecf 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -372,6 +372,7 @@ CuiInputDialog::CuiInputDialog(weld::Window * pParent, 
InputDialogMode nMode)
 
 SvxScriptOrgDialog::SvxScriptOrgDialog(weld::Window* pParent, const OUString& 
language)
 : SfxDialogController(pParent, "cui/ui/scriptorganizer.ui", 
"ScriptOrganizerDialog")
+, m_pParent(pParent)
 , m_sLanguage(language)
 , m_delErrStr(CuiResId(RID_SVXSTR_DELFAILED))
 , m_delErrTitleStr(CuiResId(RID_SVXSTR_DELFAILED_TITLE))
@@ -622,19 +623,19 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, 
rButton, void)
 }
 catch ( reflection::InvocationTargetException& ite )
 {
-SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), 
css::uno::Any(ite));
+SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, 
css::uno::Any(ite));
 }
 catch ( provider::ScriptFrameworkErrorException& ite )
 {
-SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), 
css::uno::Any(ite));
+SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, 
css::uno::Any(ite));
 }
 catch ( RuntimeException& re )
 {
-SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), 
css::uno::Any(re));
+SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, 
css::uno::Any(re));
 }
 catch ( Exception& e )
 {
-SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), 
css::uno::Any(e));
+SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, 
css::uno::Any(e));
 }
 }
 StoreCurrentSelection();
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 6a1cbd15ae5c..954f3d90e191 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -77,6 +77,7 @@ public:
 class SvxScriptOrgDialog : public SfxDialogController
 {
 protected:
+weld::Window* m_pParent;
 OUString m_sLanguage;
 static Selection_hash   m_lastSelection;
 const OUString m_delErrStr;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - cui/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 cui/source/dialogs/scriptdlg.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 149df697ec2f4db0be891becef217312ded3ab88
Author: Caolán McNamara 
AuthorDate: Fri Oct 29 12:39:22 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 12:14:13 2021 +0100

Related: tdf#145377 call select handler if restoring previously selected 
script

Change-Id: Ibab3e920e6830c86bb6bfba070f14ca8a153c25f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124200
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index b000b4b34ecf..b840911a3797 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1082,7 +1082,10 @@ void SvxScriptOrgDialog::RestorePreviousSelection()
 }
 
 if (xEntry)
+{
 m_xScriptsBox->set_cursor(*xEntry);
+ScriptSelectHdl(*m_xScriptsBox);
+}
 }
 
 namespace {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - xmloff/CppunitTest_xmloff_draw.mk xmloff/qa xmloff/source

2021-11-01 Thread Julien Nabet (via logerrit)
 xmloff/CppunitTest_xmloff_draw.mk|1 
 xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg |binary
 xmloff/qa/unit/draw.cxx  |   38 ++-
 xmloff/source/draw/shapeexport.cxx   |8 
 4 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 0ec2f94100cf1b8c24642e79e60810a79ff075c3
Author: Julien Nabet 
AuthorDate: Sun Mar 28 18:21:04 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 12:15:26 2021 +0100

tdf#141301: extrusion-skew angle value -135 is not written to file...

whereas it should since not default value

(Regina) Hopefully in some years missing values are unlikely and
bug tdf#141127 can be fixed.
(Regina) I have added a unit test to Julien's patch.

Change-Id: Ia2aabd8e724e3c3db9ae8a87cb27707aa7040fb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113257
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 773465fb95c1be48f8fdf406d2d39caa142050db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124198
Reviewed-by: Michael Stahl 

diff --git a/xmloff/CppunitTest_xmloff_draw.mk 
b/xmloff/CppunitTest_xmloff_draw.mk
index 4ebac5c27a3b..46188eb0c438 100644
--- a/xmloff/CppunitTest_xmloff_draw.mk
+++ b/xmloff/CppunitTest_xmloff_draw.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,xmloff_draw))
 
 $(eval $(call gb_CppunitTest_use_externals,xmloff_draw,\
boost_headers \
+libxml2 \
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,xmloff_draw, \
diff --git a/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg 
b/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg
new file mode 100644
index ..757289d43849
Binary files /dev/null and b/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg 
differ
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index d386e92a2da6..3b0cda0f0383 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -9,21 +9,26 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
 constexpr OUStringLiteral DATA_DIRECTORY = u"/xmloff/qa/unit/data/";
 
 /// Covers xmloff/source/draw/ fixes.
-class XmloffDrawTest : public test::BootstrapFixture, public 
unotest::MacrosTest
+class XmloffDrawTest : public test::BootstrapFixture,
+   public unotest::MacrosTest,
+   public XmlTestTools
 {
 private:
 uno::Reference mxComponent;
@@ -31,6 +36,7 @@ private:
 public:
 void setUp() override;
 void tearDown() override;
+void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
 uno::Reference& getComponent() { return mxComponent; }
 };
 
@@ -49,6 +55,11 @@ void XmloffDrawTest::tearDown()
 test::BootstrapFixture::tearDown();
 }
 
+void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
+{
+XmlTestTools::registerODFNamespaces(pXmlXpathCtx);
+}
+
 CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
 {
 // Load a document that has a shape with a textbox in it. Save it to ODF 
and reload.
@@ -75,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
 CPPUNIT_ASSERT(bTextBox);
 }
 
+CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
+{
+// Load a document that has a custom shape with extrusion direction as set 
by LO as its default.
+OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf141301_Extrusion_Skew.odg";
+getComponent() = loadFromDesktop(aURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+
+// Prepare use of XPath
+uno::Reference xStorable(getComponent(), uno::UNO_QUERY);
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("draw8");
+xStorable->storeAsURL(aTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+uno::Reference xNameAccess
+= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, 
aTempFile.GetURL());
+uno::Reference 
xInputStream(xNameAccess->getByName("content.xml"),
+  uno::UNO_QUERY);
+std::unique_ptr 
pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
+xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+
+// Without fix draw:extrusion-skew="50 -135" was not written to file 
although "50 -135" is not
+// default in ODF, but only default inside LO.
+assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-skew", "50 
-135");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 93a340fe3473..cd76dcde65d3 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.

[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2021-11-01 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFilePicker.hxx |   18 ++---
 vcl/qt5/QtFilePicker.cxx |   57 +--
 2 files changed, 59 insertions(+), 16 deletions(-)

New commits:
commit fa9b28c781d4d3e97f7dcf150a0e22e70289c228
Author: Jan-Marek Glogowski 
AuthorDate: Sun Oct 31 11:03:36 2021 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Mon Nov 1 12:18:58 2021 +0100

Qt picker: implement XAsynchronousExecutableDialog

FWIW: most places still call FileDialogHelper::Execute instead of
StartExecuteModal. I tested with "Insert >> Text from File...".

Change-Id: I303cc89c97c8fc17015ab7831e6a324ef16a6a0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124512
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtFilePicker.hxx b/vcl/inc/qt5/QtFilePicker.hxx
index c1a95f5c64a0..20ee52e83ea0 100644
--- a/vcl/inc/qt5/QtFilePicker.hxx
+++ b/vcl/inc/qt5/QtFilePicker.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,10 +49,10 @@ class QGridLayout;
 class QLabel;
 class QWidget;
 
-typedef ::cppu::WeakComponentImplHelper
+typedef ::cppu::WeakComponentImplHelper<
+css::frame::XTerminateListener, css::lang::XInitialization, 
css::lang::XServiceInfo,
+css::ui::dialogs::XFilePicker3, css::ui::dialogs::XFilePickerControlAccess,
+css::ui::dialogs::XAsynchronousExecutableDialog, 
css::ui::dialogs::XFolderPicker2>
 QtFilePicker_Base;
 
 class VCLPLUG_QT_PUBLIC QtFilePicker : public QObject, public QtFilePicker_Base
@@ -62,6 +63,7 @@ private:
 css::uno::Reference m_context;
 
 css::uno::Reference m_xListener;
+css::uno::Reference 
m_xClosedListener;
 
 osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper
 
@@ -112,6 +114,11 @@ public:
 virtual void SAL_CALL setTitle(const OUString& rTitle) override;
 virtual sal_Int16 SAL_CALL execute() override;
 
+// XAsynchronousExecutableDialog functions
+virtual void SAL_CALL setDialogTitle(const OUString&) override;
+virtual void SAL_CALL
+startExecuteModal(const 
css::uno::Reference&) override;
+
 // XFilePicker functions
 virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
 virtual void SAL_CALL setDefaultName(const OUString& rName) override;
@@ -164,6 +171,8 @@ private:
 static void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction,
const css::uno::Any& rValue);
 
+void prepareExecute();
+
 private Q_SLOTS:
 // emit XFilePickerListener controlStateChanged event
 void filterSelected(const QString&);
@@ -171,6 +180,7 @@ private Q_SLOTS:
 void currentChanged(const QString&);
 // (un)set automatic file extension
 virtual void updateAutomaticFileExtension();
+void finished(int);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx
index ca80b61ef101..3fae63fca74f 100644
--- a/vcl/qt5/QtFilePicker.cxx
+++ b/vcl/qt5/QtFilePicker.cxx
@@ -116,6 +116,8 @@ 
QtFilePicker::QtFilePicker(css::uno::Reference cons
 // update automatic file extension when filter is changed
 connect(m_pFileDialog.get(), SIGNAL(filterSelected(const QString&)), this,
 SLOT(updateAutomaticFileExtension()));
+
+connect(m_pFileDialog.get(), SIGNAL(finished(int)), this, 
SLOT(finished(int)));
 }
 
 QtFilePicker::~QtFilePicker()
@@ -152,18 +154,8 @@ void SAL_CALL QtFilePicker::setTitle(const OUString& title)
 [this, &title]() { m_pFileDialog->setWindowTitle(toQString(title)); });
 }
 
-sal_Int16 SAL_CALL QtFilePicker::execute()
+void QtFilePicker::prepareExecute()
 {
-SolarMutexGuard g;
-auto* pSalInst(static_cast(GetSalData()->m_pInstance));
-assert(pSalInst);
-if (!pSalInst->IsMainThread())
-{
-sal_uInt16 ret;
-pSalInst->RunInMainThread([&ret, this]() { ret = execute(); });
-return ret;
-}
-
 QWidget* pTransientParent = m_pParentWidget;
 if (!pTransientParent)
 {
@@ -191,15 +183,56 @@ sal_Int16 SAL_CALL QtFilePicker::execute()
 m_pFileDialog->setParent(pTransientParent, m_pFileDialog->windowFlags());
 m_pFileDialog->show();
 xDesktop->addTerminateListener(this);
-int result = m_pFileDialog->exec();
+}
+
+void QtFilePicker::finished(int nResult)
+{
+uno::Reference 
xDesktop(css::frame::Desktop::create(m_context),
+  UNO_QUERY_THROW);
 xDesktop->removeTerminateListener(this);
 m_pFileDialog->setParent(nullptr, m_pFileDialog->windowFlags());
 
+if (m_xClosedListener.is())
+{
+const sal_Int16 nRet = (QFileDialog::Rejected == nResult) ? 
ExecutableDialogResults::CANCEL
+  : 
ExecutableDialogResults::OK;
+css::ui::dialogs::DialogClosedEvent aEvent(*this, nRet);
+m_xClosedLi

[Libreoffice-commits] core.git: include/sal

2021-11-01 Thread Jan-Marek Glogowski (via logerrit)
 include/sal/log.hxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit c8c11b55456df5b418848ac3159b9f370215bc09
Author: Jan-Marek Glogowski 
AuthorDate: Sun Oct 31 02:33:46 2021 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Nov 1 12:23:38 2021 +0100

Add SAL_DEBUG_IF

Change-Id: If2452cd4bad7266e7e07baaea26c58ef26ead5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124509
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/sal/log.hxx b/include/sal/log.hxx
index c64ea5079c81..5faeec3113dc 100644
--- a/include/sal/log.hxx
+++ b/include/sal/log.hxx
@@ -385,6 +385,17 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER 
StreamIgnore const &) {
 SAL_DETAIL_LOG_STREAM( \
 SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream)
 
+/**
+  Produce temporary debugging output from stream, if condition is true.  This
+  macro is meant to be used only while working on code and should never exist
+  in production code.
+
+  See @ref sal_log "basic logging functionality" for details.
+*/
+#define SAL_DEBUG_IF(condition, stream)   \
+SAL_DETAIL_LOG_STREAM( \
+(condition), ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream)
+
 /**
   Produce temporary debugging output from stream along with a backtrace of the
   calling location.


[Libreoffice-commits] core.git: 2 commits - basctl/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/moduldl2.cxx |   41 +---
 1 file changed, 24 insertions(+), 17 deletions(-)

New commits:
commit b424e32afe7e9ef72373bc4e0b9c65a9bbddbd70
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 10:39:14 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 12:45:14 2021 +0100

use freeze/thaw around a potentially long sequence of insertions

Change-Id: I151d172d65d4a74b57a64c4b5d904ef18145aede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124543
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index e962eb4e0824..7be53296159a 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -629,6 +629,7 @@ void LibPage::InsertLib()
 xLibDlg->SetStorageName(aURLObj.getName());
 weld::TreeView& rView = xLibDlg->GetLibBox();
 rView.make_unsorted();
+rView.freeze();
 
 const OUString* pLibNames = aLibNames.getConstArray();
 for (sal_Int32 i = 0 ; i < nLibCount; ++i)
@@ -645,6 +646,7 @@ void LibPage::InsertLib()
 }
 }
 
+rView.thaw();
 rView.make_sorted();
 
 if (rView.n_children())
commit 2ed921b0a56961c6937661258b44e1690c5f98d1
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 10:30:23 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 12:44:59 2021 +0100

Resolves: tdf#145391 insertion code assumes unsorted treeview

so assumed row index doesn't match real insertion point

presumably a problem since...

commit e8b3df5b9b0eb0a93c25b6dc2e445ae44a7e3f78
Date:   Fri Aug 2 14:57:49 2019 +0200

tdf#93476 Sort Macro library list after creating/importing a macro

Only set the widget as sorted in the ctor, it remains sorted

Change-Id: I6cefc43357f3215a49b33ff18befdc679c1749bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124542
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 
Reviewed-by: Caolán McNamara 

diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 42bcccebd67b..e962eb4e0824 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -622,28 +622,33 @@ void LibPage::InsertLib()
 
 Sequence< OUString > aLibNames = GetMergedLibraryNames( xModLibContImport, 
xDlgLibContImport );
 sal_Int32 nLibCount = aLibNames.getLength();
-const OUString* pLibNames = aLibNames.getConstArray();
-for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
+if (nLibCount)
 {
 // library import dialog
-if (!xLibDlg)
-{
-xLibDlg = std::make_shared(m_pDialog->getDialog());
-xLibDlg->SetStorageName( aURLObj.getName() );
-}
+xLibDlg = std::make_shared(m_pDialog->getDialog());
+xLibDlg->SetStorageName(aURLObj.getName());
+weld::TreeView& rView = xLibDlg->GetLibBox();
+rView.make_unsorted();
 
-// libbox entries
-OUString aLibName( pLibNames[ i ] );
-if ( !( ( xModLibContImport.is() && xModLibContImport->hasByName( 
aLibName ) && xModLibContImport->isLibraryLink( aLibName ) ) ||
-( xDlgLibContImport.is() && xDlgLibContImport->hasByName( 
aLibName ) && xDlgLibContImport->isLibraryLink( aLibName ) ) ) )
+const OUString* pLibNames = aLibNames.getConstArray();
+for (sal_Int32 i = 0 ; i < nLibCount; ++i)
 {
-weld::TreeView& rView = xLibDlg->GetLibBox();
-rView.append();
-const int nRow = rView.n_children() - 1;
-rView.set_toggle(nRow, TRISTATE_TRUE);
-rView.set_text(nRow, aLibName, 0);
-rView.set_cursor(rView.find_text(aLibName));
+// libbox entries
+OUString aLibName( pLibNames[ i ] );
+if ( !( ( xModLibContImport.is() && xModLibContImport->hasByName( 
aLibName ) && xModLibContImport->isLibraryLink( aLibName ) ) ||
+( xDlgLibContImport.is() && xDlgLibContImport->hasByName( 
aLibName ) && xDlgLibContImport->isLibraryLink( aLibName ) ) ) )
+{
+rView.append();
+const int nRow = rView.n_children() - 1;
+rView.set_toggle(nRow, TRISTATE_TRUE);
+rView.set_text(nRow, aLibName, 0);
+}
 }
+
+rView.make_sorted();
+
+if (rView.n_children())
+rView.set_cursor(0);
 }
 
 if (!xLibDlg)


[Libreoffice-commits] core.git: cui/source

2021-11-01 Thread Julien Nabet (via logerrit)
 cui/source/tabpages/align.cxx  |   18 +-
 cui/source/tabpages/numfmt.cxx |8 
 2 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 11db4fa6227a721b483d35f939dc2425c09a42c8
Author: Julien Nabet 
AuthorDate: Mon Nov 1 09:53:59 2021 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 1 13:01:08 2021 +0100

Provide values for debug in cui

Change-Id: Ifda9ddae8c7ee946f01dfa0b6fc0bba59a9c8a22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124538
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index a57abd2b949e..68550fe1b94f 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -41,15 +41,15 @@ namespace svx {
 
 const WhichRangesContainer AlignmentTabPage::s_pRanges(
 svl::Items<
-SID_ATTR_ALIGN_STACKED, SID_ATTR_ALIGN_LINEBREAK,
-SID_ATTR_ALIGN_INDENT, SID_ATTR_ALIGN_INDENT,
-SID_ATTR_ALIGN_DEGREES, SID_ATTR_ALIGN_DEGREES,
-SID_ATTR_ALIGN_LOCKPOS, SID_ATTR_ALIGN_LOCKPOS,
-SID_ATTR_ALIGN_HYPHENATION, SID_ATTR_ALIGN_HYPHENATION,
-SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION,
-SID_ATTR_ALIGN_ASIANVERTICAL, SID_ATTR_ALIGN_ASIANVERTICAL,
-SID_ATTR_ALIGN_SHRINKTOFIT, SID_ATTR_ALIGN_SHRINKTOFIT,
-SID_ATTR_ALIGN_HOR_JUSTIFY, SID_ATTR_ALIGN_VER_JUSTIFY>);
+SID_ATTR_ALIGN_STACKED, SID_ATTR_ALIGN_LINEBREAK, // 10229 - 10230
+SID_ATTR_ALIGN_INDENT, SID_ATTR_ALIGN_INDENT, // 10460 - 10460
+SID_ATTR_ALIGN_DEGREES, SID_ATTR_ALIGN_DEGREES, // 10577 - 10577
+SID_ATTR_ALIGN_LOCKPOS, SID_ATTR_ALIGN_LOCKPOS, // 10578 - 10578
+SID_ATTR_ALIGN_HYPHENATION, SID_ATTR_ALIGN_HYPHENATION, // 10931 - 10931
+SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION, // 10944 - 10944
+SID_ATTR_ALIGN_ASIANVERTICAL, SID_ATTR_ALIGN_ASIANVERTICAL, // 10949 - 
10949
+SID_ATTR_ALIGN_SHRINKTOFIT, SID_ATTR_ALIGN_SHRINKTOFIT, // 11015 - 11015
+SID_ATTR_ALIGN_HOR_JUSTIFY, SID_ATTR_ALIGN_VER_JUSTIFY>); // 11571 - 11572
 
 
 namespace {
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 3eab0a4e6219..3058847d3c8a 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -56,10 +56,10 @@ using ::com::sun::star::uno::UNO_QUERY;
 
 const WhichRangesContainer SvxNumberFormatTabPage::pRanges(
 svl::Items<
-SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
-SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
-SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
-SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE>);
+SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, // 10085 - 10086
+SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA, // 10580 - 
10580
+SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, // 
10700 - 10700
+SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE>); // 10932 - 
10932
 
 /*
 #*  Method:SvxNumberPreview


[Libreoffice-commits] core.git: chart2/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 chart2/source/tools/InternalData.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit ed1ac6bb6660b5f84e184ed3571c8b25596e8631
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 10:51:26 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 13:08:43 2021 +0100

add a comment referencing gcc#103022

Change-Id: Iccb7d5dccdd77563244e2262834274a548b369bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124544
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/chart2/source/tools/InternalData.cxx 
b/chart2/source/tools/InternalData.cxx
index 2cd8d309d6cd..143a097d0c25 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -69,6 +69,7 @@ private:
 template< typename T >
 Sequence< T > lcl_ValarrayToSequence( const std::valarray< T > & rValarray 
)
 {
+// workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103022
 if (!size(rValarray))
 return Sequence();
 


[Libreoffice-commits] core.git: i18npool/source

2021-11-01 Thread Jan-Marek Glogowski (via logerrit)
 i18npool/source/registerservices/registerservices.cxx |  437 +++---
 1 file changed, 176 insertions(+), 261 deletions(-)

New commits:
commit b34a8f977cf043153dd56a7f83b25e0b11b7a523
Author: Jan-Marek Glogowski 
AuthorDate: Thu Oct 28 13:10:37 2021 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Nov 1 13:34:45 2021 +0100

Group per-locale functions instead by type

... and also sort them.

Gets rid of a lot of #ifdef cpp macro lines.

Also unifies the macros as "MACRO( id )" for easier readability.

Additionally drops the "// add here new services !!" comment at
the end of the transliteration instance list, as items were added
all other the place in various patches.

Change-Id: I040b3b0952ec2aef2d1d10e7282cfd11afa6b702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124441
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/i18npool/source/registerservices/registerservices.cxx 
b/i18npool/source/registerservices/registerservices.cxx
index f382caadd038..18695c70a443 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -104,219 +104,154 @@ i18npool_##ImplName##_get_implementation( \
 // -Wl,--gc_sections. It's mainly for iOS and Android that the
 // --with-locales option is intended anyway.
 
-IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier )
-IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier_asian )
-#if WITH_LOCALE_ALL || WITH_LOCALE_ja
-IMPL_UNO_CONSTRUCTOR_CTX( 
IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable )
-IMPL_UNO_CONSTRUCTOR_CTX( 
IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant )
-IMPL_UNO_CONSTRUCTOR_CTX( 
IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable )
-IMPL_UNO_CONSTRUCTOR_CTX( 
IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant )
-#endif
-IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier_Unicode )
-IMPL_UNO_CONSTRUCTOR_CTX( CalendarImpl )
+IMPL_CREATEINSTANCE( ignoreDiacritics_CTL )
+IMPL_CREATEINSTANCE( ignoreKashida_CTL )
+IMPL_CREATEINSTANCE( NumToCharIndic_ar )
+IMPL_CREATEINSTANCE( NumToTextCircledNumber )
+IMPL_CREATEINSTANCE( Transliteration_l2u )
+IMPL_CREATEINSTANCE( Transliteration_sentencecase )
+IMPL_CREATEINSTANCE( Transliteration_titlecase )
+IMPL_CREATEINSTANCE( Transliteration_togglecase )
+IMPL_CREATEINSTANCE( Transliteration_u2l )
+IMPL_UNO_CONSTRUCTOR( Calendar_buddhist )
+IMPL_UNO_CONSTRUCTOR( Calendar_dangi )
+IMPL_UNO_CONSTRUCTOR( Calendar_gengou )
 IMPL_UNO_CONSTRUCTOR( Calendar_gregorian )
 IMPL_UNO_CONSTRUCTOR( Calendar_hanja )
 IMPL_UNO_CONSTRUCTOR( Calendar_hanja_yoil )
-IMPL_UNO_CONSTRUCTOR( Calendar_gengou )
-IMPL_UNO_CONSTRUCTOR( Calendar_ROC )
-IMPL_UNO_CONSTRUCTOR( Calendar_dangi )
 IMPL_UNO_CONSTRUCTOR( Calendar_hijri )
 IMPL_UNO_CONSTRUCTOR( Calendar_jewish )
-IMPL_UNO_CONSTRUCTOR( Calendar_buddhist )
-#if WITH_LOCALE_ALL || WITH_LOCALE_ja
-IMPL_UNO_CONSTRUCTOR( BreakIterator_ja )
-#endif
-#if WITH_LOCALE_ALL || WITH_LOCALE_zh
-IMPL_UNO_CONSTRUCTOR( BreakIterator_zh )
-IMPL_UNO_CONSTRUCTOR( BreakIterator_zh_TW )
-#endif
-#if WITH_LOCALE_ALL || WITH_LOCALE_ko
-IMPL_UNO_CONSTRUCTOR( BreakIterator_ko )
-#endif
-#if WITH_LOCALE_ALL || WITH_LOCALE_th
-IMPL_UNO_CONSTRUCTOR( BreakIterator_th )
-#endif
-IMPL_UNO_CONSTRUCTOR_CTX( ChapterCollator )
+IMPL_UNO_CONSTRUCTOR( Calendar_ROC )
+IMPL_UNO_CONSTRUCTOR( CharToNumEastIndic_ar )
+IMPL_UNO_CONSTRUCTOR( CharToNumIndic_ar )
 IMPL_UNO_CONSTRUCTOR( Collator_Unicode )
+IMPL_UNO_CONSTRUCTOR_CTX( CalendarImpl )
+IMPL_UNO_CONSTRUCTOR_CTX( ChapterCollator )
+IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier )
+IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier_asian )
+IMPL_UNO_CONSTRUCTOR_CTX( IndexEntrySupplier_Unicode )
+IMPL_UNO_CONSTRUCTOR( NumToCharEastIndic_ar )
 
-#if WITH_LOCALE_ALL || WITH_LOCALE_th
-IMPL_UNO_CONSTRUCTOR( InputSequenceChecker_th )
-#endif
 #if WITH_LOCALE_ALL || WITH_LOCALE_hi
+IMPL_CREATEINSTANCE( NumToCharIndic_hi )
+IMPL_UNO_CONSTRUCTOR( CharToNumIndic_hi )
 IMPL_UNO_CONSTRUCTOR( InputSequenceChecker_hi )
 #endif
-#if WITH_LOCALE_ALL || WITH_LOCALE_ko
-IMPL_UNO_CONSTRUCTOR_CTX( TextConversion_ko )
-#endif
-#if WITH_LOCALE_ALL || WITH_LOCALE_zh
-IMPL_UNO_CONSTRUCTOR_CTX( TextConversion_zh )
-#endif
 
-IMPL_CREATEINSTANCE( Transliteration_u2l )
-IMPL_CREATEINSTANCE( Transliteration_l2u )
-IMPL_CREATEINSTANCE( Transliteration_sentencecase )
-IMPL_CREATEINSTANCE( Transliteration_titlecase )
-IMPL_CREATEINSTANCE( Transliteration_togglecase )
 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
-IMPL_CREATEINSTANCE( hiraganaToKatakana )
-IMPL_CREATEINSTANCE( katakanaToHiragana )
 IMPL_CREATEINSTANCE( fullwidthToHalfwidth )
 IMPL_CREATEINSTANCE( halfwidthToFullwidth )
-#endif
-
-#if WITH_LOCALE_ALL || WITH_LOCALE_ja
-IMPL_CREATEINSTANCE( smallToLarge_ja_JP)
-IMPL_CREATEINSTANCE( largeToSmall_ja_JP)
-IMPL_CREATEINSTANCE( ignoreTraditionalKanji_ja_JP)
-IMPL_CREATEINSTANCE( ignoreTraditionalKana_ja_JP)
-

[Libreoffice-commits] core.git: sc/source

2021-11-01 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 3b977328dfbe613d925dc52c22e36b7e15a34ada
Author: Kevin Suo 
AuthorDate: Mon Nov 1 14:15:19 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Nov 1 13:44:48 2021 +0100

tdf#138475: also set font size/weight/posture for CJK/CTL languages...

when parsing the default Calc styles.

As an initial matter, orcus currently does not support XML_font_size_asian,
XML_font_size_complex, XML_font_weight_asian, XML_font_weight_complex etc 
in:

https://gitlab.com/orcus/orcus/-/blob/master/src/liborcus/odf_styles_context.cpp#L128

While this need to be improved by Orcus, actually in Calc we provide
the default font attributes in sc/res/xml/styles.xml and it makes no
sense to set different font size/weight/posture for each language type.
As a result we apply the same font attributes of latin to all these
languages.

Change-Id: I1b105fecce45aa22c6b72e15305e25dc6669d2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index f809edb816cd..65ace1c123ed 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1362,9 +1362,13 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 {
 FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
 rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CJK_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CTL_FONT_POSTURE));
 
 FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL;
 rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CJK_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CTL_FONT_WEIGHT));
 
 rSet.Put( SvxColorItem(maColor, ATTR_FONT_COLOR));
 
@@ -1372,6 +1376,8 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, maName, maName, 
PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
 
 rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CJK_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CTL_FONT_HEIGHT));
 }
 
 if (mbHasUnderlineAttr)


[Libreoffice-commits] help.git: source/text

2021-11-01 Thread Rafael Lima (via logerrit)
 source/text/sbasic/shared/03/sf_calc.xhp |  234 +--
 1 file changed, 196 insertions(+), 38 deletions(-)

New commits:
commit 94e3719169db094d5efd3a952461bd08a806f0f7
Author: Rafael Lima 
AuthorDate: Thu Oct 28 19:20:47 2021 +0200
Commit: Rafael Lima 
CommitDate: Mon Nov 1 13:51:28 2021 +0100

Update SF_Calc service help page

This patch documents the properties "Region" and "XSheetCellCursor", as 
well as the new methods "A1Style", "CreateChart" and "Charts".

Change-Id: Ia3a5be356271ac0bb1d298de31f1d3d270f9382e
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124199
Tested-by: Jenkins
Reviewed-by: Rafael Lima 

diff --git a/source/text/sbasic/shared/03/sf_calc.xhp 
b/source/text/sbasic/shared/03/sf_calc.xhp
index 1dbf6c509..ed0bcda04 100644
--- a/source/text/sbasic/shared/03/sf_calc.xhp
+++ b/source/text/sbasic/shared/03/sf_calc.xhp
@@ -317,6 +317,23 @@
 A range reference that can be used as argument of methods like 
CopyToRange
 
 
+
+
+Region
+
+
+Yes
+
+
+RangeName As String
+
+
+String
+
+
+Returns the address of the smallest area that contains the 
specified range so that the area is surrounded by empty cells or sheet edges. 
This is equivalent to applying the Ctrl + * shortcut to the 
given range.
+
+
 
 
 Sheet
@@ -385,6 +402,23 @@
 A com.sun.star.Table.XCellRange UNO 
object
 
 
+
+
+XSheetCellCursor
+
+
+Yes
+
+
+RangeName As String
+
+
+Object
+
+
+A 
com.sun.star.sheet.XSheetCellCursor UNO object. After moving 
the cursor, the resulting range address can be accessed through the 
AbsoluteName UNO property of the cursor object, which 
returns a string value that can be used as argument for properties and methods 
of the Calc service.
+
+
 
 
 XSpreadsheet
@@ -399,12 +433,12 @@
 Object
 
 
-A com.sun.star.sheet.XSpreadsheet UNO 
object
+A com.sun.star.sheet.XSpreadsheet UNO 
object
 
 
 
 
-  Visit LibreOffice API Documentation's 
website to learn more about https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1table_1_1XCellRange.html";
 name="XCellRange API">XCellRange and https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSpreadsheet.html";
 name="XSpreadsheet API">XSpreadsheet UNO objects.
+  Visit LibreOffice API Documentation's 
website to learn more about https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1table_1_1XCellRange.html";
 name="XCellRange API">XCellRange, https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSheetCellCursor.html";
 name="XSheetCellCursor API">XSheetCellCursor and https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSpreadsheet.html";
 name="XSpreadsheet API">XSpreadsheet UNO objects.
 
   Methods
   
@@ -414,7 +448,9 @@



+ A1Style
  Activate
+ Charts
  ClearAll
  ClearFormats
  ClearValues
@@ -422,12 +458,13 @@
  CopySheetFromFile
  CopyToCell
  CopyToRange
- DAvg
- DCount
+ CreateChart




+ DAvg
+ DCount
  DMax
  DMin
  DSum
@@ -437,11 +474,11 @@
  GetValue
  ImportFromCSVFile
  ImportFromDatabase
- InsertSheet




+ InsertSheet
  MoveRange
  MoveSheet
  Offset
@@ -457,13 +494,52 @@

 
 
+
+   A1Style 
---
 
+  
+Calc service;A1Style
+  
+  A1Style
+  Returns a range 
address as a string based on sheet coordinates, i.e. row and column 
numbers.
+  If only a pair of 
coordinates is given, then an address to a single cell is returned. Additional 
arguments can specify the bottom-right cell of a rectangular range.
+  
+  
+svc.A1Style(row1: int, column1: int, row2: int = 0; column2: int = 
0; sheetname: str = "~"): str
+  
+  
+  row1, 
column1: Specify the row and column numbers of the top-left cell in the 
range to be considered. Row and column numbers start at 1.
+  row2, 
column2: Specify the row and column numbers of the bottom-right cell in 
the range to be considered. If these arguments are not provided, or if values 
smaller than row1 and column1 are given, 
then the address of the single cell range represented b

[Libreoffice-commits] core.git: helpcontent2

2021-11-01 Thread Rafael Lima (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 65eb101e23a740657f1d2c9c7dc0b7ac6453998b
Author: Rafael Lima 
AuthorDate: Mon Nov 1 14:51:29 2021 +0200
Commit: Gerrit Code Review 
CommitDate: Mon Nov 1 13:51:29 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 94e3719169db094d5efd3a952461bd08a806f0f7
  - Update SF_Calc service help page

This patch documents the properties "Region" and "XSheetCellCursor", as 
well as the new methods "A1Style", "CreateChart" and "Charts".

Change-Id: Ia3a5be356271ac0bb1d298de31f1d3d270f9382e
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124199
Tested-by: Jenkins
Reviewed-by: Rafael Lima 

diff --git a/helpcontent2 b/helpcontent2
index 081aa4f6de2c..94e3719169db 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 081aa4f6de2c2f6388267883e68966b9da02981f
+Subproject commit 94e3719169db094d5efd3a952461bd08a806f0f7


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - external/gpgmepp

2021-11-01 Thread Mike Kaganski (via logerrit)
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |  
  1 
 external/gpgmepp/gpgme.git-4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e.patch.1 |  
 32 ++
 2 files changed, 33 insertions(+)

New commits:
commit 1b7fa9180c256874d225a33878a09412f30c7b07
Author: Mike Kaganski 
AuthorDate: Fri Oct 8 17:06:01 2021 +0300
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 14:48:26 2021 +0100

Fix gpgmepp build with glibc

posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:492:23: error: void value not ignored as it ought to be
  492 | while ((i = closefrom (fd)) && errno == EINTR)
  |   ^
make[1]: *** [Makefile:964: posix-io.lo] Error 1

Change-Id: I0e7abc33200ca7436c72e925447e681fd241c6a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123259
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit f60214a1ad45f947d063e4cfdbeb86bd819ab87c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124470
Reviewed-by: Caolán McNamara 

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index 2e9eb3d826ff..b314357734ab 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -34,5 +34,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
 external/gpgmepp/c++20.patch \
 external/gpgmepp/clang-cl.patch \
 external/gpgmepp/configure.patch \
+
external/gpgmepp/gpgme.git-4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e.patch.1 \
 ))
 # vim: set noet sw=4 ts=4:
diff --git 
a/external/gpgmepp/gpgme.git-4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e.patch.1 
b/external/gpgmepp/gpgme.git-4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e.patch.1
new file mode 100644
index ..8b12c1785ccf
--- /dev/null
+++ 
b/external/gpgmepp/gpgme.git-4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e.patch.1
@@ -0,0 +1,32 @@
+From 4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e Mon Sep 17 00:00:00 2001
+From: Jiri Kucera 
+Date: Sun, 25 Jul 2021 11:35:54 +0200
+Subject: [PATCH] core: Support closefrom also for glibc.
+
+* src/posix-io.c (_gpgme_io_spawn): Use glibc's closefrom.
+--
+
+Since 2.34, glibc introduces closefrom (the implementation
+follows *BSD standard).
+
+Signed-off-by: Werner Koch 
+---
+ src/posix-io.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix-io.c b/src/posix-io.c
+index e712ef28..2a3a81fc 100644
+--- a/src/posix-io.c
 b/src/posix-io.c
+@@ -570,7 +570,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], 
unsigned int flags,
+   if (fd_list[i].fd > fd)
+ fd = fd_list[i].fd;
+ fd++;
+-#if defined(__sun) || defined(__FreeBSD__)
++#if defined(__sun) || defined(__FreeBSD__) || defined(__GLIBC__)
+ closefrom (fd);
+ max_fds = fd;
+ #else /*!__sun */
+-- 
+2.11.0
+


[Libreoffice-commits] core.git: solenv/sanitizers

2021-11-01 Thread Caolán McNamara (via logerrit)
 solenv/sanitizers/ui/dbaccess.suppr |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 96ba1a40037b75ebe43daccaf4f4d7849cf02fa3
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 11:33:09 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 14:48:45 2021 +0100

drop unused suppression

Change-Id: I7486a3998e998382565ba454d4262584233777fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124545
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/solenv/sanitizers/ui/dbaccess.suppr 
b/solenv/sanitizers/ui/dbaccess.suppr
index 7133494fb7bb..cf67d5b78842 100644
--- a/solenv/sanitizers/ui/dbaccess.suppr
+++ b/solenv/sanitizers/ui/dbaccess.suppr
@@ -27,7 +27,6 @@ 
dbaccess/uiconfig/ui/generalpagedialog.ui://GtkLabel[@id='specialMessage'] orpha
 dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='headerText'] 
orphan-label
 dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='helpText'] 
orphan-label
 dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='sourceTypeHeader'] 
orphan-label
-dbaccess/uiconfig/ui/generalpagewizard.ui://GtkComboBoxText[@id='datasourceType']
 no-labelled-by
 dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='specialMessage'] 
orphan-label
 dbaccess/uiconfig/ui/indexdesigndialog.ui://GtkLabel[@id='DESC_LABEL'] 
orphan-label
 dbaccess/uiconfig/ui/indexdesigndialog.ui://GtkLabel[@id='DESCRIPTION'] 
orphan-label


[Libreoffice-commits] core.git: Branch 'feature/cib_contract138c' - include/o3tl

2021-11-01 Thread Stephan Bergmann (via logerrit)
 include/o3tl/cppunittraitshelper.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 88910a02acf7a006ff3b1556c7cd5c6fde77db34
Author: Stephan Bergmann 
AuthorDate: Thu Oct 29 08:09:50 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Nov 1 15:01:01 2021 +0100

Use the underlying type of char16_t

Change-Id: I5f48f1f3dc379cc57cfeac473f80bec4c4bc38af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104989
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit c8b93a478dc420398b3f70724422a551bb743a70)

diff --git a/include/o3tl/cppunittraitshelper.hxx 
b/include/o3tl/cppunittraitshelper.hxx
index d9f75a61b4c8..2a6fb8836238 100644
--- a/include/o3tl/cppunittraitshelper.hxx
+++ b/include/o3tl/cppunittraitshelper.hxx
@@ -12,6 +12,7 @@
 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -19,7 +20,7 @@
 // ostream << char16_t is deleted since C++20 (but just keep outputting 
numeric values):
 template <> inline std::string 
CppUnit::assertion_traits::toString(char16_t const& x)
 {
-return assertion_traits::toString(unsigned(x));
+return 
assertion_traits::toString(std::uint_least16_t(x));
 }
 
 #endif


[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig

2021-11-01 Thread Caolán McNamara (via logerrit)
 dbaccess/source/ui/control/sqledit.cxx   |   67 ++-
 dbaccess/source/ui/dlg/directsql.cxx |2 
 dbaccess/source/ui/inc/sqledit.hxx   |   11 +++
 dbaccess/source/ui/querydesign/QueryTextView.cxx |2 
 dbaccess/uiconfig/ui/directsqldialog.ui  |4 +
 dbaccess/uiconfig/ui/queryview.ui|4 +
 6 files changed, 83 insertions(+), 7 deletions(-)

New commits:
commit 7624730e3d0197071fe4f904900fecedf8140d67
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 11:48:13 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 15:05:00 2021 +0100

Resolves: tdf#144793 add scrollbar to sql editview

Change-Id: I23126a89c136a134590900c38ccd589fb4ea29a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124546
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/dbaccess/source/ui/control/sqledit.cxx 
b/dbaccess/source/ui/control/sqledit.cxx
index a61f9d81eab3..a55664513e86 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -68,12 +68,14 @@ private:
 SQLEditView& editor_;
 };
 
-SQLEditView::SQLEditView()
-: m_aUpdateDataTimer("dbaccess SQLEditView m_aUpdateDataTimer")
+SQLEditView::SQLEditView(std::unique_ptr xScrolledWindow)
+: m_xScrolledWindow(std::move(xScrolledWindow))
+, m_aUpdateDataTimer("dbaccess SQLEditView m_aUpdateDataTimer")
 , m_aHighlighter(HighlighterLanguage::SQL)
 , m_bInUpdate(false)
 , m_bDisableInternalUndo(false)
 {
+m_xScrolledWindow->connect_vadjustment_changed(LINK(this, SQLEditView, 
ScrollHdl));
 }
 
 void SQLEditView::DisableInternalUndo()
@@ -129,6 +131,7 @@ void SQLEditView::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 
 
rEditEngine.SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::L2R);
 rEditEngine.SetModifyHdl(LINK(this, SQLEditView, ModifyHdl));
+rEditEngine.SetStatusEventHdl(LINK(this, SQLEditView, EditStatusHdl));
 
 m_aUpdateDataTimer.SetTimeout(150);
 m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SQLEditView, 
ImplUpdateDataHdl));
@@ -432,6 +435,66 @@ bool SQLEditView::Command(const CommandEvent& rCEvt)
 return WeldEditView::Command(rCEvt);
 }
 
+void SQLEditView::EditViewScrollStateChange()
+{
+// editengine height has changed or editview scroll pos has changed
+SetScrollBarRange();
+}
+
+void SQLEditView::SetScrollBarRange()
+{
+EditEngine *pEditEngine = GetEditEngine();
+if (!pEditEngine)
+return;
+if (!m_xScrolledWindow)
+return;
+EditView* pEditView = GetEditView();
+if (!pEditView)
+return;
+
+int nVUpper = pEditEngine->GetTextHeight();
+int nVCurrentDocPos = pEditView->GetVisArea().Top();
+const Size aOut(pEditView->GetOutputArea().GetSize());
+int nVStepIncrement = aOut.Height() * 2 / 10;
+int nVPageIncrement = aOut.Height() * 8 / 10;
+int nVPageSize = aOut.Height();
+
+/* limit the page size to below nUpper because gtk's 
gtk_scrolled_window_start_deceleration has
+   effectively...
+
+   lower = gtk_adjustment_get_lower
+   upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
+
+   and requires that upper > lower or the deceleration animation never ends
+*/
+nVPageSize = std::min(nVPageSize, nVUpper);
+
+m_xScrolledWindow->vadjustment_configure(nVCurrentDocPos, 0, nVUpper,
+ nVStepIncrement, nVPageIncrement, 
nVPageSize);
+}
+
+IMPL_LINK_NOARG(SQLEditView, ScrollHdl, weld::ScrolledWindow&, void)
+{
+DoScroll();
+}
+
+IMPL_LINK_NOARG(SQLEditView, EditStatusHdl, EditStatus&, void)
+{
+Resize();
+}
+
+void SQLEditView::DoScroll()
+{
+if (m_xEditView)
+{
+auto currentDocPos = m_xEditView->GetVisArea().Top();
+auto nDiff = currentDocPos - 
m_xScrolledWindow->vadjustment_get_value();
+// we expect SetScrollBarRange callback to be triggered by Scroll
+// to set where we ended up
+m_xEditView->Scroll(0, nDiff);
+}
+}
+
 void SQLEditView::ConfigurationChanged(utl::ConfigurationBroadcaster*, 
ConfigurationHints)
 {
 UpdateData();
diff --git a/dbaccess/source/ui/dlg/directsql.cxx 
b/dbaccess/source/ui/dlg/directsql.cxx
index 604cb1716d02..709ac414fdfe 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -51,7 +51,7 @@ namespace dbaui
 , m_xShowOutput(m_xBuilder->weld_check_button("showoutput"))
 , m_xOutput(m_xBuilder->weld_text_view("output"))
 , m_xClose(m_xBuilder->weld_button("close"))
-, m_xSQL(new SQLEditView)
+, m_xSQL(new 
SQLEditView(m_xBuilder->weld_scrolled_window("scrolledwindow", true)))
 , m_xSQLEd(new weld::CustomWeld(*m_xBuilder, "sql", *m_xSQL))
 , m_nStatusCount(1)
 , m_xConnection(_rxConn)
diff --git a/dbaccess/source/ui/inc/sqledit.hxx 
b/dbaccess/source/ui/inc/sqledit.hxx
index 99d5e636c24e.

[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - vcl/source

2021-11-01 Thread Armin Le Grand (Allotropia) (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 907e8435184995535d2d99c116b35af445281bea
Author: Armin Le Grand (Allotropia) 
AuthorDate: Mon Nov 1 16:00:44 2021 +0100
Commit: Armin Le Grand (Allotropia) 
CommitDate: Mon Nov 1 16:00:44 2021 +0100

Disable PDF-to-PDF embedding on PDF export (hack), part III

Corrected creation of PDF export for Bitmap/BitmapEx
which needs a createObject call in createBitmapEmit
in all cases where no embedded PDF is written

Change-Id: Ic0da0139d99b273f61c0164ac3615e288986bc94

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 9173a94ab0dd..4e67d8846d02 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9517,8 +9517,15 @@ const PDFWriterImpl::BitmapEmit& 
PDFWriterImpl::createBitmapEmit( const BitmapEx
 m_aBitmaps.push_front( BitmapEmit() );
 m_aBitmaps.front().m_aID= aID;
 m_aBitmaps.front().m_aBitmap= aBitmap;
-if (!rGraphic.hasPdfData() || m_aContext.UseReferenceXObject)
-m_aBitmaps.front().m_nObject = createObject();
+
+static bool 
bAllowPdfToPdf(officecfg::Office::Common::VCL::AllowPdfToPdfEmbedding::get());
+const bool bHasPdfDFata(bAllowPdfToPdf && rGraphic.hasPdfData());
+
+if (!bHasPdfDFata || m_aContext.UseReferenceXObject)
+{
+ m_aBitmaps.front().m_nObject = createObject();
+}
+
 createEmbeddedFile(rGraphic, m_aBitmaps.front().m_aReferenceXObject, 
m_aBitmaps.front().m_nObject);
 it = m_aBitmaps.begin();
 }


[Libreoffice-commits] help.git: source/text

2021-11-01 Thread Andrea Gelmini (via logerrit)
 source/text/sbasic/shared/03/sf_calc.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 236b3987893c6a9e6c78f2efee411a18d4c85a7e
Author: Andrea Gelmini 
AuthorDate: Mon Nov 1 16:12:23 2021 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 1 16:14:21 2021 +0100

Fix typo

Change-Id: I3694de1a379960fd2c927d0f80e512c42d3fd6d6
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124553
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/source/text/sbasic/shared/03/sf_calc.xhp 
b/source/text/sbasic/shared/03/sf_calc.xhp
index ed0bcda04..79c3060ae 100644
--- a/source/text/sbasic/shared/03/sf_calc.xhp
+++ b/source/text/sbasic/shared/03/sf_calc.xhp
@@ -853,7 +853,7 @@
   Calc service;CreateChart
   
   CreateChart
-  Creates a new chart 
object showing the data in the specified range. The returned chart object can 
be futher manipulated using the Chart service.
+  Creates a new chart 
object showing the data in the specified range. The returned chart object can 
be further manipulated using the Chart service.
   
   
 svc.CreateChart(chartname: str, sheetname: str, range: str, 
columnheader: bool = False, rowheader: bool = False): obj


[Libreoffice-commits] core.git: helpcontent2

2021-11-01 Thread Andrea Gelmini (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0c55ea82aadbccb667e436ea9f44f4796991ae01
Author: Andrea Gelmini 
AuthorDate: Mon Nov 1 16:14:22 2021 +0100
Commit: Gerrit Code Review 
CommitDate: Mon Nov 1 16:14:22 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 236b3987893c6a9e6c78f2efee411a18d4c85a7e
  - Fix typo

Change-Id: I3694de1a379960fd2c927d0f80e512c42d3fd6d6
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124553
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/helpcontent2 b/helpcontent2
index 94e3719169db..236b3987893c 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 94e3719169db094d5efd3a952461bd08a806f0f7
+Subproject commit 236b3987893c6a9e6c78f2efee411a18d4c85a7e


[Libreoffice-commits] help.git: source/text

2021-11-01 Thread Andrea Gelmini (via logerrit)
 source/text/sbasic/shared/03/sf_chart.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ddbff6c13a02f9b58d0274c2215adfbdd3020fad
Author: Andrea Gelmini 
AuthorDate: Mon Nov 1 16:14:33 2021 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 1 16:17:06 2021 +0100

Fix typo

Change-Id: I9dc167e31f706ba8769147fcdb6e10c21ae71a31
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124554
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/source/text/sbasic/shared/03/sf_chart.xhp 
b/source/text/sbasic/shared/03/sf_chart.xhp
index 62136eeeb..cfd4526f8 100644
--- a/source/text/sbasic/shared/03/sf_chart.xhp
+++ b/source/text/sbasic/shared/03/sf_chart.xhp
@@ -474,7 +474,7 @@
 xpos, 
ypos: Specify the new X and Y positions of the chart. If any of these 
values are omitted or if negative values are provided, the corresponding 
positions are left unchanged.
 width: 
Specify the new width of the chart. If this argument is omitted or if a 
negative value is provided, the chart width is left unchanged.
 height: Specify the new height of the 
chart. If this argument is omitted or if a negative value is provided, the 
chart height is left unchanged.
-All arguments are provided as integer 
values that correspond to 1/100 of a millimiter.
+All arguments are provided as integer 
values that correspond to 1/100 of a millimeter.
 
 
 


[Libreoffice-commits] core.git: helpcontent2

2021-11-01 Thread Andrea Gelmini (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ccf6075b39c754c1efbdb5fb141f4fda8b460536
Author: Andrea Gelmini 
AuthorDate: Mon Nov 1 16:17:07 2021 +0100
Commit: Gerrit Code Review 
CommitDate: Mon Nov 1 16:17:07 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to ddbff6c13a02f9b58d0274c2215adfbdd3020fad
  - Fix typo

Change-Id: I9dc167e31f706ba8769147fcdb6e10c21ae71a31
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124554
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/helpcontent2 b/helpcontent2
index 236b3987893c..ddbff6c13a02 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 236b3987893c6a9e6c78f2efee411a18d4c85a7e
+Subproject commit ddbff6c13a02f9b58d0274c2215adfbdd3020fad


[Libreoffice-commits] core.git: wizards/source

2021-11-01 Thread Jean-Pierre Ledure (via logerrit)
 wizards/source/scriptforge/SF_PythonHelper.xba   |1 
 wizards/source/scriptforge/python/scriptforge.py |3 +
 wizards/source/sfdocuments/SF_Calc.xba   |   69 +++
 3 files changed, 73 insertions(+)

New commits:
commit 59372ead7ee158cdc6f2f08e4008c06697e91139
Author: Jean-Pierre Ledure 
AuthorDate: Mon Nov 1 15:07:42 2021 +0100
Commit: Jean-Pierre Ledure 
CommitDate: Mon Nov 1 16:39:23 2021 +0100

ScriptForge - (SF_Calc) new GetRangeAddress() method

The GetRangeAddress() method accepts 2 arguments:
  GetRangeAddress(Range, AddressItem)

- a range as a string, to be understood as the extended definition
  described in the help pages

- the item to be extracted from the given range, either:
firstrow
firstcol
lastrow
lastcol
sheet

The returned value is either:
- a Long
- a String when sheet is requested
- an array of all these values when no item is given

The method is available for both Basic and Python user scripts

Change-Id: I6156b176e29cf47207a079d10552443467dd2f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124551
Tested-by: Jean-Pierre Ledure 
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure 

diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba 
b/wizards/source/scriptforge/SF_PythonHelper.xba
index 5b919ba5abe1..f32e077d83d0 100644
--- a/wizards/source/scriptforge/SF_PythonHelper.xba
+++ b/wizards/source/scriptforge/SF_PythonHelper.xba
@@ -777,6 +777,7 @@ Try:
Select Case Script
Case "Charts" 
:   vReturn = vBasicObject.Charts(vArgs(0), vArgs(1))
Case "Forms"  
:   vReturn = vBasicObject.Forms(vArgs(0), vArgs(1))
+   Case 
"GetRangeAddress":   vReturn = 
vBasicObject.GetRangeAddress(vArgs(0), vArgs(1))
Case 
"GetFormula" :   vReturn = 
vBasicObject.GetFormula(vArgs(0))
Case 
"GetValue"   :   vReturn = 
vBasicObject.GetValue(vArgs(0))
Case 
"SetArray"   :   vReturn = 
vBasicObject.SetArray(vArgs(0), vArgs(1))
diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index 4643ade07229..ebd33ab9a7f2 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1974,6 +1974,9 @@ class SFDocuments:
 def GetFormula(self, range):
 return self.ExecMethod(self.vbMethod + self.flgArrayRet, 
'GetFormula', range)
 
+def GetRangeAddress(self, range, addressitem = ''):
+return self.ExecMethod(self.vbMethod + self.flgArrayArg, 
'GetRangeAddress', range, addressitem)
+
 def GetValue(self, range):
 return self.ExecMethod(self.vbMethod + self.flgArrayRet, 
'GetValue', range)
 
diff --git a/wizards/source/sfdocuments/SF_Calc.xba 
b/wizards/source/sfdocuments/SF_Calc.xba
index 75642598fa66..6fc937c93637 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -1314,6 +1314,74 @@ Catch:
GoTo Finally
 End Function   '  SFDocuments.SF_Calc.GetProperty
 
+REM 
-
+Public Function GetRangeAddress(Optional ByVal Range As Variant _
+   , Optional ByVal 
AddressItem As Variant _
+   ) As Variant
+''' Extracts from a range expressed in A1-style one or more 
of its coordinates
+''' Args:
+''' Range: the range as a string from which to 
extract the coordinates
+''' AddressItem: either "firstrow", 
"firstcol" (topleft cell), "lastrow", "lastcol" 
(bottom right cell), "sheet" or omitted
+''' Returns:
+''' Either:
+''' - one of the cell coordinates as a Long 
(coordinates start with 1)
+''' when Range is a single cell, 
row2 and row1 return the same value
+''' - the sheet name as a string
+''' - all of them as a zero-based array in 
the order firstrow, firstcol, lastrow, lastcol, sheet
+''' Exceptions:
+''' Examples:
+''' row2 = 
oDoc.GetRangeAddress("'$SheetX'.E2:J4", "row2")   
 '  4
+''' arr = 
oDoc.GetRangeAddress("'$SheetX'.E2:J4") 
  '  (2, 5, 4, 10, "SheetX")
+
+Dim vRangeAddress As Variant   '  Return value
+Dim oAddress As Object   

[Libreoffice-commits] core.git: cui/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 cui/source/tabpages/align.cxx |   59 +++---
 1 file changed, 44 insertions(+), 15 deletions(-)

New commits:
commit 2bd6876f0f4596eb4ffad1109ca0c2896f9bda84
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 14:53:49 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 17:11:35 2021 +0100

tdf#138698 remove/ignore 'distributed' if feature is unknown

which it is in dbaccess. Its is a calc feature added at...

commit 755ad6834625488c5d31d4bacc9370eae7ffd8f3
Date:   Tue Oct 5 11:15:56 2010 -0400

Ported calc-distributed-cell-text-*.diff from ooo-build.

Change-Id: I1e8856e2ab635d270a487f5a68ac5c386f46a080
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124552
Tested-by: Julien Nabet 
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Reviewed-by: Caolán McNamara 

diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 68550fe1b94f..3db4e5c20ca5 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -56,7 +56,7 @@ namespace {
 
 template
 void lcl_MaybeResetAlignToDistro(
-weld::ComboBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, 
sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock)
+weld::ComboBox& rLB, sal_uInt16 nListId, const SfxItemSet& rCoreAttrs, 
sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock)
 {
 const SfxPoolItem* pItem;
 if (rCoreAttrs.GetItemState(nWhichAlign, true, &pItem) != 
SfxItemState::SET)
@@ -78,14 +78,19 @@ void lcl_MaybeResetAlignToDistro(
 if (eMethod == SvxCellJustifyMethod::Distribute)
 {
 // Select the 'distribute' entry in the specified list box.
-rLB.set_active(nListPos);
+rLB.set_active_id(OUString::number(nListId));
 }
 }
 
-void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, const SfxItemSet& 
rOldSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListPos)
+void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, const SfxItemSet& 
rOldSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListId)
 {
+// tdf#138698 unsupported, e.g. dbaccess
+if (rLB.find_id(OUString::number(nListId)) == -1)
+return;
+
+// feature supported , e.g. calc
 SvxCellJustifyMethod eJM = SvxCellJustifyMethod::Auto;
-if (rLB.get_active() == nListPos)
+if (rLB.get_active_id().toInt32() == nListId)
 eJM = SvxCellJustifyMethod::Distribute;
 
 // tdf#129300 If it would create no change, don't force it
@@ -615,19 +620,43 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
 }
 }
 
-
 // Special treatment for distributed alignment; we need to set the justify
 // method to 'distribute' to distinguish from the normal justification.
+sal_uInt16 nHorJustifyMethodWhich = 
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
+SfxItemState eHorJustifyMethodState = 
pCoreAttrs->GetItemState(nHorJustifyMethodWhich);
+if (eHorJustifyMethodState == SfxItemState::UNKNOWN)
+{
+// feature unknown, e.g. dbaccess, remove the option
+int nDistribId = 
m_xLbHorAlign->find_id(OUString::number(ALIGNDLG_HORALIGN_DISTRIBUTED));
+if (nDistribId != -1)
+m_xLbHorAlign->remove(nDistribId);
+}
+else
+{
+// feature known, e.g. calc
+lcl_MaybeResetAlignToDistro(
+*m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *pCoreAttrs,
+GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), nHorJustifyMethodWhich,
+SvxCellHorJustify::Block);
+}
 
-lcl_MaybeResetAlignToDistro(
-*m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *pCoreAttrs,
-GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), 
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
-SvxCellHorJustify::Block);
-
-lcl_MaybeResetAlignToDistro(
-*m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *pCoreAttrs,
-GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), 
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
-SvxCellVerJustify::Block);
+sal_uInt16 nVerJustifyMethodWhich = 
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
+SfxItemState eVerJustifyMethodState = 
pCoreAttrs->GetItemState(nVerJustifyMethodWhich);
+if (eVerJustifyMethodState == SfxItemState::UNKNOWN)
+{
+// feature unknown, e.g. dbaccess, remove the option
+int nDistribId = 
m_xLbVerAlign->find_id(OUString::number(ALIGNDLG_VERALIGN_DISTRIBUTED));
+if (nDistribId != -1)
+m_xLbVerAlign->remove(nDistribId);
+}
+else
+{
+// feature known, e.g. calc
+lcl_MaybeResetAlignToDistro(
+*m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *pCoreAttrs,
+GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), nVerJustifyMethodWhich,
+SvxCellVerJustify::Block);
+}
 
 m_xLbHorAlign->save_value();
 m_xLbFrameDir->save_value();
@@ -668,7 +697,7 @@ void AlignmentTabPage::InitVsRefEgde()
 
 void Alignmen

[Libreoffice-commits] core.git: sc/source

2021-11-01 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputwin.cxx |9 +
 sc/source/ui/inc/inputwin.hxx |1 +
 2 files changed, 10 insertions(+)

New commits:
commit 32ecb028dc7c803750eabaa27ffd1257e3f53eb2
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 12:59:01 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 17:11:50 2021 +0100

multiline calc inputbar not redrawing and adjusting scrollbar on delete of 
text

backspace is ok, but with delete when a line is deleted the scrolled up
lines are visually duplicated at the bottom

Change-Id: I22e91aa3c3213876d36c593cae7989e8913bffc3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124548
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 32412c39b1be..b601fc4d5c34 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1599,6 +1599,7 @@ void ScTextWnd::InitEditEngine()
 lcl_ModifyRTLVisArea( m_xEditView.get() );
 
 m_xEditEngine->SetModifyHdl(LINK(this, ScTextWnd, ModifyHdl));
+m_xEditEngine->SetStatusEventHdl(LINK(this, ScTextWnd, EditStatusHdl));
 
 if (!maAccTextDatas.empty())
 maAccTextDatas.back()->StartEdit();
@@ -1874,6 +1875,13 @@ IMPL_LINK_NOARG(ScTextWnd, ModifyHdl, LinkParamNone*, 
void)
 }
 }
 
+IMPL_LINK_NOARG(ScTextWnd, EditStatusHdl, EditStatus&, void)
+{
+SetScrollBarRange();
+DoScroll();
+Invalidate();
+}
+
 void ScTextWnd::StopEditEngine( bool bAll )
 {
 if (!m_xEditEngine)
@@ -1891,6 +1899,7 @@ void ScTextWnd::StopEditEngine( bool bAll )
 aString = m_xEditEngine->GetText();
 bIsInsertMode = m_xEditView->IsInsertMode();
 bool bSelection = m_xEditView->HasSelection();
+m_xEditEngine->SetStatusEventHdl(Link());
 m_xEditEngine->SetModifyHdl(Link());
 m_xEditView.reset();
 m_xEditEngine.reset();
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index aa90dc7c4f3e..0e056fa22c29 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -111,6 +111,7 @@ public:
 void DoScroll();
 
 DECL_LINK(ModifyHdl, LinkParamNone*, void);
+DECL_LINK(EditStatusHdl, EditStatus&, void);
 
 protected:
 virtual voidPaint( vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect ) override;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-01 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 836e37bac767ce6eea4b0e0c9342976e8238cc46
Author: Kevin Suo 
AuthorDate: Mon Nov 1 14:15:19 2021 +0800
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 17:20:38 2021 +0100

tdf#138475: also set font size/weight/posture for CJK/CTL languages...

when parsing the default Calc styles.

As an initial matter, orcus currently does not support XML_font_size_asian,
XML_font_size_complex, XML_font_weight_asian, XML_font_weight_complex etc 
in:

https://gitlab.com/orcus/orcus/-/blob/master/src/liborcus/odf_styles_context.cpp#L128

While this need to be improved by Orcus, actually in Calc we provide
the default font attributes in sc/res/xml/styles.xml and it makes no
sense to set different font size/weight/posture for each language type.
As a result we apply the same font attributes of latin to all these
languages.

Change-Id: I1b105fecce45aa22c6b72e15305e25dc6669d2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 3b977328dfbe613d925dc52c22e36b7e15a34ada)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124472
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 35fb72548a4c..78b9563bc842 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1360,9 +1360,13 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 {
 FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
 rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CJK_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CTL_FONT_POSTURE));
 
 FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL;
 rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CJK_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CTL_FONT_WEIGHT));
 
 rSet.Put( SvxColorItem(maColor, ATTR_FONT_COLOR));
 
@@ -1370,6 +1374,8 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, maName, maName, 
PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
 
 rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CJK_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CTL_FONT_HEIGHT));
 }
 
 if (mbHasUnderlineAttr)


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - configure.ac

2021-11-01 Thread Thorsten Behrens (via logerrit)
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 76cc615ae6759837a093fee2c86b6e89bfb69bdf
Author: Thorsten Behrens 
AuthorDate: Mon Nov 1 17:43:53 2021 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Nov 1 17:43:53 2021 +0100

Bump version to 6.1.7.27

Change-Id: I53fcefa45bc215cd3a0fc62f95f4a9d852c1ac46

diff --git a/configure.ac b/configure.ac
index ec0b543369c3..8aee3d6d8c69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for 
the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no 
idea.
 
-AC_INIT([LibreOffice powered by 
CIB],[6.1.7.26],[],[],[https://libreoffice.cib.eu/])
+AC_INIT([LibreOffice powered by 
CIB],[6.1.7.27],[],[],[https://libreoffice.cib.eu/])
 
 AC_PREREQ([2.59])
 


[Libreoffice-commits] core.git: cui/source sw/source

2021-11-01 Thread Andrea Gelmini (via logerrit)
 cui/source/dialogs/insdlg.cxx|1 -
 sw/source/core/frmedt/fecopy.cxx |1 -
 2 files changed, 2 deletions(-)

New commits:
commit 428385fb870eefe5584dd9c59c0df077369759eb
Author: Andrea Gelmini 
AuthorDate: Fri Oct 29 14:25:58 2021 +0200
Commit: Julien Nabet 
CommitDate: Mon Nov 1 18:01:10 2021 +0100

Removed duplicated includes

Change-Id: I5414710ceee7a572173eae43c906e91e86b7a01f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124433
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 868d9a4f26fd..eddc80a83b09 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -46,7 +46,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index fff8c546317c..7a57c5f4e709 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -70,7 +70,6 @@
 #include 
 #include 
 #include 
-#include 
 
 using namespace ::com::sun::star;
 


[Libreoffice-commits] core.git: wizards/source

2021-11-01 Thread Andrea Gelmini (via logerrit)
 wizards/source/sfdocuments/SF_Calc.xba |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dd3c70cea6d4577d2cd01285c8b5c635a89b7e90
Author: Andrea Gelmini 
AuthorDate: Thu Oct 28 11:42:30 2021 +0200
Commit: Julien Nabet 
CommitDate: Mon Nov 1 18:04:04 2021 +0100

Fix typo

Change-Id: Ida6978ed843615504fac7ce0a0a6a08a66f10367
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124320
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/wizards/source/sfdocuments/SF_Calc.xba 
b/wizards/source/sfdocuments/SF_Calc.xba
index 6fc937c93637..38ef4e843cef 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -235,7 +235,7 @@ End Property'  SFDocuments.SF_Calc.Range
 REM 
-
 Property Get Region(Optional ByVal RangeName As Variant) As String
 ''' Returns the smallest area as a range string that 
contains the given range
-''' and which is compeletely surrounded with empty cells
+''' and which is completely surrounded with empty cells
Region = _PropertyGet("Region", RangeName)
 End Property   '  SFDocuments.SF_Calc.Region
 
@@ -3736,4 +3736,4 @@ CatchDuplicate:
 End Function   '  SFDocuments.SF_Calc._ValidateSheet
 
 REM  END OF SFDOCUMENTS.SF_CALC
-
\ No newline at end of file
+


[Libreoffice-commits] core.git: external/curl

2021-11-01 Thread Michael Stahl (via logerrit)
 external/curl/UnpackedTarball_curl.mk |1 +
 external/curl/curl-debug.patch.1  |   11 +++
 2 files changed, 12 insertions(+)

New commits:
commit 68a3df2f1282f40fa4accaed21a69a84d76be37d
Author: Michael Stahl 
AuthorDate: Fri Oct 1 17:42:09 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:12:59 2021 +0100

curl: patch invalid format string in debug log

This causes:
soffice.bin: sendf.c:243: Curl_infof: Assertion `!strchr(fmt, '\n')' failed.

Change-Id: I5a78b2225f6769cc49025e1e73ce72cd3d6bec16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122963
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/external/curl/UnpackedTarball_curl.mk 
b/external/curl/UnpackedTarball_curl.mk
index 2cdfbfc08632..642dd3113730 100644
--- a/external/curl/UnpackedTarball_curl.mk
+++ b/external/curl/UnpackedTarball_curl.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,curl,\
external/curl/curl-msvc-disable-protocols.patch.1 \
external/curl/curl-7.26.0_win-proxy.patch \
external/curl/zlib.patch.0 \
+   external/curl/curl-debug.patch.1 \
 ))
 
 ifeq ($(SYSTEM_NSS),)
diff --git a/external/curl/curl-debug.patch.1 b/external/curl/curl-debug.patch.1
new file mode 100644
index ..a000913ed335
--- /dev/null
+++ b/external/curl/curl-debug.patch.1
@@ -0,0 +1,11 @@
+--- curl/lib/vtls/nss.c.orig   2021-10-01 17:34:59.302663021 +0200
 curl/lib/vtls/nss.c2021-10-01 17:35:55.37010 +0200
+@@ -955,7 +955,7 @@
+   subject = CERT_NameToAscii(&cert->subject);
+   issuer = CERT_NameToAscii(&cert->issuer);
+   common_name = CERT_GetCommonName(&cert->subject);
+-  infof(data, "subject: %s\n", subject);
++  infof(data, "subject: %s", subject);
+ 
+   CERT_GetCertTimes(cert, ¬Before, ¬After);
+   PR_ExplodeTime(notBefore, PR_GMTParameters, &printableTime);


[Libreoffice-commits] core.git: comphelper/source

2021-11-01 Thread Michael Stahl (via logerrit)
 comphelper/source/streaming/seqoutputstreamserv.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 1a3b3eda6ca1c8e063ba6db9e9f34f999ec92c49
Author: Michael Stahl 
AuthorDate: Mon Oct 4 17:16:59 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:13:23 2021 +0100

comphelper: fix SequenceOutputStreamService::getWrittenBytes()

With com.sun.star.io.Pipe, you must call closeOutput() or reading from
the other end will block forever.

If you use com.sun.star.io.SequenceOutputStream, you can't read the output
after calling closeOutput() on it because for no good reason it throws
a NotConnectedException.

Let's just fix it so that a sequence of closeOutput() then
getWrittenBytes() returns the finished buffer.

Change-Id: Ia6ce28ec05e00e5f1c703dea8669e0271c0b9c20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123057
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx 
b/comphelper/source/streaming/seqoutputstreamserv.cxx
index d1ffc4df2d42..84900014aad4 100644
--- a/comphelper/source/streaming/seqoutputstreamserv.cxx
+++ b/comphelper/source/streaming/seqoutputstreamserv.cxx
@@ -112,6 +112,7 @@ void SAL_CALL SequenceOutputStreamService::closeOutput()
 if ( !m_xOutputStream.is() )
 throw io::NotConnectedException();
 
+m_xOutputStream->flush();
 m_xOutputStream->closeOutput();
 m_xOutputStream.clear();
 }
@@ -120,10 +121,13 @@ void SAL_CALL SequenceOutputStreamService::closeOutput()
 uno::Sequence< ::sal_Int8 > SAL_CALL 
SequenceOutputStreamService::getWrittenBytes()
 {
 std::scoped_lock aGuard( m_aMutex );
-if ( !m_xOutputStream.is() )
-throw io::NotConnectedException();
 
-m_xOutputStream->flush();
+if (m_xOutputStream.is())
+{
+m_xOutputStream->flush();
+}
+// else: no exception, just return the finished sequence
+
 return m_aSequence;
 }
 


[Libreoffice-commits] core.git: configure.ac

2021-11-01 Thread Michael Stahl (via logerrit)
 configure.ac |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b0e0fa1d2aee653586e1803bc30447b066e6cc66
Author: Michael Stahl 
AuthorDate: Fri Sep 10 14:37:41 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:14:17 2021 +0100

configure: add --with-webdav=curl

Change-Id: Id5cbeb9924b8e80b3b88f77fee2efd8457b5c302
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122043
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/configure.ac b/configure.ac
index cecc4993641f..a21c8ec9bc60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2398,7 +2398,7 @@ AC_ARG_WITH(system-liblangtag,
 AC_ARG_WITH(webdav,
 AS_HELP_STRING([--with-webdav],
 [Specify which library to use for webdav implementation.
- Possible values: "neon", "serf", "no". The default value is "neon".
+ Possible values: "neon", "serf", "curl", "no". The default value is 
"neon".
  Example: --with-webdav="serf"]))
 
 AC_ARG_WITH(linker-hash-style,
@@ -10873,6 +10873,13 @@ fi
 
 AC_MSG_CHECKING([for webdav library])
 case "$WITH_WEBDAV" in
+curl)
+AC_MSG_RESULT([curl])
+# curl is already mandatory (almost) and checked elsewhere
+if test "$enable_curl" = "no"; then
+AC_MSG_ERROR(["--with-webdav=curl conflicts with --disable-curl"])
+fi
+;;
 serf)
 AC_MSG_RESULT([serf])
 # Check for system apr-util


[Libreoffice-commits] core.git: solenv/clang-format ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 solenv/clang-format/excludelist  |   30 
 ucb/Library_ucpdav1.mk   |   25 
 ucb/source/ucp/webdav-curl/ContentProperties.cxx |  593 +++
 ucb/source/ucp/webdav-curl/ContentProperties.hxx |  181 +
 ucb/source/ucp/webdav-curl/DAVAuthListener.hxx   |   43 
 ucb/source/ucp/webdav-curl/DAVAuthListenerImpl.hxx   |   61 
 ucb/source/ucp/webdav-curl/DAVException.hxx  |  165 
 ucb/source/ucp/webdav-curl/DAVProperties.cxx |  222 +
 ucb/source/ucp/webdav-curl/DAVProperties.hxx |   57 
 ucb/source/ucp/webdav-curl/DAVRequestEnvironment.hxx |   54 
 ucb/source/ucp/webdav-curl/DAVResource.hxx   |   59 
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx | 1116 ++
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |  207 +
 ucb/source/ucp/webdav-curl/DAVSession.hxx|  202 +
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx |   86 
 ucb/source/ucp/webdav-curl/DAVSessionFactory.hxx |   68 
 ucb/source/ucp/webdav-curl/DAVTypes.hxx  |   77 
 ucb/source/ucp/webdav-curl/DateTimeHelper.cxx|  258 +
 ucb/source/ucp/webdav-curl/DateTimeHelper.hxx|   55 
 ucb/source/ucp/webdav-curl/PropertyMap.hxx   |   55 
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx  |  526 +++
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx  |   57 
 ucb/source/ucp/webdav-curl/ucpdav1.component |   26 
 ucb/source/ucp/webdav-curl/webdavcontent.cxx | 3292 +++
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |  266 +
 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |  602 +++
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx|  467 ++
 ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx|   73 
 ucb/source/ucp/webdav-curl/webdavprovider.cxx|  177 +
 ucb/source/ucp/webdav-curl/webdavprovider.hxx|  101 
 ucb/source/ucp/webdav-curl/webdavresponseparser.cxx  |  897 +
 ucb/source/ucp/webdav-curl/webdavresponseparser.hxx  |   38 
 ucb/source/ucp/webdav-curl/webdavresultset.cxx   |   76 
 ucb/source/ucp/webdav-curl/webdavresultset.hxx   |   48 
 34 files changed, 10260 insertions(+)

New commits:
commit 3afa1858a8a3d00ab6e03367f8cdf6cef2b511b2
Author: Michael Stahl 
AuthorDate: Fri Sep 10 14:29:23 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:14:49 2021 +0100

ucb: copy upper level code of serf webdav ucp to webdav-curl

Change-Id: Ia621e504d234d0904b40c7cd9aba49849c2ee859
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122044
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index c771d6abfc37..42ae6cd2921f 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -13988,6 +13988,36 @@ ucb/source/ucp/tdoc/tdoc_storage.cxx
 ucb/source/ucp/tdoc/tdoc_storage.hxx
 ucb/source/ucp/tdoc/tdoc_uri.cxx
 ucb/source/ucp/tdoc/tdoc_uri.hxx
+ucb/source/ucp/webdav-curl/ContentProperties.cxx
+ucb/source/ucp/webdav-curl/ContentProperties.hxx
+ucb/source/ucp/webdav-curl/DAVAuthListener.hxx
+ucb/source/ucp/webdav-curl/DAVAuthListenerImpl.hxx
+ucb/source/ucp/webdav-curl/DAVException.hxx
+ucb/source/ucp/webdav-curl/DAVProperties.cxx
+ucb/source/ucp/webdav-curl/DAVProperties.hxx
+ucb/source/ucp/webdav-curl/DAVRequestEnvironment.hxx
+ucb/source/ucp/webdav-curl/DAVResource.hxx
+ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
+ucb/source/ucp/webdav-curl/DAVSession.hxx
+ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx
+ucb/source/ucp/webdav-curl/DAVTypes.hxx
+ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
+ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
+ucb/source/ucp/webdav-curl/PropertyMap.hxx
+ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx
+ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx
+ucb/source/ucp/webdav-curl/webdavcontent.cxx
+ucb/source/ucp/webdav-curl/webdavcontent.hxx
+ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
+ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
+ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx
+ucb/source/ucp/webdav-curl/webdavprovider.cxx
+ucb/source/ucp/webdav-curl/webdavprovider.hxx
+ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
+ucb/source/ucp/webdav-curl/webdavresultset.cxx
+ucb/source/ucp/webdav-curl/webdavresultset.hxx
+ucb/source/ucp/webdav-curl/webdavservices.cxx
 ucb/source/ucp/webdav-neon/ContentProperties.cxx
 ucb/source/ucp/webdav-neon/ContentProperties.hxx
 ucb/source/ucp/webdav-neon/DAVAuthListener.hxx
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 127d046eb72b..6d66bce7d89a 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -27,6 +27,30 @@ $(eval $(call gb_Library_use_libraries,ucpdav1,\
tl \
 ))
 
+ifeq ($(WITH_WEBDAV),curl)
+
+$(eval $(call 
gb_Library_set_componentfile,ucpdav1,ucb/source/ucp/webdav-curl/ucpdav1))
+
+$(eval $(call gb_Library_use

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/ContentProperties.cxx|2 
 ucb/source/ucp/webdav-curl/DAVProperties.cxx|   63 ++--
 ucb/source/ucp/webdav-curl/DAVProperties.hxx|   26 
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx|4 -
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx|2 
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx|2 
 ucb/source/ucp/webdav-curl/DateTimeHelper.cxx   |   28 
 ucb/source/ucp/webdav-curl/DateTimeHelper.hxx   |2 
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx |   38 
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx |   17 -
 ucb/source/ucp/webdav-curl/webdavcontent.cxx|   42 ++---
 ucb/source/ucp/webdav-curl/webdavcontent.hxx|4 -
 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx|4 -
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx   |3 
 ucb/source/ucp/webdav-curl/webdavprovider.cxx   |9 --
 ucb/source/ucp/webdav-curl/webdavprovider.hxx   |4 -
 ucb/source/ucp/webdav-curl/webdavresponseparser.cxx |   12 ++-
 17 files changed, 103 insertions(+), 159 deletions(-)

New commits:
commit dca684d8f87e766c91de2dec0f9ac0d2822f4217
Author: Michael Stahl 
AuthorDate: Mon Sep 13 12:11:32 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:15:28 2021 +0100

ucb: webdav-curl: fix [loplugin:*]

Change-Id: I357f8594a404eb17a0126359bdc5b2b4c6543de6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122045
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index 85406e680972..c3d663434869 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -141,7 +141,7 @@ ContentProperties::ContentProperties()
 
 ContentProperties::ContentProperties( const ContentProperties & rOther )
 : m_aEscapedTitle( rOther.m_aEscapedTitle ),
-  m_xProps( rOther.m_xProps.get()
+  m_xProps( rOther.m_xProps
 ? new PropertyValueMap( *rOther.m_xProps )
 : new PropertyValueMap ),
   m_bTrailingSlash( rOther.m_bTrailingSlash )
diff --git a/ucb/source/ucp/webdav-curl/DAVProperties.cxx 
b/ucb/source/ucp/webdav-curl/DAVProperties.cxx
index a08a8488da15..746c82ad993d 100644
--- a/ucb/source/ucp/webdav-curl/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVProperties.cxx
@@ -17,70 +17,47 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
 #include "DAVProperties.hxx"
 #include 
+#include 
+#include 
 
 using namespace http_dav_ucp;
 
-const OUString DAVProperties::CREATIONDATE =
-OUString( "DAV:creationdate" );
-const OUString DAVProperties::DISPLAYNAME =
-OUString( "DAV:displayname" );
-const OUString DAVProperties::GETCONTENTLANGUAGE =
-OUString( "DAV:getcontentlanguage" );
-const OUString DAVProperties::GETCONTENTLENGTH =
-OUString( "DAV:getcontentlength" );
-const OUString DAVProperties::GETCONTENTTYPE =
-OUString( "DAV:getcontenttype" );
-const OUString DAVProperties::GETETAG =
-OUString( "DAV:getetag" );
-const OUString DAVProperties::GETLASTMODIFIED =
-OUString( "DAV:getlastmodified" );
-const OUString DAVProperties::LOCKDISCOVERY =
-OUString( "DAV:lockdiscovery" );
-const OUString DAVProperties::RESOURCETYPE =
-OUString( "DAV:resourcetype" );
-const OUString DAVProperties::SUPPORTEDLOCK =
-OUString( "DAV:supportedlock" );
-
-const OUString DAVProperties::EXECUTABLE =
-OUString( "http://apache.org/dav/props/executable"; );
-
 
 // static
-void DAVProperties::createSerfPropName( const OUString & rFullName,
+void DAVProperties::createSerfPropName( ::std::u16string_view const rFullName,
 SerfPropName & rName )
 {
-if ( rFullName.startsWith( "DAV:" ) )
+if (o3tl::starts_with(rFullName, u"DAV:"))
 {
 rName.nspace = "DAV:";
 rName.name
 = strdup( OUStringToOString(
-rFullName.copy( RTL_CONSTASCII_LENGTH( "DAV:" ) ),
+rFullName.substr(RTL_CONSTASCII_LENGTH("DAV:")),
 RTL_TEXTENCODING_UTF8 ).getStr() );
 }
-else if ( rFullName.startsWith( "http://apache.org/dav/props/"; ) )
+else if (o3tl::starts_with(rFullName, u"http://apache.org/dav/props/";))
 {
 rName.nspace = "http://apache.org/dav/props/";;
 rName.name
 = strdup( OUStringToOString(
-rFullName.copy(
+rFullName.substr(
 RTL_CONSTASCII_LENGTH(
 "http://apache.org/dav/props/"; ) ),
 RTL_TEXTENCODING_UTF8 ).getStr() );
 }

[Libreoffice-commits] core.git: solenv/clang-format ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 solenv/clang-format/excludelist  |2 
 ucb/Library_ucpdav1.mk   |1 
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |  218 +++
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |   88 ++
 4 files changed, 309 insertions(+)

New commits:
commit a48ccb4c14664e23fbb2c8c1603c82772e5e476e
Author: Michael Stahl 
AuthorDate: Mon Sep 27 13:09:43 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:15:54 2021 +0100

ucb: copy SerfLockStore class to webdav-curl

Change-Id: If7b12af542a369c0179ff3460f64ece61a63c1ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122891
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 42ae6cd2921f..a70248a605ea 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14005,6 +14005,8 @@ ucb/source/ucp/webdav-curl/DAVTypes.hxx
 ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
 ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
 ucb/source/ucp/webdav-curl/PropertyMap.hxx
+ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+ucb/source/ucp/webdav-curl/SerfLockStore.hxx
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx
 ucb/source/ucp/webdav-curl/webdavcontent.cxx
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 6d66bce7d89a..5d1634e67190 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-curl/DAVResourceAccess \
ucb/source/ucp/webdav-curl/DAVSessionFactory \
ucb/source/ucp/webdav-curl/DateTimeHelper \
+   ucb/source/ucp/webdav-curl/SerfLockStore \
ucb/source/ucp/webdav-curl/UCBDeadPropertyValue \
ucb/source/ucp/webdav-curl/webdavcontent \
ucb/source/ucp/webdav-curl/webdavcontentcaps \
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
new file mode 100644
index ..ec2f6ae1bea7
--- /dev/null
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include "SerfSession.hxx"
+#include "SerfLockStore.hxx"
+
+using namespace http_dav_ucp;
+
+namespace http_dav_ucp {
+
+class TickerThread : public osl::Thread
+{
+bool m_bFinish;
+SerfLockStore & m_rLockStore;
+
+public:
+
+explicit TickerThread( SerfLockStore & rLockStore )
+: osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
+
+void finish() { m_bFinish = true; }
+
+protected:
+
+virtual void SAL_CALL run() override;
+};
+
+} // namespace http_dav_ucp
+
+
+void TickerThread::run()
+{
+osl_setThreadName("http_dav_ucp::TickerThread");
+
+SAL_INFO("ucb.ucp.webdav",  "TickerThread: start." );
+
+// we have to go through the loop more often to be able to finish ~quickly
+const int nNth = 25;
+
+int nCount = nNth;
+while ( !m_bFinish )
+{
+if ( nCount-- <= 0 )
+{
+m_rLockStore.refreshLocks();
+nCount = nNth;
+}
+
+TimeValue aTV;
+aTV.Seconds = 0;
+aTV.Nanosec = 10 / nNth;
+wait( aTV );
+}
+
+SAL_INFO("ucb.ucp.webdav",  "TickerThread: stop." );
+}
+
+
+SerfLockStore::SerfLockStore()
+: m_pTickerThread( nullptr )
+, m_bFinishing( false )
+{
+}
+
+
+SerfLockStore::~SerfLockStore()
+{
+stopTicker();
+m_bFinishing = true;
+
+// release active locks, if any.
+SAL_WARN_IF( !m_aLockInfoMap.empty(), "ucb.ucp.webdav",
+"SerfLockStore::~SerfLockStore - Releasing active locks!" );
+
+for ( auto& rLockInfo : m_aLockInfoMap )
+{
+rLockInfo.second.m_xSession->UNLOCK( rLockInfo.first );
+}
+}
+
+bool SerfLockStore::finishing() const
+{
+return m_bFinishing;
+}
+
+void SerfLockStore::startTicker()
+{
+osl::MutexGuard aGuard( m_aMutex );
+
+if ( !m_pTickerThread )
+  

[Libreoffice-commits] core.git: configure.ac include/sal ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 configure.ac  |2 
 include/sal/log-areas.dox |1 
 ucb/Library_ucpdav1.mk|1 
 ucb/source/ucp/webdav-curl/ContentProperties.cxx  |4 
 ucb/source/ucp/webdav-curl/CurlUri.cxx|  285 ++
 ucb/source/ucp/webdav-curl/CurlUri.hxx|   87 ++
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx  |   10 
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx  |4 
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx  |6 
 ucb/source/ucp/webdav-curl/webdavcontent.cxx  |   26 +-
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx |   10 
 ucb/source/ucp/webdav-curl/webdavprovider.hxx |4 
 12 files changed, 407 insertions(+), 33 deletions(-)

New commits:
commit 617fbb5fd39e668453588d1b72bfc92a9c648552
Author: Michael Stahl 
AuthorDate: Mon Sep 13 13:20:51 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:16:23 2021 +0100

ucb: webdav-curl: implement CurlUri, partially based on SerfUri

The curl_url* functions exist since 7.62.0 and CURLOPT_CURLU since
7.63.0.

Change-Id: I8bc766221636eb3ff0d33ae5a90d00c1bc7ecd7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122046
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/configure.ac b/configure.ac
index a21c8ec9bc60..2c7ed9fb3aec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10284,7 +10284,7 @@ if test "$enable_curl" = "yes" -a "$with_system_curl" = 
"yes"; then
 SYSTEM_CURL=TRUE
 
 # First try PKGCONFIG and then fall back
-PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
+PKG_CHECK_MODULES(CURL, libcurl >= 7.63.0,, [:])
 
 if test -n "$CURL_PKG_ERRORS"; then
 AC_PATH_PROG(CURLCONFIG, curl-config)
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index aa3e64d793bd..55f15022f340 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -432,6 +432,7 @@ certain functionality.
 @li @c ucb.ucp.ftp
 @li @c ucb.ucp.gio
 @li @c ucb.ucp.webdav
+@li @c ucb.ucp.webdav.curl
 
 @section unotools
 
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 5d1634e67190..c4c739773d13 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_Library_use_externals,ucpdav1,\
 
 $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-curl/ContentProperties \
+   ucb/source/ucp/webdav-curl/CurlUri \
ucb/source/ucp/webdav-curl/DAVProperties \
ucb/source/ucp/webdav-curl/DAVResourceAccess \
ucb/source/ucp/webdav-curl/DAVSessionFactory \
diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index c3d663434869..362af841c7be 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -19,7 +19,7 @@
 
 #include 
 #include 
-#include "SerfUri.hxx"
+#include "CurlUri.hxx"
 #include "DAVResource.hxx"
 #include "DAVProperties.hxx"
 #include "DateTimeHelper.hxx"
@@ -83,7 +83,7 @@ ContentProperties::ContentProperties( const DAVResource& 
rResource )
 // Title
 try
 {
-SerfUri aURI( rResource.uri );
+CurlUri const aURI( rResource.uri );
 m_aEscapedTitle = aURI.GetPathBaseName();
 
 (*m_xProps)[ OUString( "Title" ) ]
diff --git a/ucb/source/ucp/webdav-curl/CurlUri.cxx 
b/ucb/source/ucp/webdav-curl/CurlUri.cxx
new file mode 100644
index ..5ab41db8d756
--- /dev/null
+++ b/ucb/source/ucp/webdav-curl/CurlUri.cxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "CurlUri.hxx"
+
+#include 
+#include 
+#include 
+
+#include 
+
+namespace http_dav_ucp
+{
+const auto DEFAULT_HTTP_PORT = 80;
+const auto DEFAULT_HTTPS_PORT = 443;
+
+static ::std::optional GetURLComponent(CURLU& rURI, CURLUPart const 
what,
+ CURLUcode const expected,
+ unsigned int const fl

[Libreoffice-commits] core.git: postprocess/Rdb_services.mk ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 postprocess/Rdb_services.mk  |3 
 ucb/Library_ucpdav1.mk   |1 
 ucb/source/ucp/webdav-curl/CurlSession.cxx   |  139 +++
 ucb/source/ucp/webdav-curl/CurlSession.hxx   |  112 ++
 ucb/source/ucp/webdav-curl/DAVSession.hxx|2 
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx |6 
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   10 -
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |8 -
 8 files changed, 268 insertions(+), 13 deletions(-)

New commits:
commit ba2ceafa145880002b43c1807fae48fb66e883c6
Author: Michael Stahl 
AuthorDate: Mon Sep 13 15:46:01 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:16:44 2021 +0100

ucb: webdav-curl: add CurlSession boilerplate

Amazingly it even builds, with warnings.

Change-Id: I1f89a8a7de0c37a8908f530d46e275282cdc33de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122047
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 1faf14a374a0..aea72437c4f9 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -179,6 +179,9 @@ $(eval $(call gb_Rdb_add_components,services,\
$(if $(filter serf,$(WITH_WEBDAV)), \
ucb/source/ucp/webdav/ucpdav1 \
) \
+   $(if $(filter curl,$(WITH_WEBDAV)), \
+   ucb/source/ucp/webdav-curl/ucpdav1 \
+   ) \
$(call gb_Helper_optional,SCRIPTING, \
basctl/util/basctl \
sc/util/vbaobj \
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index c4c739773d13..2809a49cac54 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_Library_use_externals,ucpdav1,\
 
 $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-curl/ContentProperties \
+   ucb/source/ucp/webdav-curl/CurlSession \
ucb/source/ucp/webdav-curl/CurlUri \
ucb/source/ucp/webdav-curl/DAVProperties \
ucb/source/ucp/webdav-curl/DAVResourceAccess \
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
new file mode 100644
index ..fcbf87a0ea75
--- /dev/null
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "CurlSession.hxx"
+
+namespace http_dav_ucp
+{
+CurlSession::CurlSession(::rtl::Reference const& rpFactory, 
OUString const& rURI,
+ ::ucbhelper::InternetProxyDecider const& 
rProxyDecider)
+: DAVSession(rpFactory)
+, m_URI(rURI)
+, m_rProxyDecider(rProxyDecider)
+{
+}
+
+CurlSession::~CurlSession() {}
+
+auto CurlSession::CanUse(OUString const& rURI) -> bool {}
+
+auto CurlSession::UsesProxy() -> bool {}
+
+auto CurlSession::abort() -> void {}
+
+// DAV methods
+auto CurlSession::PROPFIND(OUString const& rURIReference, Depth const depth,
+   ::std::vector const& rPropertyNames,
+   ::std::vector& o_rResources,
+   DAVRequestEnvironment const& rEnv) -> void
+{
+}
+
+auto CurlSession::PROPFIND(OUString const& rURIReference, Depth const depth,
+   ::std::vector& o_rResourceInfos,
+   DAVRequestEnvironment const& rEnv) -> void
+{
+}
+
+auto CurlSession::PROPPATCH(OUString const& rURIReference,
+::std::vector const& rValues,
+DAVRequestEnvironment const& rEnv) -> void
+{
+}
+
+auto CurlSession::HEAD(OUString const& rURIReference, ::std::vector 
const& rHeaderNames,
+   DAVResource& io_rResource, DAVRequestEnvironment const& 
rEnv) -> void
+{
+}
+
+auto CurlSession::GET(OUString const& rURIReference, DAVRequestEnvironment 
const& rEnv)
+-> uno::Reference
+{
+}
+
+auto CurlSession::GET(OUString const& rURIReference, 
uno::Reference& rxOutStream,
+  DAVRequestEnvironment const& rEnv) -> void
+{
+}
+
+auto CurlSession::GET(OUString const& rURIReference, ::std::vector 
const& rHeaderNames,
+  DAVResource& io_rResource, DAVRequestEnvironment const& 
rEnv)
+-> uno::Reference
+{
+}
+
+auto CurlSession::GET(OUString const& rURIReference, 
uno::Reference& rxOutStream,
+  ::std::vector const& rHeaderNames, 
DAVResource& io_rResource,
+  DAVRequestEnvironment const& rEnv) -> void
+{
+}
+
+auto CurlSession::PUT(OUString const& rURIReference,
+  uno::Refer

[Libreoffice-commits] core.git: ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/Library_ucpdav1.mk  |4 
 ucb/source/ucp/webdav-curl/CurlSession.cxx  | 1751 +++-
 ucb/source/ucp/webdav-curl/CurlSession.hxx  |   31 
 ucb/source/ucp/webdav-curl/CurlUri.hxx  |2 
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx|4 
 ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx |1 
 6 files changed, 1773 insertions(+), 20 deletions(-)

New commits:
commit d024b594e556ff9061930389230dba4625bd5405
Author: Michael Stahl 
AuthorDate: Fri Sep 17 18:39:47 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:17:07 2021 +0100

ucb: webdav-curl: implement CurlSession

Change-Id: Ib99ccc517f36db1bf98900a79685d510f2940e5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122269
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 2809a49cac54..bedea713b179 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -35,6 +35,10 @@ $(eval $(call gb_Library_use_externals,ucpdav1,\
curl \
 ))
 
+$(eval $(call gb_Library_use_custom_headers,ucpdav1,\
+   officecfg/registry \
+))
+
 $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-curl/ContentProperties \
ucb/source/ucp/webdav-curl/CurlSession \
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index fcbf87a0ea75..c6ee6ae78a09 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -9,23 +9,1107 @@
 
 #include "CurlSession.hxx"
 
+#include "SerfLockStore.hxx"
+#include "DAVProperties.hxx"
+#include "webdavresponseparser.hxx"
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// globals container
+struct Init
+{
+/// note: LockStore has its own mutex and calls CurlSession from its thread
+///   so don't call LockStore with m_Mutex held to prevent deadlock.
+::http_dav_ucp::SerfLockStore LockStore;
+
+Init()
+{
+if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
+{
+assert(!"curl_global_init failed");
+}
+}
+// do not call curl_global_cleanup() - this is not the only client of curl
+};
+Init g_Init;
+
+struct ResponseHeaders
+{
+::std::vector<::std::pair<::std::vector, ::std::optional>> 
HeaderFields;
+CURL* pCurl;
+ResponseHeaders(CURL* const i_pCurl)
+: pCurl(i_pCurl)
+{
+}
+};
+
+auto GetResponseCode(ResponseHeaders const& rHeaders) -> ::std::optional
+{
+return (rHeaders.HeaderFields.empty()) ? ::std::optional{}
+   : 
rHeaders.HeaderFields.back().second;
+}
+
+struct DownloadTarget
+{
+uno::Reference xOutStream;
+ResponseHeaders const& rHeaders;
+DownloadTarget(uno::Reference const& i_xOutStream,
+   ResponseHeaders const& i_rHeaders)
+: xOutStream(i_xOutStream)
+, rHeaders(i_rHeaders)
+{
+}
+};
+
+struct UploadSource
+{
+uno::Reference xInStream;
+ResponseHeaders const& rHeaders;
+UploadSource(uno::Reference const& i_xInStream,
+ ResponseHeaders const& i_rHeaders)
+: xInStream(i_xInStream)
+, rHeaders(i_rHeaders)
+{
+}
+};
+
+/// combined guard class to ensure things are released in correct order,
+/// particularly in ProcessRequest() error handling
+class Guard
+{
+private:
+/// mutex *first* because m_oGuard requires it
+::std::unique_lock<::std::mutex> m_Lock;
+::std::optional<::comphelper::ScopeGuard<::std::function>> 
m_oGuard;
+
+public:
+explicit Guard(::std::mutex& rMutex)
+: m_Lock(rMutex)
+{
+}
+template 
+explicit Guard(::std::mutex& rMutex, Func&& rFunc)
+: m_Lock(rMutex)
+, m_oGuard(::std::move(rFunc))
+{
+}
+#if 0
+void unlock()
+{
+m_oGuard.reset();
+m_Lock.unlock();
+}
+#endif
+};
+
+} // namespace
+
 namespace http_dav_ucp
 {
-CurlSession::CurlSession(::rtl::Reference const& rpFactory, 
OUString const& rURI,
+static auto GetErrorString(CURLcode const rc, char const* const pErrorBuffer = 
nullptr) -> OString
+{
+char const* const pMessage( // static fallback
+(pErrorBuffer && pErrorBuffer[0] != '\0') ? pErrorBuffer : 
curl_easy_strerror(rc));
+return OString::Concat("(") + OString::number(sal_Int32(rc)) + ") " + 
pMessage;
+}
+
+// libcurl callbacks:
+
+#if OSL_DEBUG_LEVEL > 0
+static int debug_callback(CURL* handle, curl_infotype type, char* data, size_t 
size,
+  void* /*userdata*/)
+{
+char const* pType(nullptr);
+switch (type)
+{
+case CURLINFO_TEXT:
+SAL_INFO("ucb.ucp.webdav.curl", "debug 

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx   |   12 +++--
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   36 ---
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |   17 +---
 3 files changed, 56 insertions(+), 9 deletions(-)

New commits:
commit ff2bcefa5266ba2b7c4128fdc25245348dee0bd9
Author: Michael Stahl 
AuthorDate: Thu Oct 7 18:30:37 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:17:41 2021 +0100

ucb: webdav-curl: try to prevent acquiring a lock that we already have

This was done for webdav-neon in commit
b4576f3da4d90139fc5140962d13cb91dab98797 but without checking that the
requested lock isn't "stronger" than the one that was already acquired.

This is currently not a problem because there is only one caller of
LOCK() and it passes a hard-coded ucb::Lock argument, but not sure if
that would change in the future, so try to check for it.

Change-Id: I7a703197208979c330212288c323877a326dd7de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123229
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index c6ee6ae78a09..371548cff234 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1638,6 +1638,14 @@ auto CurlSession::LOCK(OUString const& rURIReference, 
ucb::Lock /*const*/& rLock
 {
 SAL_INFO("ucb.ucp.webdav.curl", "LOCK: " << rURIReference);
 
+// FIXME: why is a *global* LockStore keyed by *path*?
+if (g_Init.LockStore.getLockTokenForURI(rURIReference, rLock))
+{
+// already have a lock that covers the requirement
+// TODO: maybe use DAV:lockdiscovery to ensure it's valid
+return;
+}
+
 // note: no m_Mutex lock needed here, only in CurlProcessor::Lock()
 
 // generate XML document for acquiring new LOCK
@@ -1738,8 +1746,8 @@ auto CurlSession::LOCK(OUString const& rURIReference, 
ucb::Lock /*const*/& rLock
 
 for (auto const& rAcquiredLock : acquiredLocks)
 {
-g_Init.LockStore.addLock(rURIReference, 
rAcquiredLock.first.LockTokens[0], this,
- rAcquiredLock.second);
+g_Init.LockStore.addLock(rURIReference, rAcquiredLock.first,
+ rAcquiredLock.first.LockTokens[0], this, 
rAcquiredLock.second);
 SAL_INFO("ucb.ucp.webdav.curl", "created LOCK for " << rURIReference);
 }
 }
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
index ff9eaac816df..cae43864f8e5 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -21,6 +21,9 @@
 #include 
 #include 
 #include 
+
+#include 
+
 #include "CurlSession.hxx"
 #include "SerfLockStore.hxx"
 
@@ -140,15 +143,42 @@ OUString SerfLockStore::getLockToken( const OUString& 
rLock )
 return OUString();
 }
 
-void SerfLockStore::addLock( const OUString& rLock,
+OUString const*
+SerfLockStore::getLockTokenForURI(OUString const& rURI, css::ucb::Lock const& 
rLock)
+{
+osl::MutexGuard aGuard( m_aMutex );
+
+auto const it(m_aLockInfoMap.find(rURI));
+
+if (it == m_aLockInfoMap.end())
+{
+return nullptr;
+}
+// 0: EXCLUSIVE 1: SHARED
+if (it->second.m_Lock.Scope == ucb::LockScope_SHARED && rLock.Scope == 
ucb::LockScope_EXCLUSIVE)
+{
+return nullptr;
+}
+assert(it->second.m_Lock.Type == rLock.Type); // only WRITE possible
+if (it->second.m_Lock.Depth < rLock.Depth)
+{
+return nullptr;
+}
+assert(it->second.m_Lock.Owner == rLock.Owner); // only own locks expected
+// ignore Timeout ?
+return &it->second.m_sToken;
+}
+
+void SerfLockStore::addLock( const OUString& rURI,
+ ucb::Lock const& rLock,
  const OUString& sToken,
  rtl::Reference const & xSession,
  sal_Int32 nLastChanceToSendRefreshRequest )
 {
 osl::MutexGuard aGuard( m_aMutex );
 
-m_aLockInfoMap[ rLock ]
-= LockInfo( sToken, xSession, nLastChanceToSendRefreshRequest );
+m_aLockInfoMap[ rURI ]
+= LockInfo(sToken, rLock, xSession, nLastChanceToSendRefreshRequest);
 
 startTicker();
 }
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
index 5bfc8c952cca..c7d1499a6e65 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include "CurlSession.hxx"
 
 namespace http_dav_ucp
@@ -34,6 +36,7 @@ class TickerThread;
 struct LockInfo
 {
 OUString m_sToken;
+css::ucb::Lock m_Lock;
 rtl::Reference m_xSession;
 sal_Int32 m_nLastChanceToSendRefreshRequest;
 
@@ -41,11 +44,14 @@ struct LockI

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx   |  160 ++-
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   14 +-
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |2 
 3 files changed, 144 insertions(+), 32 deletions(-)

New commits:
commit 33fb5accfa38fa6ae739ed20d807bf1980eb4b59
Author: Michael Stahl 
AuthorDate: Thu Oct 21 13:54:23 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:18:01 2021 +0100

ucb: webdav-curl: handle additional HTTP status codes

Refactor a little to prevent recursive calls of ProcessRequest(),
to ensure the libcurl options set by the previous call are reset before
the following call.

Change-Id: Iba2ff695385c554058ac5a743c204224ca09ac57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124059
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 371548cff234..2374ccbc26f2 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -116,13 +116,11 @@ public:
 , m_oGuard(::std::move(rFunc))
 {
 }
-#if 0
 void unlock()
 {
 m_oGuard.reset();
 m_Lock.unlock();
 }
-#endif
 };
 
 } // namespace
@@ -572,7 +570,7 @@ auto CurlSession::abort() -> void
 /// this is just a bunch of static member functions called from CurlSession
 struct CurlProcessor
 {
-static auto ProcessRequest(
+static auto ProcessRequestImpl(
 CurlSession& rSession, ::std::u16string_view rURIReference,
 DAVRequestEnvironment const* pEnv,
 ::std::unique_ptr> 
pRequestHeaderList,
@@ -580,14 +578,22 @@ struct CurlProcessor
 uno::Reference const* pxInStream,
 ::std::pair<::std::vector const&, DAVResource&> const* 
pRequestedHeaders) -> void;
 
+static auto ProcessRequest(
+Guard& rGuard, CurlSession& rSession, OUString const& rURIReference,
+DAVRequestEnvironment const* pEnv,
+::std::unique_ptr> 
pRequestHeaderList,
+uno::Reference const* pxOutStream,
+uno::Reference const* pxInStream,
+::std::pair<::std::vector const&, DAVResource&> const* 
pRequestedHeaders) -> void;
+
 static auto
-PropFind(CurlSession& rSession, ::std::u16string_view rURIReference, Depth 
depth,
+PropFind(CurlSession& rSession, OUString const& rURIReference, Depth depth,
  ::std::tuple<::std::vector const&, 
::std::vector* const,
   ::std::vector* const> const* 
o_pRequestedProperties,
  ::std::vector* const o_pResourceInfos,
  DAVRequestEnvironment const& rEnv) -> void;
 
-static auto MoveOrCopy(CurlSession& rSession, ::std::u16string_view 
rSourceURIReference,
+static auto MoveOrCopy(CurlSession& rSession, OUString const& 
rSourceURIReference,
::std::u16string_view rDestinationURI, 
DAVRequestEnvironment const& rEnv,
bool isOverwrite, char const* pMethod) -> void;
 
@@ -602,7 +608,7 @@ struct CurlProcessor
 };
 
 /// main function to initiate libcurl requests
-auto CurlProcessor::ProcessRequest(
+auto CurlProcessor::ProcessRequestImpl(
 CurlSession& rSession, ::std::u16string_view const rURIReference,
 DAVRequestEnvironment const* const pEnv,
 ::std::unique_ptr> 
pRequestHeaderList,
@@ -983,8 +989,108 @@ auto CurlProcessor::ProcessRequest(
 }
 }
 
+static auto TryRemoveExpiredLockToken(CurlSession& rSession, OUString const& 
rURIReference,
+  DAVRequestEnvironment const* const pEnv) 
-> bool
+{
+if (!pEnv)
+{
+// caller was a NonInteractive_*LOCK function anyway, its caller is 
LockStore
+return false;
+}
+OUString const* const 
pToken(g_Init.LockStore.getLockTokenForURI(rURIReference, nullptr));
+if (!pToken)
+{
+return false;
+}
+try
+{
+// determine validity of existing lock via lockdiscovery request
+::std::vector const propertyNames{ 
DAVProperties::LOCKDISCOVERY };
+::std::vector locks;
+::std::tuple<::std::vector const&, 
::std::vector* const,
+ ::std::vector* const> const 
args(propertyNames, nullptr, &locks);
+
+CurlProcessor::PropFind(rSession, rURIReference, DAVZERO, &args, 
nullptr, *pEnv);
+
+// https://datatracker.ietf.org/doc/html/rfc4918#section-15.8
+// The response MAY not contain tokens, but hopefully it
+// will if client is properly authenticated.
+if (::std::any_of(locks.begin(), locks.end(), [pToken](ucb::Lock 
const& rLock) {
+return ::std::any_of(
+rLock.LockTokens.begin(), rLock.LockTokens.end(),
+[pToken](OUString const& rToken) { return *pToken == 
rToken; });
+}))
+{
+return false; // still have the lock
+}
+
+SAL_INF

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 66515820d050b4f56d30856b0e7223fa7e697b58
Author: Michael Stahl 
AuthorDate: Tue Oct 5 13:08:48 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:18:23 2021 +0100

ucb: webdav-curl: fix init of SimpleAuthenticationRequest

The parameter was removed in c158c00489d35af7f5f9278b8ee545678d6a42e5
so "true" was erroneously passed as bCanUseSystemCredentials.

Change-Id: I98d3b554a787c7200337735d5fde13b7db43a832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123121
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index b377184d7cae..bf043e533892 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -68,7 +68,6 @@ int DAVAuthListener_Impl::authenticate(
 = new ucbhelper::SimpleAuthenticationRequest(
 m_aURL, inHostName, inRealm, inoutUserName,
 outPassWord,
-true /*bAllowPersistentStoring*/,
 bCanUseSystemCredentials );
 xIH->handle( xRequest );
 


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |   38 +++
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |2 -
 2 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit e668c2a88f0edb41169a76d9c6203227cd436559
Author: Michael Stahl 
AuthorDate: Wed Oct 6 14:24:34 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:19:10 2021 +0100

ucb: webdav-curl: catch exception by constant reference

[ replicate commit e4ce7225dd987f9b2f250f055d9688de79931444 ]

Change-Id: I9727af7b85a7f4c0a821a41856d72644b306ba29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123173
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index bf043e533892..3ac379c9da70 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -189,7 +189,7 @@ void DAVResourceAccess::PROPFIND(
   new DAVAuthListener_Impl( xEnv, m_aURL ),
   aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -229,7 +229,7 @@ void DAVResourceAccess::PROPFIND(
   new DAVAuthListener_Impl( xEnv, m_aURL ),
   aHeaders, xEnv ) ) ;
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -267,7 +267,7 @@ void DAVResourceAccess::PROPPATCH(
new DAVAuthListener_Impl( xEnv, m_aURL 
),
aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -307,7 +307,7 @@ void DAVResourceAccess::HEAD(
   new DAVAuthListener_Impl( xEnv, m_aURL ),
   aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -345,7 +345,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
xEnv, m_aURL ),
aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -385,7 +385,7 @@ void DAVResourceAccess::GET(
  new DAVAuthListener_Impl( xEnv, m_aURL ),
  aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -427,7 +427,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
xEnv, m_aURL ),
aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -471,7 +471,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
xEnv, m_aURL ),
rRequestHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -515,7 +515,7 @@ void DAVResourceAccess::GET(
  new DAVAuthListener_Impl( xEnv, m_aURL ),
  aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -598,7 +598,7 @@ void DAVResourceAccess::PUT(
  new DAVAuthListener_Impl( xEnv, m_aURL ),
  aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException const& e)
 {
 errorCount++;
 bRetry = handleException( e, errorCount );
@@ -652,7 +652,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
 xEnv, m_aURL ),
 aHeaders, xEnv ) );
 }
-catch ( DAVException & e )
+catch (DAVException co

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/ContentProperties.cxx |   21 -
 ucb/source/ucp/webdav-curl/ContentProperties.hxx |6 --
 2 files changed, 27 deletions(-)

New commits:
commit 244a64ae7461a19383c81bc3fefebb5b40900c18
Author: Michael Stahl 
AuthorDate: Wed Oct 6 14:10:42 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:19:54 2021 +0100

ucb: webdav-curl: callcatcher: remove unused methods

[ replicate commit af6752b88e34df05449a4237d9be0fac509c227c ]

Change-Id: I608798e95297642fe768d7ad66d524f084fa83d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123172
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index 362af841c7be..53e4593fc342 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -370,27 +370,6 @@ void ContentProperties::addProperties(
 }
 }
 
-
-void ContentProperties::addProperties( const ContentProperties & rProps )
-{
-for ( const auto& rProp : *rProps.m_xProps )
-{
-addProperty(
-rProp.first, rProp.second.value(), rProp.second.isCaseSensitive() 
);
-}
-}
-
-
-void ContentProperties::addProperties(
-const std::vector< DAVPropertyValue > & rProps )
-{
-for ( const auto& rProp : rProps )
-{
-addProperty( rProp );
-}
-}
-
-
 void ContentProperties::addProperty( const DAVPropertyValue & rProp )
 {
 addProperty( rProp.Name, rProp.Value, rProp.IsCaseSensitive );
diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.hxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.hxx
index 0f1bc0a52c7e..a4588f5214f6 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.hxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.hxx
@@ -114,12 +114,6 @@ public:
 void addProperties( const std::vector< OUString > & rProps,
 const ContentProperties & rContentProps );
 
-// overwrites probably existing entries.
-void addProperties( const ContentProperties & rProps );
-
-// overwrites probably existing entries.
-void addProperties( const std::vector< DAVPropertyValue > & rProps );
-
 // overwrites probably existing entry.
 void addProperty( const OUString & rName,
  const css::uno::Any & rValue,


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx   |   17 +++--
 ucb/source/ucp/webdav-curl/CurlSession.hxx   |6 +-
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |   11 +--
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |5 +
 ucb/source/ucp/webdav-curl/DAVSession.hxx|7 ++-
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx |7 ---
 ucb/source/ucp/webdav-curl/DAVSessionFactory.hxx |   12 +---
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   21 +
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |4 ++--
 9 files changed, 72 insertions(+), 18 deletions(-)

New commits:
commit d80ad1370b65987505fd5aedd3ac17ff8b1ee0ed
Author: Michael Stahl 
AuthorDate: Wed Oct 6 15:40:57 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:20:33 2021 +0100

ucb: webdav-curl: add OpenCommandArg3 "KeepAlive" support

This is based on the following commits, which conflict everywhere,
except the code in CurlSession.* is new.

commit 09954fc863c8ee900f157cab4458e1dcf51493d3
Author: Thorsten Behrens 
AuthorDate: Tue Jan 17 04:59:56 2012 +0100

Fix UpdateCheck clog up server by keeping connection alive

The update check protocol uses the webdav ucp, which uses neon,
which in turn defaults to keeping the connection alive. this is nice
for webdav, but disastrous for millions of clients phoning home to
the same server.

Using neon directly in updatefeed.cxx is not an option, due to the
thread safety problems around that (see e.g. rhbz#544619) - so we
had to extend it to accept connection options, and reuse the
existing webdav provider.

commit 29bd62fdc2792e215999e9dd0ec9a4bf1102201d
Author: Thorsten Behrens 
AuthorDate: Tue Jan 17 11:41:14 2012 +0100

Switch flag sequence of OpenCommandArg3 to NamedValue.

Based on feedback for 09954fc863c8ee900f157cab4458e1dcf51493d3,
using the less-bulky NamedValue type instead of PropertyValue.

Change-Id: I48e07dd4c3f189eb4445ed95a67011131d7b49f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123174
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 2374ccbc26f2..6605ffc4f9ac 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -18,6 +18,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -433,9 +434,11 @@ static auto ExtractRealm(ResponseHeaders const& rHeaders, 
char const* const pAut
 
 CurlSession::CurlSession(uno::Reference const& 
xContext,
  ::rtl::Reference const& rpFactory, 
OUString const& rURI,
+ uno::Sequence const& rFlags,
  ::ucbhelper::InternetProxyDecider const& 
rProxyDecider)
 : DAVSession(rpFactory)
 , m_xContext(xContext)
+, m_Flags(rFlags)
 , m_URI(rURI)
 , m_Proxy(rProxyDecider.getProxy(m_URI.GetScheme(), m_URI.GetHost(), 
m_URI.GetPort()))
 {
@@ -533,18 +536,28 @@ 
CurlSession::CurlSession(uno::Reference const& xContext,
 rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_PROXYAUTH, CURLAUTH_ANY);
 assert(rc == CURLE_OK); // ANY is always available
 }
+auto const it(::std::find_if(m_Flags.begin(), m_Flags.end(),
+ [](auto const& rFlag) { return rFlag.Name == 
"KeepAlive"; }));
+if (it != m_Flags.end() && it->Value.get())
+{
+// neon would close the connection from ne_end_request(), this seems
+// to be the equivalent and not CURLOPT_TCP_KEEPALIVE
+rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_FORBID_REUSE, 1L);
+assert(rc == CURLE_OK);
+}
 }
 
 CurlSession::~CurlSession() {}
 
-auto CurlSession::CanUse(OUString const& rURI) -> bool
+auto CurlSession::CanUse(OUString const& rURI, 
uno::Sequence const& rFlags)
+-> bool
 {
 try
 {
 CurlUri const uri(rURI);
 
 return m_URI.GetScheme() == uri.GetScheme() && m_URI.GetHost() == 
uri.GetHost()
-   && m_URI.GetPort() == uri.GetPort();
+   && m_URI.GetPort() == uri.GetPort() && m_Flags == rFlags;
 }
 catch (DAVException const&)
 {
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.hxx 
b/ucb/source/ucp/webdav-curl/CurlSession.hxx
index 4c33c795d940..e7e566c0fe99 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.hxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.hxx
@@ -25,6 +25,8 @@ private:
 /// mutex required to access all other non-const members
 ::std::mutex m_Mutex;
 css::uno::Reference const m_xContext;
+/// flags may be passed to constructor, e.g. "KeepAlive"
+css::uno::Sequence const m_Flags;
 CurlUri const m_URI;
 /// buffer for libcurl detailed error messages
 

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Stephan Bergmann (via logerrit)
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   26 +-
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 394a4947d663f36226d8dfbfdf4e190f373742e3
Author: Stephan Bergmann 
AuthorDate: Wed Oct 6 16:14:20 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:20:51 2021 +0100

ucb: webdav-curl: Adapted TickerThread to safer-to-use salhelper::Thread

[ port of commit f7afe3b7b07800d130b4d9102f2a94ccac0ebc52
  and c58882fda80b63baac3360001b0fdf251d96e0eb "fix msvc2005 build" ]

Change-Id: I7173a99aaebd01535971d25350d00923c6607c5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123175
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
index 10436ea969e1..f25516d1742b 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -31,7 +32,7 @@ using namespace http_dav_ucp;
 
 namespace http_dav_ucp {
 
-class TickerThread : public osl::Thread
+class TickerThread : public salhelper::Thread
 {
 bool m_bFinish;
 SerfLockStore & m_rLockStore;
@@ -39,19 +40,20 @@ class TickerThread : public osl::Thread
 public:
 
 explicit TickerThread( SerfLockStore & rLockStore )
-: osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
+: Thread( "WebDavTickerThread" ), m_bFinish( false ),
+  m_rLockStore( rLockStore ) {}
 
 void finish() { m_bFinish = true; }
 
-protected:
+private:
 
-virtual void SAL_CALL run() override;
+virtual void execute();
 };
 
 } // namespace http_dav_ucp
 
 
-void TickerThread::run()
+void TickerThread::execute()
 {
 osl_setThreadName("http_dav_ucp::TickerThread");
 
@@ -72,7 +74,7 @@ void TickerThread::run()
 TimeValue aTV;
 aTV.Seconds = 0;
 aTV.Nanosec = 10 / nNth;
-wait( aTV );
+salhelper::Thread::wait( aTV );
 }
 
 SAL_INFO("ucb.ucp.webdav",  "TickerThread: stop." );
@@ -80,8 +82,7 @@ void TickerThread::run()
 
 
 SerfLockStore::SerfLockStore()
-: m_pTickerThread( nullptr )
-, m_bFinishing( false )
+: m_bFinishing( false )
 {
 }
 
@@ -110,10 +111,10 @@ void SerfLockStore::startTicker()
 {
 osl::MutexGuard aGuard( m_aMutex );
 
-if ( !m_pTickerThread )
+if ( !m_pTickerThread.is() )
 {
 m_pTickerThread = new TickerThread( *this );
-m_pTickerThread->create();
+m_pTickerThread->launch();
 }
 }
 
@@ -122,12 +123,11 @@ void SerfLockStore::stopTicker()
 {
 osl::MutexGuard aGuard( m_aMutex );
 
-if ( m_pTickerThread )
+if ( m_pTickerThread.is() )
 {
 m_pTickerThread->finish();
 m_pTickerThread->join();
-delete m_pTickerThread;
-m_pTickerThread = nullptr;
+m_pTickerThread.clear();
 }
 }
 
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
index f87516a2fa2e..62a859be639d 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
@@ -59,7 +59,7 @@ typedef std::map< OUString, LockInfo > LockInfoMap;
 class SerfLockStore
 {
 osl::Mutex m_aMutex;
-TickerThread * m_pTickerThread;
+rtl::Reference< TickerThread > m_pTickerThread;
 bool   m_bFinishing;
 LockInfoMapm_aLockInfoMap;
 


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit d43d90347261e57b33fa932e8869184337bc0017
Author: Michael Stahl 
AuthorDate: Wed Oct 6 16:29:20 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:21:22 2021 +0100

ucb: webdav-curl: add documentation from "rhbz#678440: Always ...

... include User-Agent to avoid 403 from picky servers",
commit 4d0e3127ed2def7212bc05aa860cd06704bb1efe.

Change-Id: Ie20def64b7fd1a4f523db84f42d83037bbf88856
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123176
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 6605ffc4f9ac..6916adfa5383 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -456,6 +456,10 @@ 
CurlSession::CurlSession(uno::Reference const& xContext,
  "curl version: " << pVersion->version << " " << pVersion->host
   << " features: " << ::std::hex << 
pVersion->features << " ssl: "
   << pVersion->ssl_version << " libz: " << 
pVersion->libz_version);
+// Make sure a User-Agent header is always included, as at least
+// en.wikipedia.org:80 forces back 403 "Scripts should use an informative
+// User-Agent string with contact information, or they may be IP-blocked
+// without notice" otherwise:
 OString const useragent(OString::Concat("LibreOffice " LIBO_VERSION_DOTTED 
" curl/")
 + ::std::string_view(pVersion->version, 
strlen(pVersion->version)) + " "
 + pVersion->ssl_version);


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 44c58b178206ba9926b76b7eb47253e0c906ee1c
Author: Michael Stahl 
AuthorDate: Wed Oct 6 16:43:49 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:22:06 2021 +0100

ucb: webdav-curl: fix exception in Content::queryInterface()

This was refactored in webdav-neon by commit
c2ca6fabd1afc3fc07001721c2069d3c8db7000a but it turns out that here the
m_xSMgr doesn't exist anyway since commit
317b5bdadebc5560d38da4c9dd6d68c64a93b9a8 so just use m_xContext.

Change-Id: I5c190d6e562ddd095fd6f8c8400ee4a7b7d5a5a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123177
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index f001c442ab4c..b14bd419bf3f 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -286,14 +286,8 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type 
& rType )
 {
 try
 {
-uno::Reference< beans::XPropertySet > const xProps(
-m_xContext, uno::UNO_QUERY_THROW );
-uno::Reference< uno::XComponentContext > xCtx;
-xCtx.set( xProps->getPropertyValue( "DefaultContext" ),
-uno::UNO_QUERY_THROW );
-
 uno::Reference< task::XInteractionHandler > xIH(
-task::PasswordContainerInteractionHandler::create( xCtx ) );
+task::PasswordContainerInteractionHandler::create(m_xContext) 
);
 
 // Supply a command env to isFolder() that contains an interaction
 // handler that uses the password container service to obtain
@@ -301,7 +295,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type 
& rType )
 
 uno::Reference< ucb::XCommandEnvironment > xCmdEnv(
 ucb::CommandEnvironment::create(
-   xCtx,
+   m_xContext,
xIH,
uno::Reference< ucb::XProgressHandler >() ) );
 


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx |   59 --
 1 file changed, 24 insertions(+), 35 deletions(-)

New commits:
commit 44f246d122d2bac3f47d855957c809d7eb5768f1
Author: Michael Stahl 
AuthorDate: Wed Oct 6 17:31:05 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:22:34 2021 +0100

ucb: webdav-curl: use std::unqiue_ptr in ResultList

This reimplements commit 7ff650a6fe405c98d182c6cabbb46217b56bb0c6
and commit fc90cf2af58dc8d551c39ba37d3a44597aa11e44.

Change-Id: I517ce2a4eeda75c25b7a7f7debee8904b454a144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123178
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx 
b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
index 5715f9193728..987bc81b66b6 100644
--- a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
@@ -62,7 +62,7 @@ struct ResultListEntry
 // ResultList.
 
 
-typedef std::vector< ResultListEntry* > ResultList;
+typedef std::vector> ResultList;
 
 
 // struct DataSupplier_Impl.
@@ -71,7 +71,7 @@ typedef std::vector< ResultListEntry* > ResultList;
 struct DataSupplier_Impl
 {
 osl::Mutex   m_aMutex;
-ResultList   m_aResults;
+ResultList   m_Results;
 rtl::Reference< Content >m_xContent;
 uno::Reference< uno::XComponentContext > m_xContext;
 sal_Int32m_nOpenMode;
@@ -84,18 +84,8 @@ struct DataSupplier_Impl
 sal_Int32 nOpenMode )
 : m_xContent( rContent ), m_xContext( rxContext ), m_nOpenMode( nOpenMode 
),
   m_bCountFinal( false ), m_bThrowException( false ) {}
-~DataSupplier_Impl();
 };
 
-
-DataSupplier_Impl::~DataSupplier_Impl()
-{
-for ( auto& rResultPtr : m_aResults )
-{
-delete rResultPtr;
-}
-}
-
 }
 
 
@@ -121,9 +111,9 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
 {
 osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
 
-if ( nIndex < m_pImpl->m_aResults.size() )
+if (nIndex < m_pImpl->m_Results.size())
 {
-OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+OUString aId = m_pImpl->m_Results[ nIndex ]->aId;
 if ( aId.getLength() )
 {
 // Already cached.
@@ -135,8 +125,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
 {
 OUString aId = m_pImpl->m_xContent->getResourceAccess().getURL();
 
-const ContentProperties& props
-= *( m_pImpl->m_aResults[ nIndex ]->pData );
+const ContentProperties& props(*(m_pImpl->m_Results[ nIndex ]->pData));
 
 if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
 aId += "/";
@@ -146,7 +135,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
 if ( props.isTrailingSlash() )
 aId += "/";
 
-m_pImpl->m_aResults[ nIndex ]->aId = aId;
+m_pImpl->m_Results[ nIndex ]->aId = aId;
 return aId;
 }
 return OUString();
@@ -159,10 +148,10 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
 {
 osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
 
-if ( nIndex < m_pImpl->m_aResults.size() )
+if (nIndex < m_pImpl->m_Results.size())
 {
 uno::Reference< ucb::XContentIdentifier > xId
-= m_pImpl->m_aResults[ nIndex ]->xId;
+= m_pImpl->m_Results[ nIndex ]->xId;
 if ( xId.is() )
 {
 // Already cached.
@@ -175,7 +164,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
 {
 uno::Reference< ucb::XContentIdentifier > xId
 = new ::ucbhelper::ContentIdentifier( aId );
-m_pImpl->m_aResults[ nIndex ]->xId = xId;
+m_pImpl->m_Results[ nIndex ]->xId = xId;
 return xId;
 }
 return uno::Reference< ucb::XContentIdentifier >();
@@ -188,10 +177,10 @@ DataSupplier::queryContent( sal_uInt32 nIndex )
 {
 osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
 
-if ( nIndex < m_pImpl->m_aResults.size() )
+if (nIndex < m_pImpl->m_Results.size())
 {
 uno::Reference< ucb::XContent > xContent
-= m_pImpl->m_aResults[ nIndex ]->xContent;
+= m_pImpl->m_Results[ nIndex ]->xContent;
 if ( xContent.is() )
 {
 // Already cached.
@@ -207,7 +196,7 @@ DataSupplier::queryContent( sal_uInt32 nIndex )
 {
 uno::Reference< ucb::XContent > xContent
 = m_pImpl->m_xContent->getProvider()->queryContent( xId );
-m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
+m_pImpl->m_Results[ nIndex ]->xContent = xContent;
 return xContent;
 
 }
@@ -224,7 +213,7 @@ bool DataSupplier:

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit ad85d647a3d501f9a3208d082b6bdbc371942053
Author: Michael Stahl 
AuthorDate: Wed Oct 6 17:51:19 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:23:10 2021 +0100

ucb: webdav-curl: adjust some trivialities to match...

... commit 0c3500115c4fd86284a027fc32be704afcf77061 - turned out there
wasn't a substantive difference to the existing code after all, except
for the FTP URL scheme check, which i don't miss.

Change-Id: Ie24988a4117445cf729515958dea88d17627859a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123179
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index b14bd419bf3f..3bebf9125fed 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -875,8 +875,8 @@ void Content::addProperty( const 
css::ucb::PropertyCommandArgument &aCmdArg,
 {
 try
 {
-const ResourceType & rType = getResourceType( xEnv );
-switch ( rType )
+const ResourceType eType = getResourceType( xEnv );
+switch ( eType )
 {
 case UNKNOWN:
 case DAV:
@@ -979,8 +979,8 @@ void Content::removeProperty( const OUString& Name,
 {
 try
 {
-const ResourceType & rType = getResourceType( xEnv );
-switch ( rType )
+const ResourceType eType = getResourceType( xEnv );
+switch ( eType )
 {
 case UNKNOWN:
 case DAV:
@@ -1284,9 +1284,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 
 // First, identify whether resource is DAV or not
 bool bNetworkAccessAllowed = true;
-const ResourceType & rType = getResourceType( xEnv, xResAccess, 
&bNetworkAccessAllowed );
+const ResourceType eType = getResourceType(
+xEnv, xResAccess, &bNetworkAccessAllowed );
 
-if ( DAV == rType )
+if ( eType == DAV )
 {
 // cache lookup... getResourceType may fill the props cache via
 // PROPFIND!
@@ -1364,8 +1365,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 }
 catch ( DAVException const & e )
 {
-bNetworkAccessAllowed = bNetworkAccessAllowed &&
-shouldAccessNetworkAfterException( e );
+bNetworkAccessAllowed = bNetworkAccessAllowed
+&& shouldAccessNetworkAfterException( e );
 
 if ( !bNetworkAccessAllowed )
 {
@@ -1465,7 +1466,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 CurlUri const aUri( xResAccess->getURL() );
 aUnescapedTitle = aUri.GetPathBaseNameUnescaped();
 
-if ( rType == UNKNOWN )
+if ( eType == UNKNOWN )
 {
 xProps.reset( new ContentProperties( aUnescapedTitle ) );
 }
@@ -1473,7 +1474,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 // For DAV resources we only know the Title, for non-DAV
 // resources we additionally know that it is a document.
 
-if ( rType == DAV )
+if ( eType == DAV )
 {
 //xProps.reset(
 //new ContentProperties( aUnescapedTitle ) );
@@ -3222,11 +3223,9 @@ Content::ResourceType Content::getResourceType(
 aProperties[ 3 ].Name = "MediaType";
 aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
 
-ContentProperties::UCBNamesToDAVNames(
-aProperties, aPropNames );
+ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames );
 
-rResAccess->PROPFIND(
-DAVZERO, aPropNames, resources, xEnv );
+rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xEnv );
 
 // TODO - is this really only one?
 if ( resources.size() == 1 )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit d2e66d2c10b624033520a0c734851b9bed9a902a
Author: Michael Stahl 
AuthorDate: Wed May 29 21:18:29 2013 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:24:01 2021 +0100

ucb: webdav-curl: NeonLockStore::stopTicker(): avoid deadlock

Tor reports that NeonLockStore::stopTicker() m_pTickerThread->join()
can deadlock with TickerThread running NeonLockStore::refreshLocks().

This can be avoided by copying m_pTickerThread to the stack, and
releasing the m_aMutex before calling join().

[ port of commit 68ba2785c55eaa1ea70ce135bdad5322b0e04ed7 ]

Change-Id: I6d2d993fd5315f27e6559a1e9034e961303fe894
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123180
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
index f25516d1742b..6380fe6e7447 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -121,14 +121,21 @@ void SerfLockStore::startTicker()
 
 void SerfLockStore::stopTicker()
 {
-osl::MutexGuard aGuard( m_aMutex );
-
-if ( m_pTickerThread.is() )
+rtl::Reference pTickerThread;
 {
-m_pTickerThread->finish();
-m_pTickerThread->join();
+osl::MutexGuard aGuard( m_aMutex );
+
+if (!m_pTickerThread.is())
+{
+return; // nothing to do
+}
+m_pTickerThread->finish(); // needs mutex
+// the TickerThread may run refreshLocks() at most once after this
+pTickerThread = m_pTickerThread;
 m_pTickerThread.clear();
 }
+
+pTickerThread->join(); // without m_aMutex locked (to prevent deadlock)
 }
 
 OUString SerfLockStore::getLockToken( const OUString& rLock )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/SerfLockStore.cxx |   23 ---
 ucb/source/ucp/webdav-curl/SerfLockStore.hxx |2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 21a1267b15724fcadb089065f57c5daf0fd6ba26
Author: Michael Stahl 
AuthorDate: Thu May 30 17:13:50 2013 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:24:26 2021 +0100

ucb: webdav-curl: NeonLockStore::stopTicker(): really avoid deadlock

Follow up on 68ba2785c55eaa1ea70ce135bdad5322b0e04ed7, which missed the
sad fact that m_aMutex is locked recursively.

Avoid that by passing a ClearableMutexGuard to stopTicker() and
unlocking that.  Also lock m_aMutex in the destructor while at it.

[ port of commit 13b60fd80a7adfb0ef81a818917cfec5edfc6edc ]

Change-Id: I65bb4ec98f13d28089c3b2eb3300074944024188
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123181
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
index 6380fe6e7447..62526bd873fc 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -89,7 +89,9 @@ SerfLockStore::SerfLockStore()
 
 SerfLockStore::~SerfLockStore()
 {
-stopTicker();
+osl::ResettableMutexGuard aGuard(m_aMutex);
+stopTicker(aGuard);
+aGuard.reset(); // actually no threads should even try to access members 
now
 m_bFinishing = true;
 
 // release active locks, if any.
@@ -119,23 +121,22 @@ void SerfLockStore::startTicker()
 }
 
 
-void SerfLockStore::stopTicker()
+void SerfLockStore::stopTicker(osl::ClearableMutexGuard & rGuard)
 {
 rtl::Reference pTickerThread;
-{
-osl::MutexGuard aGuard( m_aMutex );
 
-if (!m_pTickerThread.is())
-{
-return; // nothing to do
-}
+if (m_pTickerThread.is())
+{
 m_pTickerThread->finish(); // needs mutex
 // the TickerThread may run refreshLocks() at most once after this
 pTickerThread = m_pTickerThread;
 m_pTickerThread.clear();
 }
 
-pTickerThread->join(); // without m_aMutex locked (to prevent deadlock)
+rGuard.clear();
+
+if (pTickerThread.is())
+pTickerThread->join(); // without m_aMutex locked (to prevent deadlock)
 }
 
 OUString SerfLockStore::getLockToken( const OUString& rLock )
@@ -214,12 +215,12 @@ void SerfLockStore::updateLock( const OUString& rLock,
 
 void SerfLockStore::removeLock( const OUString& rLock )
 {
-osl::MutexGuard aGuard( m_aMutex );
+osl::ClearableMutexGuard aGuard( m_aMutex );
 
 m_aLockInfoMap.erase( rLock );
 
 if ( m_aLockInfoMap.empty() )
-stopTicker();
+stopTicker(aGuard);
 }
 
 
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx 
b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
index 62a859be639d..4aeb3a020dbc 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.hxx
@@ -89,7 +89,7 @@ public:
 
 private:
 void startTicker();
-void stopTicker();
+void stopTicker(osl::ClearableMutexGuard & rGuard);
 };
 
 } // namespace http_dav_ucp


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx |8 
 ucb/source/ucp/webdav-curl/CurlSession.hxx |3 ---
 ucb/source/ucp/webdav-curl/DAVSession.hxx  |6 --
 3 files changed, 17 deletions(-)

New commits:
commit 24adc72f80e1fe33654be103097271eda623f551
Author: Michael Stahl 
AuthorDate: Thu Oct 7 12:13:02 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:24:50 2021 +0100

ucb: webdav-curl: remove unused LOCK() overload

Removed from neon in commit 9d7727737b067c5228f129737046f718d5965659

Change-Id: I1df14d8e05e50a6a0ce7af4f6079f11be6628903
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123225
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 6916adfa5383..8ac493ce3afb 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1915,14 +1915,6 @@ auto CurlProcessor::Unlock(CurlSession& rSession, 
OUString const& rURIReference,
   nullptr, nullptr);
 }
 
-auto CurlSession::LOCK(OUString const& /*rURIReference*/, sal_Int64 const 
/*nTimeout*/,
-   DAVRequestEnvironment const & /*rEnv*/) -> sal_Int64
-{
-// FIXME unused?
-assert(false);
-return 1234567890;
-}
-
 auto CurlSession::UNLOCK(OUString const& rURIReference, DAVRequestEnvironment 
const& rEnv) -> void
 {
 SAL_INFO("ucb.ucp.webdav.curl", "UNLOCK: " << rURIReference);
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.hxx 
b/ucb/source/ucp/webdav-curl/CurlSession.hxx
index e7e566c0fe99..6316a2ab47cc 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.hxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.hxx
@@ -119,9 +119,6 @@ public:
 virtual auto LOCK(OUString const& rURIReference, css::ucb::Lock /*const*/& 
rLock,
   DAVRequestEnvironment const& rEnv) -> void override;
 
-virtual auto LOCK(OUString const& rURIReference, sal_Int64 nTimeout,
-  DAVRequestEnvironment const& rEnv) -> sal_Int64 override;
-
 virtual auto UNLOCK(OUString const& rURIReference, DAVRequestEnvironment 
const& rEnv)
 -> void override;
 
diff --git a/ucb/source/ucp/webdav-curl/DAVSession.hxx 
b/ucb/source/ucp/webdav-curl/DAVSession.hxx
index 88a41ab3153f..c3caea7be6f2 100644
--- a/ucb/source/ucp/webdav-curl/DAVSession.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVSession.hxx
@@ -173,12 +173,6 @@ public:
css::ucb::Lock & inLock,
const DAVRequestEnvironment & rEnv ) = 0;
 
-// refresh existing lock.
-/// @throws DAVException
-virtual sal_Int64 LOCK( const OUString & inPath,
-sal_Int64 nTimeout,
-const DAVRequestEnvironment & rEnv ) = 0;
-
 /// @throws DAVException
 virtual void UNLOCK( const OUString & inPath,
  const DAVRequestEnvironment & rEnv ) = 0;


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  112 +++
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |1 
 2 files changed, 96 insertions(+), 17 deletions(-)

New commits:
commit 115edb7a91f0c1c9b2aeb343680f47924730d121
Author: Giuseppe Castagno 
AuthorDate: Thu Oct 7 12:47:27 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:25:26 2021 +0100

ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 1

There are some areas in ucb outside the issue scope that should later
be addressed, among them:

- in ucb/webdav make flag m_bTransient working right, currently lock
option for WebDAV server not supporting it is suboptimal: there are
not needed lock requests;

- change the method the modified file is checked against the old
one, using DAV:etag instead of the DateTime;

- some http status code returned by the server don't seem to be
managed;

- during WebDAV operation some redundant request of properties is
carried out.
Probably some clean up to remove these not needed transactions
is to be done.
Accessing only those really supported by the referenced href would
be better.

Changes done to the code in ucb, in no particular order

- remove current WebDAV lock management

- have the lock/unlock working correctly when the webdav resource
is first created: in the case of creation is the first lock on
the non existent resource that actually creates it

- fix a problem while fetching WebDAV properties.
If a single WebDAV non-cached property was requested, it would
 not be fetched from the server without this fix.

- change the lock owner name.
This should probably be different. Something to be discussed.
This same string can be read by all the applications accessing the
lock.

Spec reference is:
RFC4918 [2007]: '14.17.  owner XML Element'
link (as of 20150713):
http://tools.ietf.org/html/rfc4918#section-14.17

- manage WebDAV locked file exception directly while locking.
The ucb::InteractiveLockingLockedException is thrown directly
when detected by the lock command, to avoid the user interaction
activated by the cancelCommandExecution method.

- terminate gracefully if WebDAV lock/unlock is not supported

[ port of commit 26e6d4b05ab444e6a7529ffcac7fbe592fc94833 ]

Change-Id: I0a4c926dc1e32cc620ad6e9acfc9c9c56928fa49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123226
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 3bebf9125fed..d63fc7356669 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -199,7 +199,6 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( false ),
-  m_bLocked( false ),
   m_bCollection( false ),
   m_bDidGetOrHead( false )
 {
@@ -231,7 +230,6 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( true ),
-  m_bLocked( false ),
   m_bCollection( isCollection ),
   m_bDidGetOrHead( false )
 {
@@ -252,8 +250,6 @@ Content::Content(
 // virtual
 Content::~Content()
 {
-if (m_bLocked)
-unlock(uno::Reference< ucb::XCommandEnvironment >());
 }
 
 
@@ -532,10 +528,6 @@ uno::Any SAL_CALL Content::execute(
 
 aRet = open( aOpenCommand, Environment );
 
-if ( (aOpenCommand.Mode == ucb::OpenMode::DOCUMENT ||
-  aOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE) &&
-supportsExclusiveWriteLock( Environment ) )
-lock( Environment );
 }
 else if ( aCommand.Name == "insert" )
 {
@@ -638,13 +630,18 @@ uno::Any SAL_CALL Content::execute(
 
 post( aArg, Environment );
 }
-else if ( aCommand.Name == "lock" &&
-  supportsExclusiveWriteLock( Environment ) )
+else if ( aCommand.Name == "lock" )
 {
 
 // lock
 
-
+// supportsExclusiveWriteLock()  does not work if the file is being 
created.
+// The lack of lock functionality is taken care of inside lock(),
+// a temporary measure.
+// This current implementation will result in a wasted lock request 
issued to web site
+// that don't support it.
+// TODO: need to rewrite the managing of the m_bTransient flag, when 
the resource is non yet existent
+// and the first lock on a non existed resource first creates it then 
lock it.
 lock( Environment );
 }
 else if ( aCommand.Name == "unlock" &&
@@ -1325,8 +1322,18 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 {
 const OUString & rName = rProperties[ n ].Name;
 
-if ( std::none_of(m_aFailed

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   21 ++---
 1 file changed, 2 insertions(+), 19 deletions(-)

New commits:
commit 028a6932a697c3f8087cf6a32ce39bde9b945b39
Author: Michael Stahl 
AuthorDate: Thu Oct 7 12:53:32 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:25:52 2021 +0100

ucb: webdav-curl: Remove redundant comparisons, copy properties 
unconditionally

[ replicate commit 39bbfa61653ba7c3cca0aed739559914c78edc89 ]

Change-Id: I28730c1fc7f6808bf9657855cf1d65369b695c4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123227
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index d63fc7356669..d0756cdb634d 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1318,26 +1318,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 {
 sal_Int32 nProps = 0;
 sal_Int32 nCount = rProperties.getLength();
-for ( sal_Int32 n = 0; n < nCount; ++n )
+for ( sal_Int32 n = 0; n < nCount; ++n, ++nProps )
 {
-const OUString & rName = rProperties[ n ].Name;
-
-if (!std::any_of(m_aFailedPropNames.begin(), 
m_aFailedPropNames.end(),
-[&](const OUString& rPropName) {
-bool const isFound(rPropName == rName);
-if (isFound)
-{
-// the failed property in cache is the 
same as the requested one,
-// so add it to the requested 
properties list
-aProperties[ nProps ] = rProperties[ n 
];
-nProps++;
-}
-return isFound;
-}) )
-{
-aProperties[ nProps ] = rProperties[ n ];
-nProps++;
-}
+aProperties[ nProps ] = rProperties[ n ];
 }
 
 aProperties.realloc( nProps );


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  286 ++-
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |   12 
 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |3 
 3 files changed, 236 insertions(+), 65 deletions(-)

New commits:
commit b5d91ff10fda72bc9758e7087f8a1a24d2d27022
Author: Giuseppe Castagno 
AuthorDate: Fri Aug 28 18:52:36 2015 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:26:14 2021 +0100

ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 3

Changes done to the code in sfx2, ucbhelper, ucb, unotools in no particular 
order

- add method helpers to call the ucb lock/unlock

- add lock/unlock 'real' management

- make DateChange property retrieval working for WebDAV as well

- add check for changed content of a WebDAV file, in order to reload
it correctly when 'Edit Mode' command is activated from GUI

- Unlock WebDAV file while saving only if explicitly enabled
  Needed in order to avoid the small window of file unlocked state that
  opens while saving a file.
  When saving LO actually does as follows:
  - unlock the prevoius version of the file
  - prepares operations to save the modified version
  - lock the new file
  - save the new version

- the lock method is enabled if the DAV resource supports it.
In case the lock is not supported, for example example DAV with lock
disabled, the lock method is disabled.

Exception: when the resource is first created and the lock is not
supported: a lock command is sent anyway, because if the resource is not
yet present, there is no method to detect the lock/unlock availability
in this case.

- cppcheck:noExplicitConstructor

[ port of commit b4576f3da4d90139fc5140962d13cb91dab98797
  excluding the obsolete FTP scheme thing ]

Change-Id: I16bb4e2fa9899fd31af7c223390f3fb213330fa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123228
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index d0756cdb634d..f9933c639074 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -197,7 +197,9 @@ Content::Content(
   rtl::Reference< DAVSessionFactory > const & rSessionFactory )
 : ContentImplHelper( rxContext, pProvider, Identifier ),
   m_eResourceType( UNKNOWN ),
+  m_eResourceTypeForLocks( UNKNOWN ),
   m_pProvider( pProvider ),
+  m_rSessionFactory( rSessionFactory ),
   m_bTransient( false ),
   m_bCollection( false ),
   m_bDidGetOrHead( false )
@@ -228,6 +230,7 @@ Content::Content(
 bool isCollection )
 : ContentImplHelper( rxContext, pProvider, Identifier ),
   m_eResourceType( UNKNOWN ),
+  m_eResourceTypeForLocks( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( true ),
   m_bCollection( isCollection ),
@@ -635,23 +638,28 @@ uno::Any SAL_CALL Content::execute(
 
 // lock
 
-// supportsExclusiveWriteLock()  does not work if the file is being 
created.
-// The lack of lock functionality is taken care of inside lock(),
-// a temporary measure.
-// This current implementation will result in a wasted lock request 
issued to web site
-// that don't support it.
-// TODO: need to rewrite the managing of the m_bTransient flag, when 
the resource is non yet existent
-// and the first lock on a non existed resource first creates it then 
lock it.
-lock( Environment );
+ResourceType eType = resourceTypeForLocks( Environment );
+// when the resource is not yet present the lock is used to create it
+// see: http://tools.ietf.org/html/rfc4918#section-7.3
+// If the resource doesn't exists and the lock is not enabled (DAV with
+// no lock or a simple web) the error will be dealt with inside lock() 
method
+if ( eType == NOT_FOUND ||
+eType == DAV )
+{
+lock( Environment );
+if ( eType == NOT_FOUND )
+{
+m_eResourceType = UNKNOWN;  // lock may have created it, need 
to check again
+m_eResourceTypeForLocks = UNKNOWN;
+}
+}
 }
-else if ( aCommand.Name == "unlock" &&
-  supportsExclusiveWriteLock( Environment ) )
+else if ( aCommand.Name == "unlock" )
 {
 
 // unlock
-
-
-unlock( Environment );
+if ( resourceTypeForLocks( Environment ) == DAV )
+unlock( Environment );
 }
 else if ( aCommand.Name == "createNewContent" &&
   isFolder( Environment ) )
@@ -749,6 +757,7 @@ uno::Any SAL_CALL Content::execute(
 }
 
 SAL_INFO("ucb.ucp.webdav",  "< Content::execute: end: command: " << 
aCommand.Name);
+
 return aRet;
 }
 
@@ -2385,7 +2394,15

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit 98c05dd05318e6c8a77801d85c015539d933ffa6
Author: Giuseppe Castagno 
AuthorDate: Wed Aug 19 12:13:35 2015 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:26:43 2021 +0100

ucb: webdav-curl: tdf#83531 Opening WebDAV URL WebDav fails if write is 
restricted

Happened because LOCK method was not allowed without credentials.

[ port of commit 0326352470aee1a774bb5aa314c4f3625c1372b3 ]

Change-Id: Id94b96856737e50715c2a18427ba22c3776a8da9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123272
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index f9933c639074..43884cdbab47 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2997,6 +2997,28 @@ void Content::lock(
 false );
 }
 break;
+case DAVException::DAV_HTTP_AUTH:
+{
+SAL_WARN( "ucb.ucp.webdav", "lock: DAVException Authentication 
error - URL: <"
+  << m_xIdentifier->getContentIdentifier() << ">" );
+// this could mean:
+// - interaction handler for credential management not present 
(happens, depending
+//   on the LO framework processing)
+// - the remote site is a WebDAV with special configuration: 
read/only for read operations
+//   and read/write for write operations, the user is not 
allowed to lock/write and
+//   she cancelled the credentials request.
+//   this is not actually an error, but the exception is sent 
directly from here, avoiding the automatic
+//   management that takes part in cancelCommandExecution() 
below
+// Unfortunately there is no InteractiveNetwork*Exception 
available to signal this
+// since it mostly happens on read/only part of webdav, this 
appears to be the most correct exception available
+throw
+ucb::InteractiveNetworkWriteException(
+"Authentication error while trying to lock! Write only 
WebDAV perhaps?",
+static_cast< cppu::OWeakObject * >( this ),
+task::InteractionClassification_ERROR,
+e.getData() );
+}
+break;
 case DAVException::DAV_HTTP_ERROR:
 //grab the error code
 switch( e.getStatus() )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/ContentProperties.cxx  |4 +-
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx  |4 +-
 ucb/source/ucp/webdav-curl/webdavcontent.cxx  |   23 
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx |   31 ++
 4 files changed, 47 insertions(+), 15 deletions(-)

New commits:
commit 97a22b7a584ae6f5237e18be3265e1a72705d773
Author: Michael Stahl 
AuthorDate: Fri Oct 8 11:58:04 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:27:05 2021 +0100

ucb: webdav-curl: Add/change some logs in WebDAV ucb.ucp layer.

[ replicate commit dd9c15b36f69bec4d4fc9b0049f7e496e5eb9e9d ]

Change-Id: I9eb87ea7216c83ce1ac63f65dd96ebe6760a50a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123273
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index 53e4593fc342..ea5357fcd88e 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -77,8 +77,8 @@ ContentProperties::ContentProperties( const DAVResource& 
rResource )
 : m_xProps( new PropertyValueMap ),
   m_bTrailingSlash( false )
 {
-SAL_WARN_IF( !rResource.uri.getLength(), "ucb.ucp.webdav",
-"ContentProperties ctor - Empty resource URI!" );
+assert(!rResource.uri.isEmpty() &&
+"ContentProperties ctor - Empty resource URI!");
 
 // Title
 try
diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index 34c3429f3bf3..7a2aa2b7e590 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -1019,8 +1019,8 @@ void DAVResourceAccess::initialize()
 
 const OUString & DAVResourceAccess::getRequestURI() const
 {
-SAL_WARN_IF( !m_xSession.is(), "ucb.ucp.webdav",
-"DAVResourceAccess::getRequestURI - Not initialized!" );
+assert(m_xSession.is() &&
+"DAVResourceAccess::getRequestURI - Not initialized!");
 
 // In case a proxy is used we have to use the absolute URI for a request.
 if ( m_xSession->UsesProxy() )
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 43884cdbab47..01d8a40df7ee 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2884,7 +2884,7 @@ Content::ResourceType Content::resourceTypeForLocks(
 switch( e.getStatus() )
 {
 case SC_NOT_FOUND:
-SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks - 
URL: <"
+SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() - 
URL: <"
   << m_xIdentifier->getContentIdentifier() << 
"> was not found. ");
 eResourceTypeForLocks = NOT_FOUND;
 break;
@@ -2899,13 +2899,13 @@ Content::ResourceType Content::resourceTypeForLocks(
 case SC_NOT_IMPLEMENTED:// 
http://tools.ietf.org/html/rfc7231#section-6.6.2
 case SC_METHOD_NOT_ALLOWED: // 
http://tools.ietf.org/html/rfc7231#section-6.5.5
 // they all mean the resource is NON_DAV
-SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks 
DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: 
<"
+SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() 
DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: 
<"
   << m_xIdentifier->getContentIdentifier() << 
">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
 eResourceTypeForLocks = NON_DAV;
 break;
 default:
 //fallthrough
-SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks 
DAVException - URL: <"
+SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() 
DAVException - URL: <"
   << m_xIdentifier->getContentIdentifier() << 
">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
 eResourceTypeForLocks = UNKNOWN;
 }
@@ -2924,7 +2924,7 @@ Content::ResourceType Content::resourceTypeForLocks(
 "different resource types for <" << rURL << ">: "
 << +eResourceTypeForLocks << " vs. " << +m_eResourceTypeForLocks);
 }
-SAL_INFO( "ucb.ucp.webdav", "resourceTypeForLocks - URL: <"
+SAL_INFO( "ucb.ucp.webdav", "resourceTypeForLocks() - URL: <"
   << m_xIdentifier->getContentIdentifier() << ">, 
m_eResourceTypeForLocks: " << m_eResourceTypeForLocks );
 return m_eResourceTypeForLocks;
 }
@

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 96b1a6878cbcb05f962abe5c9bb073f4dff6f4dc
Author: Giuseppe Castagno 
AuthorDate: Sun Nov 22 17:14:09 2015 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:27:38 2021 +0100

ucb: webdav-curl: Fix tdf#90700 Notify connect timeout early.

Throws exception to manage timeout early in the first connection
sequence.

[ port of commit 95958755cbbf8c6026b878703400d5d9ec1e6c98 ]

Change-Id: Ib6d306100ab04a3a21c37108d5c88185acf2524a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123274
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 01d8a40df7ee..e579a30c517c 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3505,6 +3505,14 @@ Content::ResourceType Content::getResourceType(
 *networkAccessAllowed = *networkAccessAllowed
 && shouldAccessNetworkAfterException(e);
 }
+// if the two net events below happen, something
+// is going on to the connection so break the command flow
+if ( ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||
+ ( e.getError() == DAVException::DAV_HTTP_CONNECT ) )
+{
+cancelCommandExecution( e, xEnv );
+// unreachable
+}
 
 // cancel command execution is case that no user authentication data 
has been provided.
 if ( e.getError() == DAVException::DAV_HTTP_NOAUTH )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   47 ---
 1 file changed, 28 insertions(+), 19 deletions(-)

New commits:
commit 11a457538a300d8df0c5c03d3cb590e94e6d99fa
Author: Giuseppe Castagno 
AuthorDate: Fri Dec 4 17:10:06 2015 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:28:03 2021 +0100

ucb: webdav-curl: tdf#95792: fix saving file the first time on some WebDAV 
servers.

Some WebDAV servers don't implement section 7.3 of RFC4918:


This lack of implementation breaks 'Save As...' functionality
when the target is a WebDAV server, by not locking the URL
('reserve the name for use', in RFC4918 parlance).

The server not implementing this usually answers with one of
'405 Method Not Allowed', '501 Not Implemented' or
'412 Precondition Failed' http error codes.

The fix should manage this lack of implementation.

[ port of commit 4c82edfb3a9286a0bfef3f006e468e5c331987eb ]

Change-Id: I343368bb91bd143aa26d8449b48f3b5300d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123275
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index e579a30c517c..e2ed80e3c5ed 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2888,16 +2888,16 @@ Content::ResourceType Content::resourceTypeForLocks(
   << m_xIdentifier->getContentIdentifier() << 
"> was not found. ");
 eResourceTypeForLocks = NOT_FOUND;
 break;
-// some servers returns this, instead
+// some servers returns SC_FORBIDDEN, instead
 // TODO: probably remove it, when OPTIONS implemented
-// the meaning of SC_FORBIDDEN is, according to 
http://tools.ietf.org/html/rfc7231#section-6.5.3
+// the meaning of SC_FORBIDDEN is, according to 
:
 // The 403 (Forbidden) status code indicates that the 
server understood
 // the request but refuses to authorize it
 case SC_FORBIDDEN:
-// this returned errors are part of base http 1.1 RFCs
-// see:
-case SC_NOT_IMPLEMENTED:// 
http://tools.ietf.org/html/rfc7231#section-6.6.2
-case SC_METHOD_NOT_ALLOWED: // 
http://tools.ietf.org/html/rfc7231#section-6.5.5
+// Errors SC_NOT_IMPLEMENTED and SC_METHOD_NOT_ALLOWED 
are
+// part of base http 1.1 RFCs
+case SC_NOT_IMPLEMENTED:// 

+case SC_METHOD_NOT_ALLOWED: // 

 // they all mean the resource is NON_DAV
 SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() 
DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: 
<"
   << m_xIdentifier->getContentIdentifier() << 
">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
@@ -3001,7 +3001,7 @@ void Content::lock(
 {
 SAL_WARN( "ucb.ucp.webdav", "lock(): DAVException 
Authentication error - URL: <"
   << m_xIdentifier->getContentIdentifier() << ">" );
-// this could mean:
+// DAVException::DAV_HTTP_AUTH exception can mean:
 // - interaction handler for credential management not present 
(happens, depending
 //   on the LO framework processing)
 // - the remote site is a WebDAV with special configuration: 
read/only for read operations
@@ -3023,20 +3023,28 @@ void Content::lock(
 //grab the error code
 switch( e.getStatus() )
 {
-// this returned error is part of base http 1.1 RFCs
-case SC_NOT_IMPLEMENTED:
-case SC_METHOD_NOT_ALLOWED:
-SAL_WARN( "ucb.ucp.webdav", "lock() DAVException 
(SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <"
+// The 'case SC_PRECONDITION_FAILED' just below tries to 
solve a problem
+// in SharePoint when locking the resource on first 
creation fails due to this:
+// 

+// (retrieved on 2015-08-14)
+case SC_PRECONDITION_FAILED:// 

+//

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 6c0c0ce22e8b9085ed0993a2445560206b05724e
Author: Giuseppe Castagno 
AuthorDate: Sat Nov 21 20:41:06 2015 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:28:31 2021 +0100

ucb: webdav-curl: Related tdf#90700 Add configuration for web connection 
timeout.

Currently the connection timeout is governed by operating system
default.

LO timeouts will be used in place of the TCP socket operating
system ones, only in operating system where this is currently
possible.

The timeouts to use can be changed in LO configuration:
'Tools > Options > Advanced > Expert Configuration'.
Propriety names are ConnectTimeout and ReadTimeout.

ConnectTimeout contains the timeout (in seconds) used when
making a connection (max 180 s, min 2 s, default 20 s).

ReadTimeout contains the timeout (in seconds) used when reading
from a socket (max 180 s, min 20 s, default 60 s).

[ port of commit 14220052ef2b8675ee12aad63b0402f023d9760a
  omitting Session change which isn't directly possible ]

Change-Id: I276851958f587346a36ee5f173b3e4fb88a944b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123276
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index e2ed80e3c5ed..f06169f323ba 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3303,6 +3303,7 @@ uno::Any Content::MapDAVException( const DAVException & 
e, bool bWrite )
 //case DAVException::DAV_HTTP_AUTHPROXY:
 //break;
 
+case DAVException::DAV_HTTP_TIMEOUT:
 case DAVException::DAV_HTTP_CONNECT:
 aException <<=
 ucb::InteractiveNetworkConnectException(
@@ -3312,10 +3313,6 @@ uno::Any Content::MapDAVException( const DAVException & 
e, bool bWrite )
 e.getData() );
 break;
 
-// @@@ No matching InteractiveNetwork*Exception
-//case DAVException::DAV_HTTP_TIMEOUT:
-//break;
-
 // @@@ No matching InteractiveNetwork*Exception
 // case DAVException::DAV_HTTP_REDIRECT:
 // break;
@@ -3405,6 +3402,7 @@ uno::Any Content::MapDAVException( const DAVException & 
e, bool bWrite )
 bool Content::shouldAccessNetworkAfterException( const DAVException & e )
 {
 if ( ( e.getStatus() == SC_NOT_FOUND ) ||
+ ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||
  ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ||
  ( e.getError() == DAVException::DAV_HTTP_CONNECT ) ||
  ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/ContentProperties.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a50dbf49906f4aab367b2556be99779b2b05866d
Author: Giuseppe Castagno 
AuthorDate: Fri Jan 29 16:11:26 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:28:57 2021 +0100

ucb: webdav-curl: Related tdf#95217: Http header names are case insensitive

[ port of commit e973b342826e54f147251b132c3325d30749e312 ]

Change-Id: I7473625894c023c526a8ffeccd7ec6d67629ff76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123277
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index ea5357fcd88e..54d6bcc75df2 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -406,7 +406,7 @@ void ContentProperties::addProperty( const OUString & rName,
 (*m_xProps)[ OUString( "Size" ) ]
 = PropertyValue( uno::makeAny( aValue.toInt64() ), true );
 }
-else if ( rName == "Content-Length" )
+else if ( rName.equalsIgnoreAsciiCase( "Content-Length" ) )
 {
 // Do NOT map Content-Length entity header to DAV:getcontentlength!
 // Only DAV resources have this property.
@@ -424,7 +424,7 @@ void ContentProperties::addProperty( const OUString & rName,
 (*m_xProps)[ OUString( "MediaType" ) ]
 = PropertyValue( rValue, true );
 }
-else if ( rName == "Content-Type" )
+else if ( rName.equalsIgnoreAsciiCase( "Content-Type" ) )
 {
 // Do NOT map Content-Type entity header to DAV:getcontenttype!
 // Only DAV resources have this property.
@@ -447,7 +447,7 @@ void ContentProperties::addProperty( const OUString & rName,
 (*m_xProps)[ OUString( "DateModified" ) ]
 = PropertyValue( uno::makeAny( aDate ), true );
 }
-else if ( rName == "Last-Modified" )
+else if ( rName.equalsIgnoreAsciiCase( "Last-Modified" ) )
 {
 // Do not map Last-Modified entity header to DAV:getlastmodified!
 // Only DAV resources have this property.


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 09730ea0ccfe63982cdb869d5eaa906982283bf1
Author: Giuseppe Castagno 
AuthorDate: Fri Jan 29 15:39:17 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:29:28 2021 +0100

ucb: webdav-curl: Related tdf#95217: Force HEAD method in Web access if 
PROPFIND failed

[ port of commit d61352f58a7f750d3b0b0a9c2d6498fbb7a6e10d ]

Change-Id: Id945be7a1f71c830f3ab15c54fbf65a32be71a2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123278
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index f06169f323ba..040b0df99214 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1379,6 +1379,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 
 if ( bNetworkAccessAllowed )
 {
+if( eType != DAV )
+m_bDidGetOrHead = false;
+
 // All properties obtained already?
 std::vector< OUString > aMissingProps;
 if ( !( xProps


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Noel Grandin (via logerrit)
 ucb/source/ucp/webdav-curl/ContentProperties.cxx |   12 
 ucb/source/ucp/webdav-curl/ContentProperties.hxx |   10 --
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |3 +--
 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |5 +
 ucb/source/ucp/webdav-curl/webdavprovider.hxx|3 +--
 5 files changed, 11 insertions(+), 22 deletions(-)

New commits:
commit 14c7381438a4d0f2cd6b660c72f4ff8d03834fba
Author: Noel Grandin 
AuthorDate: Fri Feb 26 14:48:09 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:30:00 2021 +0100

ucb: webdav-curl: loplugin:unuseddefaultparam in ucb

[ port of commit 83911dd753fbfd0328bae2dfa37d19f514d4b2f9 ]

Change-Id: I5a57b7af9cd231e89fc93cc1a5f277cae23a1427
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123279
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
index 54d6bcc75df2..59773db1cbdc 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx
@@ -194,8 +194,7 @@ const PropertyValue * ContentProperties::get(
 // static
 void ContentProperties::UCBNamesToDAVNames(
 const uno::Sequence< beans::Property > & rProps,
-std::vector< OUString > & propertyNames,
-bool bIncludeUnmatched /* = true */ )
+std::vector< OUString > & propertyNames )
 {
 
 // Assemble list of DAV properties to obtain from server.
@@ -278,8 +277,7 @@ void ContentProperties::UCBNamesToDAVNames(
 }
 else
 {
-if ( bIncludeUnmatched )
-propertyNames.push_back( rProp.Name );
+propertyNames.push_back( rProp.Name );
 }
 }
 }
@@ -288,8 +286,7 @@ void ContentProperties::UCBNamesToDAVNames(
 // static
 void ContentProperties::UCBNamesToHTTPNames(
 const uno::Sequence< beans::Property > & rProps,
-std::vector< OUString > & propertyNames,
-bool bIncludeUnmatched /* = true */ )
+std::vector< OUString > & propertyNames )
 {
 
 // Assemble list of HTTP header names to obtain from server.
@@ -320,8 +317,7 @@ void ContentProperties::UCBNamesToHTTPNames(
 }
 else
 {
-if ( bIncludeUnmatched )
-propertyNames.push_back( rProp.Name );
+propertyNames.push_back( rProp.Name );
 }
 }
 }
diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.hxx 
b/ucb/source/ucp/webdav-curl/ContentProperties.hxx
index a4588f5214f6..0256450c2f90 100644
--- a/ucb/source/ucp/webdav-curl/ContentProperties.hxx
+++ b/ucb/source/ucp/webdav-curl/ContentProperties.hxx
@@ -81,25 +81,23 @@ public:
 
 // Maps the UCB property names contained in rProps with their DAV property
 // counterparts, if possible. All unmappable properties will be included
-// unchanged in resulting vector unless bIncludeUnmatched is set to false.
+// unchanged in resulting vector.
 // The vector filled by this method can directly be handed over to
 // DAVResourceAccess::PROPFIND. The result from PROPFIND
 // (vector< DAVResource >) can be used to create a ContentProperties
 // instance which can map DAV properties back to UCB properties.
 static void UCBNamesToDAVNames( const css::uno::Sequence< 
css::beans::Property > & rProps,
-std::vector< OUString > & resources,
-bool bIncludeUnmatched = true );
+std::vector< OUString > & resources );
 
 // Maps the UCB property names contained in rProps with their HTTP header
 // counterparts, if possible. All unmappable properties will be included
-// unchanged in resulting vector unless bIncludeUnmatched is set to false.
+// unchanged in resulting vector.
 // The vector filled by this method can directly be handed over to
 // DAVResourceAccess::HEAD. The result from HEAD (vector< DAVResource >)
 // can be used to create a ContentProperties instance which can map header
 // names back to UCB properties.
 static void UCBNamesToHTTPNames( const css::uno::Sequence< 
css::beans::Property > & rProps,
-std::vector< OUString > & resources,
-bool bIncludeUnmatched = true );
+std::vector< OUString > & resources );
 
 // return true, if all properties contained in rProps are contained in
 // this ContentProperties instance. Otherwise, false will be returned.
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 040b0df99214..8bb0e5e82b15 100644
--- a/ucb/source/ucp/webd

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit e1bb4425e442eacdc1ca3518d62116e739ba7eb0
Author: Giuseppe Castagno 
AuthorDate: Mon Feb 1 16:02:16 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:30:33 2021 +0100

ucb: webdav-curl: In case of Web site access, add Content-Type to HEAD 
request.

This remove a necessity for another HEAD request when MediaType
is requested while accessing a Web site, a cleaner implementation of
d61352f58a7f750d3b0b0a9c2d6498fbb7a6e10d.

This behavior is active only on a standard Web site, when PROPFIND
failed earlier on the program flow, without retrieving the property
DAV:getcontenttype.

[ port of commit 9325c18044a8adc852e2d1b42a5a479ab6195da8 ]

Change-Id: Iebdae815d096be8ef45b969d7c4d84acc26694b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123280
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 8bb0e5e82b15..ec16224b1066 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1379,9 +1379,6 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 
 if ( bNetworkAccessAllowed )
 {
-if( eType != DAV )
-m_bDidGetOrHead = false;
-
 // All properties obtained already?
 std::vector< OUString > aMissingProps;
 if ( !( xProps
@@ -1397,6 +1394,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 rProperties,
 aHeaderNames );
 
+if( eType != DAV )
+{
+// in case of not DAV PROFIND (previously in program flow) 
failed
+// so we need to add the only prop that's common
+// to DAV and NON_DAV: MediaType, that maps to Content-Type
+aHeaderNames.push_back( "Content-Type" );
+}
+
 if ( !aHeaderNames.empty() )
 {
 try


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResource.hxx  |3 --
 ucb/source/ucp/webdav-curl/DAVTypes.hxx |   30 
 ucb/source/ucp/webdav-curl/webdavresponseparser.cxx |2 -
 3 files changed, 1 insertion(+), 34 deletions(-)

New commits:
commit 59508791aa4f30e1c4f0a61f55e19d839d8a4c30
Author: Michael Stahl 
AuthorDate: Fri Oct 8 16:10:46 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:31:10 2021 +0100

ucb: webdav-curl: loplugin:unusedfields in ucb/

[ replicate commit 00bb8141beee7088625992a046e94c6f8da8da83 ]

Change-Id: I8144eca6b27fda799a8e875b568a3bcf6b974d96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123281
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResource.hxx 
b/ucb/source/ucp/webdav-curl/DAVResource.hxx
index 15359719d880..8bbe89587acc 100644
--- a/ucb/source/ucp/webdav-curl/DAVResource.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVResource.hxx
@@ -48,10 +48,7 @@ struct DAVResource
 
 struct DAVResourceInfo
 {
-OUString uri;
 std::vector < OUString > properties;
-
-explicit DAVResourceInfo( const OUString & inUri ) : uri( inUri ) {}
 };
 
 } // namespace http_dav_ucp
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
index 063abf03199e..3928d42e921e 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
@@ -25,36 +25,6 @@
 
 namespace http_dav_ucp
 {
-/* RFC 2518
-
-15.1 Class 1
-
-   A class 1 compliant resource MUST meet all "MUST" requirements in all
-   sections of this document.
-
-   Class 1 compliant resources MUST return, at minimum, the value "1" in
-   the DAV header on all responses to the OPTIONS method.
-
-15.2 Class 2
-
-   A class 2 compliant resource MUST meet all class 1 requirements and
-   support the LOCK method, the supportedlock property, the
-   lockdiscovery property, the Time-Out response header and the Lock-
-   Token request header.  A class "2" compliant resource SHOULD also
-   support the Time-Out request header and the owner XML element.
-
-   Class 2 compliant resources MUST return, at minimum, the values "1"
-   and "2" in the DAV header on all responses to the OPTIONS method.
-*/
-
-struct DAVCapabilities
-{
-bool class1;
-bool class2;
-bool executable; // supports "executable" property (introduced by mod_dav)
-
-DAVCapabilities() : class1( false ), class2( false ), executable( false ) 
{}
-};
 
 enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 };
 
diff --git a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx 
b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
index d95ff1416160..1c24d63200a3 100644
--- a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
@@ -761,7 +761,7 @@ namespace
 // when collecting properties add them 
to result when there are some
 if(!maResponseNames.empty())
 {
-http_dav_ucp::DAVResourceInfo 
aDAVResourceInfo(maHref);
+http_dav_ucp::DAVResourceInfo 
aDAVResourceInfo;
 
 aDAVResourceInfo.properties = 
maResponseNames;
 
maResult_PropName.push_back(aDAVResourceInfo);


[Libreoffice-commits] core.git: solenv/clang-format ucb/Library_ucpdav1.mk ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 solenv/clang-format/excludelist |1 
 ucb/Library_ucpdav1.mk  |1 
 ucb/source/ucp/webdav-curl/DAVTypes.cxx |   68 +
 ucb/source/ucp/webdav-curl/DAVTypes.hxx |  124 
 4 files changed, 182 insertions(+), 12 deletions(-)

New commits:
commit f472792a3ec03797b55e83d2de759caba3e57f79
Author: Giuseppe Castagno 
AuthorDate: Sat Jan 9 17:32:26 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:31:35 2021 +0100

ucb: webdav-curl: tdf#101094 (1) OPTIONS: New class to store retrieved 
OPTIONS

This class describes the DAV options useful to LO.
Added behavioural unit tests as well.

[ port of commit f950b49393ee6539f2a7b3c306aa4fc119f24a84 ]

Change-Id: Idfcd66229a2bbbdf4452da731a5b921527447358
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123282
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index a70248a605ea..af38ed914cb2 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14001,6 +14001,7 @@ ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
 ucb/source/ucp/webdav-curl/DAVSession.hxx
 ucb/source/ucp/webdav-curl/DAVSessionFactory.cxx
+ucb/source/ucp/webdav-curl/DAVTypes.cxx
 ucb/source/ucp/webdav-curl/DAVTypes.hxx
 ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
 ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index bedea713b179..ee1c944b1fbd 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-curl/DAVProperties \
ucb/source/ucp/webdav-curl/DAVResourceAccess \
ucb/source/ucp/webdav-curl/DAVSessionFactory \
+   ucb/source/ucp/webdav-curl/DAVTypes \
ucb/source/ucp/webdav-curl/DateTimeHelper \
ucb/source/ucp/webdav-curl/SerfLockStore \
ucb/source/ucp/webdav-curl/UCBDeadPropertyValue \
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
new file mode 100644
index ..b71f61a1a3d3
--- /dev/null
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#include "DAVTypes.hxx"
+
+#include "../inc/urihelper.hxx"
+
+#include 
+
+
+using namespace http_dav_ucp;
+using namespace com::sun::star;
+
+// DAVCapabilities implementation
+
+DAVOptions::DAVOptions() :
+m_isResourceFound( false ),
+m_isClass1( false ),
+m_isClass2( false ),
+m_isClass3( false ),
+m_aAllowedMethods(),
+m_nStaleTime( 0 ),
+m_sURL(),
+m_sRedirectedURL()
+{
+}
+
+
+DAVOptions::DAVOptions( const DAVOptions & rOther ) :
+m_isResourceFound( rOther.m_isResourceFound ),
+m_isClass1( rOther.m_isClass1 ),
+m_isClass2( rOther.m_isClass2 ),
+m_isClass3( rOther.m_isClass3 ),
+m_aAllowedMethods( rOther.m_aAllowedMethods ),
+m_nStaleTime( rOther.m_nStaleTime ),
+m_sURL( rOther.m_sURL ),
+m_sRedirectedURL( rOther.m_sRedirectedURL)
+{
+}
+
+
+DAVOptions::~DAVOptions()
+{
+}
+
+
+bool DAVOptions::operator==( const DAVOptions& rOpts ) const
+{
+return
+m_isResourceFound == rOpts.m_isResourceFound &&
+m_isClass1 == rOpts.m_isClass1 &&
+m_isClass2 == rOpts.m_isClass2 &&
+m_isClass3 == rOpts.m_isClass3 &&
+m_aAllowedMethods == rOpts.m_aAllowedMethods &&
+m_nStaleTime == rOpts.m_nStaleTime &&
+m_sURL == rOpts.m_sURL &&
+m_sRedirectedURL == rOpts.m_sRedirectedURL;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
index 3928d42e921e..e1d53909b4b9 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
@@ -20,28 +20,128 @@
 
 #pragma once
 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 
 namespace http_dav_ucp
 {
+/* Excerpt from RFC 4918
+   
 
-enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 };
+   18.1 Class 1
 
-enum ProppatchOperation { PROPSET = 0, PROPREMOVE = 1 };
+   A class 1 compliant resource MUST meet all "MUST" requirements in all
+   sections of this document.
 
-struct ProppatchValue
-{
-ProppatchOperation   operation;
-OUString name;
-css::uno::Anyvalue;
+   Class 1 compliant resources MU

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx |   75 +
 ucb/source/ucp/webdav-curl/CurlSession.hxx |3 +
 ucb/source/ucp/webdav-curl/DAVSession.hxx  |9 ---
 3 files changed, 80 insertions(+), 7 deletions(-)

New commits:
commit 1a7c877f51f3f6325b67d5250253efc36c3d4549
Author: Michael Stahl 
AuthorDate: Fri Oct 8 18:27:38 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:31:58 2021 +0100

ucb: webdav-curl: implement OPTIONS()

Change-Id: I601a161c3e6c4b7e741a79bfd15510bb40b5d81c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123283
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 8ac493ce3afb..29ddf3671de6 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1106,6 +1107,80 @@ auto CurlProcessor::ProcessRequest(
 }
 }
 
+auto CurlSession::OPTIONS(OUString const& rURIReference,
+
+  DAVOptions& rOptions, DAVRequestEnvironment const& 
rEnv) -> void
+{
+SAL_INFO("ucb.ucp.webdav.curl", "OPTIONS: " << rURIReference);
+
+rOptions.reset();
+
+::std::vector const headerNames{ "allow", "dav" };
+DAVResource result;
+::std::pair<::std::vector const&, DAVResource&> const 
headers(headerNames, result);
+
+{
+// scope to release m_Mutex before accessing LockStore
+Guard g(m_Mutex, [&]() {
+auto rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_NOBODY, 0L);
+assert(rc == CURLE_OK);
+(void)rc;
+rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_CUSTOMREQUEST, 
nullptr);
+assert(rc == CURLE_OK);
+});
+
+// need this to prevent calling write_callback
+auto rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_NOBODY, 1L);
+assert(rc == CURLE_OK);
+rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_CUSTOMREQUEST, "OPTIONS");
+if (rc != CURLE_OK)
+{
+SAL_WARN("ucb.ucp.webdav.curl", "CURLOPT_CUSTOMREQUEST failed: " 
<< GetErrorString(rc));
+throw DAVException(DAVException::DAV_SESSION_CREATE,
+   ConnectionEndPointString(m_URI.GetHost(), 
m_URI.GetPort()));
+}
+
+CurlProcessor::ProcessRequest(g, *this, rURIReference, &rEnv, nullptr, 
nullptr, nullptr,
+  &headers);
+}
+
+for (auto const& it : result.properties)
+{
+OUString value;
+it.Value >>= value;
+SAL_INFO("ucb.ucp.webdav.curl", "OPTIONS: header: " << it.Name << ": " 
<< value);
+if (it.Name.equalsIgnoreAsciiCase("allow"))
+{
+rOptions.setAllowedMethods(value);
+}
+else if (it.Name.equalsIgnoreAsciiCase("dav"))
+{
+// see ,
+// ,
+// and 
+// we detect the class (1, 2 and 3), other elements (token, URL)
+// are not used for now
+auto const 
list(::comphelper::string::convertCommaSeparated(value));
+for (OUString const& v : list)
+{
+if (v == "1")
+{
+rOptions.setClass1();
+}
+else if (v == "2")
+{
+rOptions.setClass2();
+}
+else if (v == "3")
+{
+rOptions.setClass3();
+}
+}
+}
+}
+rOptions.setResourceFound();
+}
+
 auto CurlProcessor::PropFind(
 CurlSession& rSession, OUString const& rURIReference, Depth const nDepth,
 ::std::tuple<::std::vector const&, ::std::vector* 
const,
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.hxx 
b/ucb/source/ucp/webdav-curl/CurlSession.hxx
index 6316a2ab47cc..58a828b29f14 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.hxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.hxx
@@ -55,6 +55,9 @@ public:
 virtual auto UsesProxy() -> bool override;
 
 // DAV methods
+virtual auto OPTIONS(OUString const& rURIReference, DAVOptions& rOptions,
+ DAVRequestEnvironment const& rEnv) -> void override;
+
 virtual auto PROPFIND(OUString const& rURIReference, Depth depth,
   ::std::vector const& rPropertyNames,
   ::std::vector& o_rResources,
diff --git a/ucb/source/ucp/webdav-curl/DAVSession.hxx 
b/ucb/source/ucp/webdav-curl/DAVSession.hxx
index c3caea7be6f2..cb298783161b 100644
--- a/ucb/source/ucp/webdav-curl/DAVSession.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVSession.hxx
@@ -66,14 +66,9 @@ public:
 
 // DAV methods
 
-
-// NOT U

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |   37 +++
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |5 +++
 2 files changed, 42 insertions(+)

New commits:
commit 59ed56fd299a0ef5e67aaba4c704262481355f43
Author: Michael Stahl 
AuthorDate: Fri Oct 8 18:43:17 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:32:23 2021 +0100

ucb: webdav-curl: implement DAVResourceAccess::OPTIONS()

This is just a copy of DAVResourceAccess::PROPFIND() and trivially
adapting 4 lines to call DAVSession::OPTIONS() with required arguments.

Change-Id: If2ac8e4a465d0f09b7cf02647ac4c8e4860c45b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123284
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index 7a2aa2b7e590..8787250c98f6 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -159,6 +159,43 @@ DAVResourceAccess & DAVResourceAccess::operator=(
 return *this;
 }
 
+void DAVResourceAccess::OPTIONS(
+DAVOptions & rOptions,
+const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+{
+initialize();
+
+int errorCount = 0;
+bool bRetry;
+do
+{
+bRetry = false;
+try
+{
+DAVRequestHeaders aHeaders;
+
+getUserRequestHeaders( xEnv,
+   getRequestURI(),
+   ucb::WebDAVHTTPMethod_OPTIONS,
+   aHeaders );
+
+m_xSession->OPTIONS( getRequestURI(),
+  rOptions,
+  DAVRequestEnvironment(
+  getRequestURI(),
+  new DAVAuthListener_Impl( xEnv, m_aURL ),
+  aHeaders, xEnv ) );
+}
+catch (DAVException const& e)
+{
+errorCount++;
+bRetry = handleException( e, errorCount );
+if ( !bRetry )
+throw;
+}
+}
+while ( bRetry );
+}
 
 void DAVResourceAccess::PROPFIND(
 const Depth nDepth,
diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
index 1fce8d1377dd..86a392e23cf1 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
@@ -77,6 +77,11 @@ public:
 
 // DAV methods
 
+/// @throws DAVException
+void
+OPTIONS(
+  DAVOptions & rOptions,
+  const css::uno::Reference< css::ucb::XCommandEnvironment > & 
xEnv );
 
 // allprop & named
 /// @throws DAVException


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   99 +++
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |   13 +++
 2 files changed, 112 insertions(+)

New commits:
commit 2b0c3c6c83f630f0bde1866b368dced7489a2d2f
Author: Giuseppe Castagno 
AuthorDate: Sun Jan 10 10:42:47 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:32:45 2021 +0100

ucb: webdav-curl: tdf#101094 (4) OPTIONS: Add member function 
getResourceOptions

[ port of commit 2777b6380c17bad8a966454947b9d991f9592224 ]

Change-Id: I8c54b564a8c92dcd395e104976f7a7071b5264eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123285
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index ec16224b1066..a90f1970f513 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3565,4 +3565,103 @@ Content::ResourceType Content::getResourceType(
 return ret;
 }
 
+
+void Content::getResourceOptions(
+const css::uno::Reference< css::ucb::XCommandEnvironment 
>& xEnv,
+DAVOptions& rDAVOptions,
+const std::unique_ptr< DAVResourceAccess > & rResAccess )
+{
+try
+{
+rResAccess->OPTIONS( rDAVOptions, xEnv );
+// IMPORTANT:the correctly implemented server will answer without 
errors, even if the resource is not present
+}
+catch ( DAVException const & e )
+{
+rResAccess->resetUri();
+
+switch( e.getError() )
+{
+case DAVException::DAV_HTTP_TIMEOUT:
+case DAVException::DAV_HTTP_CONNECT:
+{
+// something bad happened to the connection
+// not same as not found, this instead happens when the server 
does'n exist or does'n aswer at all
+// probably a new bit stating 'timed out' should be added to 
opts var?
+// in any case abort the command
+cancelCommandExecution( e, xEnv );
+// unreachable
+}
+break;
+case DAVException::DAV_HTTP_AUTH:
+{
+SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException 
Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" 
);
+// - the remote site is a WebDAV with special configuration: 
read/only for read operations
+//   and read/write for write operations, the user is not 
allowed to lock/write and
+//   she cancelled the credentials request.
+//   this is not actually an error, it means only that for 
current user this is a standard web,
+//   though possibly DAV enabled
+}
+break;
+case DAVException::DAV_HTTP_ERROR:
+{
+switch( e.getStatus() )
+{
+case SC_FORBIDDEN:
+{
+SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for 
URL <" << m_xIdentifier->getContentIdentifier() << ">" );
+rDAVOptions.setResourceFound(); // means it exists, 
but it's not DAV
+}
+break;
+case SC_BAD_REQUEST:
+{
+SAL_WARN( "ucb.ucp.webdav","OPTIONS - Bad request for 
URL <" << m_xIdentifier->getContentIdentifier() << ">" );
+rDAVOptions.setResourceFound(); // means it exists, 
but it's not DAV
+}
+break;
+case SC_NOT_IMPLEMENTED:
+case SC_METHOD_NOT_ALLOWED:
+{
+// OPTIONS method must be implemented in DAV
+// resource is NON_DAV, or not advertising it
+SAL_WARN( "ucb.ucp.webdav","OPTIONS - Method not 
implemented or not allowed for URL <" << m_xIdentifier->getContentIdentifier() 
<< ">" );
+rDAVOptions.setResourceFound(); // means it exists, 
but it's not DAV
+}
+break;
+case SC_NOT_FOUND:
+{
+SAL_WARN( "ucb.ucp.webdav", "OPTIONS - Resource not 
found for URL <" << m_xIdentifier->getContentIdentifier() << ">" );
+}
+break;
+default:
+break;
+}
+}
+break;
+default: // leave the resource type as UNKNOWN, for now
+// it means this will be managed as a standard http site
+SAL_WARN( "ucb.ucp.webdav","OPTIONS - DAVException for URL <" 
<< m_xIdentifier->getContentIdentifier() << ">, DAV error: "
+  << e.getError() << ", HTTP error: "<& xEnv,
+  

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  102 +--
 1 file changed, 51 insertions(+), 51 deletions(-)

New commits:
commit dac69982586001cb42af900382c544f052820913
Author: Michael Stahl 
AuthorDate: Fri Oct 8 19:02:08 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:33:19 2021 +0100

ucb: webdav-curl: indent that temporarily

Change-Id: I8cd3373b64c29d1f76c19a8f229cda0060cc79cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123286
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index a90f1970f513..3ffde115c8ed 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3474,64 +3474,64 @@ Content::ResourceType Content::getResourceType(
 
 ResourceType eResourceType = UNKNOWN;
 
-try
 {
-// Try to fetch some frequently used property value, e.g. those
-// used when loading documents... along with identifying whether
-// this is a DAV resource.
-std::vector< DAVResource > resources;
-std::vector< OUString > aPropNames;
-uno::Sequence< beans::Property > aProperties( 5 );
-aProperties[ 0 ].Name = "IsFolder";
-aProperties[ 1 ].Name = "IsDocument";
-aProperties[ 2 ].Name = "IsReadOnly";
-aProperties[ 3 ].Name = "MediaType";
-aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
-
-ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames );
-
-rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xEnv );
-
-// TODO - is this really only one?
-if ( resources.size() == 1 )
+try
 {
-osl::MutexGuard g(m_aMutex);
-m_xCachedProps.reset(
-new CachableContentProperties( ContentProperties( resources[ 0 
] ) ) );
-m_xCachedProps->containsAllNames(
-aProperties, m_aFailedPropNames );
-}
+// Try to fetch some frequently used property value, e.g. those
+// used when loading documents... along with identifying whether
+// this is a DAV resource.
+std::vector< DAVResource > resources;
+std::vector< OUString > aPropNames;
+uno::Sequence< beans::Property > aProperties( 5 );
+aProperties[ 0 ].Name = "IsFolder";
+aProperties[ 1 ].Name = "IsDocument";
+aProperties[ 2 ].Name = "IsReadOnly";
+aProperties[ 3 ].Name = "MediaType";
+aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
 
-eResourceType = DAV;
-}
-catch ( DAVException const & e )
-{
-rResAccess->resetUri();
+ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames );
 
-if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
-{
-// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
-// resource is NON_DAV
-eResourceType = NON_DAV;
-}
-else if (networkAccessAllowed != nullptr)
-{
-*networkAccessAllowed = *networkAccessAllowed
-&& shouldAccessNetworkAfterException(e);
+rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xEnv );
+
+if ( resources.size() == 1 )
+{
+osl::MutexGuard g(m_aMutex);
+m_xCachedProps.reset(
+new CachableContentProperties( ContentProperties( 
resources[ 0 ] ) ) );
+m_xCachedProps->containsAllNames(
+aProperties, m_aFailedPropNames );
+}
+eResourceType = DAV;
 }
-// if the two net events below happen, something
-// is going on to the connection so break the command flow
-if ( ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||
- ( e.getError() == DAVException::DAV_HTTP_CONNECT ) )
+catch ( DAVException const & e )
 {
-cancelCommandExecution( e, xEnv );
-// unreachable
-}
+rResAccess->resetUri();
 
-// cancel command execution is case that no user authentication data 
has been provided.
-if ( e.getError() == DAVException::DAV_HTTP_NOAUTH )
-{
-cancelCommandExecution( e, uno::Reference< 
ucb::XCommandEnvironment >() );
+if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
+{
+// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
+// resource is NON_DAV
+eResourceType = NON_DAV;
+}
+else if (networkAccessAllowed != nullptr)
+{
+*networkAccessAllowed = *networkAccessAllowed
+&& shouldAccessNetworkAfterException(e);
+}
+// if the two net events below happen, something
+  

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  170 ---
 1 file changed, 127 insertions(+), 43 deletions(-)

New commits:
commit 70f197cc6728482b0a42f4b1e90c55879346fdfb
Author: Giuseppe Castagno 
AuthorDate: Sun Jan 10 15:16:13 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:34:19 2021 +0100

ucb: webdav-curl: tdf#101094 (5) OPTIONS: Add options check in 
Content::getResourceType

Added some verbose SAL_INFO to detail server responses to PROPFIND.

Corrected a wrong comment and beautified a bit code I introduced
in commit 3b26a2a403ca5e99b0dd07d042d47501c091af16.

[ port of commit 211cb2dec3501a9ea224512ebedbc7cd1c46cd45 ]

Change-Id: I7917408dcc09e42cb23d29b28e02904594023dd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123287
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 3ffde115c8ed..b499327878d1 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1353,6 +1353,36 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 
 if ( 1 == resources.size() )
 {
+#if defined SAL_LOG_INFO
+{//debug
+// print received resources
+std::vector< DAVPropertyValue 
>::const_iterator it = resources[0].properties.begin();
+std::vector< DAVPropertyValue 
>::const_iterator end = resources[0].properties.end();
+while ( it != end )
+{
+OUString aPropValue;
+boolbValue;
+uno::Sequence< ucb::LockEntry > 
aSupportedLocks;
+if( (*it).Value >>= aPropValue )
+SAL_INFO( "ucb.ucp.webdav", "PROPFIND 
(getPropertyValues) - returned property: " << (*it).Name << ":" << aPropValue );
+else if( (*it).Value >>= bValue )
+SAL_INFO( "ucb.ucp.webdav", "PROPFIND 
(getPropertyValues) - returned property: " << (*it).Name << ":" <<
+  ( bValue ? "true" : "false" 
) );
+else if( (*it).Value >>= aSupportedLocks )
+{
+SAL_INFO( "ucb.ucp.webdav", "PROPFIND 
(getPropertyValues) - returned property: " << (*it).Name << ":" );
+for ( sal_Int32 n = 0; n < 
aSupportedLocks.getLength(); ++n )
+{
+SAL_INFO( "ucb.ucp.webdav","  
scope: "
+  << 
(aSupportedLocks[n].Scope == ucb::LockScope_SHARED ? "shared" : "exclusive")
+  << ", type: "
+  << 
(aSupportedLocks[n].Type != ucb::LockType_WRITE ? "" : "write") );
+}
+}
+++it;
+}
+}
+#endif
 if (xProps)
 xProps->addProperties(
 aPropNames,
@@ -3473,65 +3503,119 @@ Content::ResourceType Content::getResourceType(
 }
 
 ResourceType eResourceType = UNKNOWN;
+DAVOptions aDAVOptions;
 
 {
-try
+getResourceOptions( xEnv, aDAVOptions, rResAccess );
+
+// at least class one is needed
+if( aDAVOptions.isClass1() )
 {
-// Try to fetch some frequently used property value, e.g. those
-// used when loading documents... along with identifying whether
-// this is a DAV resource.
-std::vector< DAVResource > resources;
-std::vector< OUString > aPropNames;
-uno::Sequence< beans::Property > aProperties( 5 );
-aProperties[ 0 ].Name = "IsFolder";
-aProperties[ 1 ].Name = "IsDocument";
-aProperties[ 2 ].Name = "IsReadOnly";
-aProperties[ 3 ].Name = "MediaType";
-aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
+try
+{
+// Try to fetch some frequently used property value, e.g. those
+// used when loading documents... along with identifying 
whether
+// this is a DAV resource.
+std::vector< DAVResource > resources;
+std::vector< OUString > aPropNames;
+uno::Se

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 9eb6733c8fa9d69d3f2314fc1a3f510c324bd663
Author: Giuseppe Castagno 
AuthorDate: Sat Jul 23 12:55:20 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:34:43 2021 +0100

ucb: webdav-curl: tdf#101094 (6) OPTIONS: Do not retry on HTTP error 501

HTTP error 501 the server tells us the used method is not
implemented, non need to retry.

[ port of commit 6dcd231892d80d2f130d1b9ebb9cf7dfa1115df1 ]

Change-Id: I5325f6527c7bb5c8f87d4301fd13eb6c71a318f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123288
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index 8787250c98f6..c81d326207d1 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -1139,8 +1139,12 @@ bool DAVResourceAccess::handleException(DAVException 
const& e, int const errorCo
 // if we have a bad connection try again. Up to three times.
 case DAVException::DAV_HTTP_ERROR:
 // retry up to three times, if not a client-side error.
+// exception: error 501, server side error that
+// tells us the used method is not implemented
+// on the server, it's nonsense to insist...
 if ( ( e.getStatus() < 400 || e.getStatus() >= 500 ||
e.getStatus() == 413 ) &&
+ ( e.getStatus() != 501 ) &&
  errorCount < 3 )
 {
 return true;


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 8ce2732f0a867807a9d0e70ec0966e7779d13412
Author: Giuseppe Castagno 
AuthorDate: Thu Jan 14 18:11:28 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:35:04 2021 +0100

ucb: webdav-curl: tdf#101094 (7) OPTIONS: Remove resourceTypeForLocks 
before unlock

Not needed, unlock() checks if a lock is present first.
If present, it means that LOCK is available, inferring the presence of
UNLOCK availability.

[ port of commit fd586445a47d50ebfff67a7d5e4a329cf064cb92 ]

Change-Id: I639c558c6e6f322f37d267bbc31309504745e02c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123289
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index b499327878d1..96ac6dde122a 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -658,8 +658,9 @@ uno::Any SAL_CALL Content::execute(
 {
 
 // unlock
-if ( resourceTypeForLocks( Environment ) == DAV )
-unlock( Environment );
+// do not check for a DAV resource
+// the lock store will be checked before sending
+unlock( Environment );
 }
 else if ( aCommand.Name == "createNewContent" &&
   isFolder( Environment ) )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  200 ---
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |6 
 2 files changed, 128 insertions(+), 78 deletions(-)

New commits:
commit cb0681be80bd4423475149e05eaff180887936c8
Author: Michael Stahl 
AuthorDate: Fri Oct 8 19:30:59 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:35:33 2021 +0100

ucb: webdav-curl: tdf#101094 (8) OPTIONS: Add options check in 
Content::resourceTypeForLocks

[ port of commit 6ab2cabeae02b6beb3c33238773ba075f41c4bb9 ]

Change-Id: I10f928fb5484738553769f54353ca7637e0780ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123290
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 96ac6dde122a..706f3a0fb25a 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2825,7 +2825,8 @@ void Content::destroy( bool bDeletePhysical )
 
 // returns the resource type, to be checked for locks
 Content::ResourceType Content::resourceTypeForLocks(
-  const uno::Reference< ucb::XCommandEnvironment >& Environment )
+const uno::Reference< ucb::XCommandEnvironment >& Environment,
+const std::unique_ptr< DAVResourceAccess > & rResAccess)
 {
 ResourceType eResourceTypeForLocks = UNKNOWN;
 {
@@ -2857,98 +2858,128 @@ Content::ResourceType Content::resourceTypeForLocks(
 if ( eResourceTypeForLocks == UNKNOWN )
 {
 // resource type for lock/unlock operations still unknown, need to ask 
the server
-std::unique_ptr< DAVResourceAccess > xResAccess;
-
-xResAccess.reset( new DAVResourceAccess(
-  m_xContext,
-  m_rSessionFactory,
-  rURL ) );
 
-{
-try
+//{
+DAVOptions aDAVOptions;
+getResourceOptions( Environment, aDAVOptions, rResAccess );
+if( aDAVOptions.isClass1() ||
+aDAVOptions.isClass2() ||
+aDAVOptions.isClass3() )
 {
-// we need only DAV:supportedlock
-std::vector< DAVResource > resources;
-std::vector< OUString > aPropNames;
-uno::Sequence< beans::Property > aProperties( 1 );
-aProperties[ 0 ].Name = DAVProperties::SUPPORTEDLOCK;
-
-ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames 
);
-xResAccess->PROPFIND( DAVZERO, aPropNames, resources, 
Environment );
-
-// only one resource should be returned
-if ( resources.size() == 1 )
+// this is at least a DAV, lock to be confirmed
+// class 2 is needed for full lock support
+// see
+// 
+eResourceTypeForLocks = DAV_NOLOCK;
+if( aDAVOptions.isClass2() )
 {
-// we may have received a bunch of other properties
-// (some servers seems to do so)
-// but we need only supported lock for this check
-// all returned properties are in
-// resources.properties[n].Name/.Value
+// ok, possible lock, check for it
+try
+{
+// we need only DAV:supportedlock
+std::vector< DAVResource > resources;
+std::vector< OUString > aPropNames;
+uno::Sequence< beans::Property > aProperties( 1 );
+aProperties[ 0 ].Name = DAVProperties::SUPPORTEDLOCK;
 
-std::vector< DAVPropertyValue >::iterator it;
+ContentProperties::UCBNamesToDAVNames( aProperties, 
aPropNames );
+rResAccess->PROPFIND( DAVZERO, aPropNames, resources, 
Environment );
 
-for ( it = resources[0].properties.begin();
-  it != resources[0].properties.end(); it++)
-{
-if ( (*it).Name ==  DAVProperties::SUPPORTEDLOCK )
+bool wasSupportedlockFound = false;
+
+// only one resource should be returned
+if ( resources.size() == 1 )
 {
-uno::Sequence< ucb::LockEntry > aSupportedLocks;
-if ( (*it).Value >>= aSupportedLocks )
+// we may have received a bunch of other properties
+// (some servers seems to do so)
+// but we need only supported lock for this check
+// all returned properties are in
+ 

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx |   26 ++-
 1 file changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 78992a2b63cdfbc278a104973c22b1e707ecfd12
Author: Giuseppe Castagno 
AuthorDate: Mon Jan 11 16:35:34 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:35:58 2021 +0100

ucb: webdav-curl: tdf#101094 (9) OPTIONS: Add options check in 
Content::getProperties

[ port of commit be47f60b51c053c6329637e829ce16e2e90610fe ]

Change-Id: I8fd0dbc1f9847e799c244821bfe4e628c39c2017
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123291
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
index d89f9431b6d4..e45156c35a0d 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontentcaps.cxx
@@ -286,18 +286,24 @@ uno::Sequence< beans::Property > Content::getProperties(
 if ( !bTransient )
 {
 // Obtain all properties supported for this resource from server.
-try
+DAVOptions aDAVOptions;
+getResourceOptions( xEnv, aDAVOptions, xResAccess );
+// only Class 1 is needed for PROPFIND
+if ( aDAVOptions.isClass1() )
 {
-std::vector< DAVResourceInfo > props;
-xResAccess->PROPFIND( DAVZERO, props, xEnv );
+try
+{
+std::vector< DAVResourceInfo > props;
+xResAccess->PROPFIND( DAVZERO, props, xEnv );
 
-// Note: vector always contains exactly one resource info, because
-//   we used a depth of DAVZERO for PROPFIND.
-aPropSet.insert( (*props.begin()).properties.begin(),
- (*props.begin()).properties.end() );
-}
-catch ( DAVException const & )
-{
+// Note: vector always contains exactly one resource info, 
because
+//   we used a depth of DAVZERO for PROPFIND.
+aPropSet.insert( (*props.begin()).properties.begin(),
+ (*props.begin()).properties.end() );
+}
+catch ( DAVException const & )
+{
+}
 }
 }
 


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/DAVTypes.cxx |   81 +++-
 ucb/source/ucp/webdav-curl/DAVTypes.hxx |   25 +
 2 files changed, 105 insertions(+), 1 deletion(-)

New commits:
commit e329cda88021fe7c540a6050a654aee7491d0975
Author: Giuseppe Castagno 
AuthorDate: Sun Jan 10 10:05:02 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:36:19 2021 +0100

ucb: webdav-curl: tdf#101094 (10) OPTIONS: Add a simple options cache class

Added behavioral unit tests as well.

[ port of commit b641d83bb9f8adba1a487ca0e04d7151f96c3eea ]

Change-Id: Ie8867aeb45dcc8d343b156608e8a30970f76f6f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123292
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
index b71f61a1a3d3..bddbe50829b0 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
@@ -10,6 +10,7 @@
 
 #include "DAVTypes.hxx"
 
+#include "CurlUri.hxx"
 #include "../inc/urihelper.hxx"
 
 #include 
@@ -18,7 +19,7 @@
 using namespace http_dav_ucp;
 using namespace com::sun::star;
 
-// DAVCapabilities implementation
+// DAVOptions implementation
 
 DAVOptions::DAVOptions() :
 m_isResourceFound( false ),
@@ -65,4 +66,82 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const
 }
 
 
+// DAVOptionsCache implementation
+
+DAVOptionsCache::DAVOptionsCache()
+{
+}
+
+
+DAVOptionsCache::~DAVOptionsCache()
+{
+}
+
+
+bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & 
rDAVOptions )
+{
+osl::MutexGuard aGuard( m_aMutex );
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) );
+normalizeURLLastChar( aEncodedUrl );
+
+// search the URL in the static map
+DAVOptionsMap::iterator it;
+it = m_aTheCache.find( aEncodedUrl );
+if ( it == m_aTheCache.end() )
+return false;
+else
+{
+// check if the capabilities are stale, before restoring
+TimeValue t1;
+osl_getSystemTime( &t1 );
+if ( (*it).second.getStaleTime() < t1.Seconds )
+{
+// if stale, remove from cache, do not restore
+removeDAVOptions( rURL );
+return false;
+// return false instead
+}
+rDAVOptions = (*it).second;
+return true;
+}
+}
+
+
+void DAVOptionsCache::removeDAVOptions( const OUString & rURL )
+{
+osl::MutexGuard aGuard( m_aMutex );
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) );
+normalizeURLLastChar( aEncodedUrl );
+
+DAVOptionsMap::iterator it;
+it = m_aTheCache.find( aEncodedUrl );
+if ( it != m_aTheCache.end() )
+{
+m_aTheCache.erase( it );
+}
+}
+
+
+void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const 
sal_uInt32 nLifeTime )
+{
+osl::MutexGuard aGuard( m_aMutex );
+
+OUString aURL( rDAVOptions.getURL() );
+
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(aURL) ) );
+normalizeURLLastChar( aEncodedUrl );
+rDAVOptions.setURL( aEncodedUrl );
+
+// unchanged, it may be used to access a server
+OUString aRedirURL( rDAVOptions.getRedirectedURL() );
+rDAVOptions.setRedirectedURL( aRedirURL );
+
+TimeValue t1;
+osl_getSystemTime( &t1 );
+rDAVOptions.setStaleTime( t1.Seconds + nLifeTime );
+
+m_aTheCache[ aEncodedUrl ] = rDAVOptions;
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
index e1d53909b4b9..a4180c6dffc7 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
@@ -123,10 +123,35 @@ namespace http_dav_ucp
 m_sRedirectedURL.clear();
 };
 
+DAVOptions & operator=( const DAVOptions& rOpts ) = default; //TODO 
-Werror=deprecated-copy
 bool operator==( const DAVOptions& rOpts ) const;
 
 };
 
+typedef std::map< OUString, DAVOptions > DAVOptionsMap;
+
+class DAVOptionsCache
+{
+DAVOptionsMap m_aTheCache;
+osl::Mutex m_aMutex;
+public:
+explicit DAVOptionsCache();
+~DAVOptionsCache();
+
+bool getDAVOptions( const OUString & rURL, DAVOptions & rDAVOptions );
+void removeDAVOptions( const OUString & rURL );
+void addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 
nLifeTime );
+
+private:
+
+/// remove the last '/' in aUrl, if it exists
+static void normalizeURLLastChar( OUString& aUrl ) {
+if ( aUrl.getLength() > 1 &&
+ ( ( aUrl.lastIndexOf( '/' ) + 1 ) == aUrl.getLength() ) )
+aUrl = aUrl.copy(0, aUrl.getLength() - 1 );
+};
+};
+
 enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 };
 
 enum Proppatc

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   37 +++
 ucb/source/ucp/webdav-curl/webdavcontent.hxx |   17 
 2 files changed, 54 insertions(+)

New commits:
commit 7f5f568b9c31df2391dabd4abb5711a109e5480a
Author: Giuseppe Castagno 
AuthorDate: Sun Jan 10 17:32:53 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:36:38 2021 +0100

ucb: webdav-curl: tdf#101094 (11): Add WebDAV options cache configuration 
param.

Added in officecfg five new properties to be able to set
cache lifetime if needed.

The new properties are available in advanced, expert configuration only,
in org.openoffice.Inet.Settings.

Default values are as follows (value is in seconds):
OptsCacheLifeImplWeb = 300
when the web resource is Web only, implementing OPTIONS.
Min. 0 sec (no caching) max. 3600 sec (1h).

OptsCacheLifeDAV = 60
when the web resource is WebDAV.
Min. 0 sec (no caching) max. 3600 sec (1h).

OptsCacheLifeDAVLocked = 600
when the web resource is WebDAV and it's locked by
this LO instance (e.g. lock store has a lock to it).
Min. 0 sec (no caching) max. 3600 sec (1h).

OptsCacheLifeNotImpl = 3600
when the web resource does not implement OPTIONS method.
Min. 0 sec (no caching) max. 43200 sec (12h).

OptsCacheLifeNotFound = 15
when the requested web resource is not found on server.
Min. 0 sec (no caching) max. 30 sec.

[ port of commit 2c0b4ff238f39b5fcce09c7d36e80ac1e7cb713e ]

Change-Id: I5a4c9c91b7d3a8840bfaf8326e35f86415dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123462
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 706f3a0fb25a..d41ce66a266f 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -185,6 +186,12 @@ void lcl_sendPartialGETRequest( bool &bError,
 }
 }
 
+// Static value, to manage a simple OPTIONS cache
+// Key is the URL, element is the DAVOptions resulting from an OPTIONS call.
+// Cached DAVOptions have a lifetime that depends on the errors received or 
not received
+// and on the value of received options.
+static DAVOptionsCache aStaticDAVOptionsCache;
+
 
 // Content Implementation.
 
@@ -206,6 +213,7 @@ Content::Content(
 {
 try
 {
+initOptsCacheLifeTime();
 m_xResAccess.reset( new DAVResourceAccess(
 rxContext,
 rSessionFactory,
@@ -238,6 +246,7 @@ Content::Content(
 {
 try
 {
+initOptsCacheLifeTime();
 m_xResAccess.reset( new DAVResourceAccess(
 rxContext, rSessionFactory, Identifier->getContentIdentifier() ) );
 }
@@ -3697,6 +3706,34 @@ Content::ResourceType Content::getResourceType(
 }
 
 
+void Content::initOptsCacheLifeTime()
+{
+// see description in
+// officecfg/registry/schema/org/openoffice/Inet.xcs
+// for use of these field values.
+sal_uInt32 nAtime;
+nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext 
);
+m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ),
+std::min( nAtime, sal_uInt32( 3600 ) ) 
);
+
+nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext );
+m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ),
+std::min( nAtime, sal_uInt32( 3600 ) ) );
+
+nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( 
m_xContext );
+m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ),
+std::min( nAtime, sal_uInt32( 3600 ) ) );
+
+nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext 
);
+m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ),
+  std::min( nAtime, sal_uInt32( 
43200 ) ) );
+
+nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext 
);
+m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ),
+  std::min( nAtime, sal_uInt32( 30 
) ) );
+}
+
+
 void Content::getResourceOptions(
 const css::uno::Reference< css::ucb::XCommandEnvironment 
>& xEnv,
 DAVOptions& rDAVOptions,
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.hxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.hxx
index 209f43516a3c..7c1f45661822 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.hxx
@@ -86,6 +86,23 @@ class Content : public ::ucbhelper::ContentImplHelper,
 bool  m_bCollection;
 bool 

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |  173 +--
 1 file changed, 110 insertions(+), 63 deletions(-)

New commits:
commit 1f783d3e5e734dbdef2ec39f1ff1370dad4f332b
Author: Giuseppe Castagno 
AuthorDate: Sun Jan 10 17:43:12 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:37:08 2021 +0100

ucb: webdav-curl: tdf#101094 (12) OPTIONS: Add options cache ctrl in 
getResourceOptions

[ port of commit 37ada6f457e19b6ee2d2adb0b0ab3acb20705b51 ]

Change-Id: I3cfd71c0c90b828de7d953d5ff3f0e445b3f156f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123463
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index d41ce66a266f..ba220778c973 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3739,78 +3739,125 @@ void Content::getResourceOptions(
 DAVOptions& rDAVOptions,
 const std::unique_ptr< DAVResourceAccess > & rResAccess )
 {
-try
-{
-rResAccess->OPTIONS( rDAVOptions, xEnv );
-// IMPORTANT:the correctly implemented server will answer without 
errors, even if the resource is not present
-}
-catch ( DAVException const & e )
+OUString aRedirURL;
+OUString aTargetURL = rResAccess->getURL();
+// first check if in cache, if not, then send method to server
+if ( !aStaticDAVOptionsCache.getDAVOptions( aTargetURL, rDAVOptions ) )
 {
-rResAccess->resetUri();
-
-switch( e.getError() )
+try
 {
-case DAVException::DAV_HTTP_TIMEOUT:
-case DAVException::DAV_HTTP_CONNECT:
-{
-// something bad happened to the connection
-// not same as not found, this instead happens when the server 
does'n exist or does'n aswer at all
-// probably a new bit stating 'timed out' should be added to 
opts var?
-// in any case abort the command
-cancelCommandExecution( e, xEnv );
-// unreachable
-}
-break;
-case DAVException::DAV_HTTP_AUTH:
-{
-SAL_WARN( "ucb.ucp.webdav", "OPTIONS - DAVException 
Authentication error for URL <" << m_xIdentifier->getContentIdentifier() << ">" 
);
-// - the remote site is a WebDAV with special configuration: 
read/only for read operations
-//   and read/write for write operations, the user is not 
allowed to lock/write and
-//   she cancelled the credentials request.
-//   this is not actually an error, it means only that for 
current user this is a standard web,
-//   though possibly DAV enabled
+rResAccess->OPTIONS( rDAVOptions, xEnv );
+// IMPORTANT:the correctly implemented server will answer without 
errors, even if the resource is not present
+sal_uInt32 nLifeTime = ( rDAVOptions.isClass1() ||
+ rDAVOptions.isClass2() ||
+ rDAVOptions.isClass3() ) ?
+m_nOptsCacheLifeDAV : // a WebDAV site
+m_nOptsCacheLifeImplWeb;  // a site implementing OPTIONS but
+ // it's not DAV
+// check if redirected
+aRedirURL = rResAccess->getURL();
+if( aRedirURL == aTargetURL)
+{ // no redirection
+aRedirURL.clear();
 }
-break;
-case DAVException::DAV_HTTP_ERROR:
+// cache this URL's option
+rDAVOptions.setURL( aTargetURL );
+rDAVOptions.setRedirectedURL( aRedirURL );
+aStaticDAVOptionsCache.addDAVOptions( rDAVOptions,
+  nLifeTime );
+}
+catch ( DAVException const & e )
+{
+// first, remove from cache, will be added if needed, depending on 
the error received
+aStaticDAVOptionsCache.removeDAVOptions( aTargetURL );
+rResAccess->resetUri();
+
+rDAVOptions.setURL( aTargetURL );
+rDAVOptions.setRedirectedURL( aRedirURL );
+switch( e.getError() )
 {
-switch( e.getStatus() )
+case DAVException::DAV_HTTP_TIMEOUT:
+case DAVException::DAV_HTTP_CONNECT:
 {
-case SC_FORBIDDEN:
-{
-SAL_WARN( "ucb.ucp.webdav","OPTIONS - Forbidden for 
URL <" << m_xIdentifier->getContentIdentifier() << ">" );
-rDAVOptions.setResourceFound(); // means it exists, 
but it's not DAV
-}
-break;
-case SC_BAD_REQUEST:
-{
-  

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/DAVTypes.cxx  |3 +++
 ucb/source/ucp/webdav-curl/DAVTypes.hxx  |7 +++
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   26 +-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 51579e00fef7baf5e248b1e9a2bf0e9fa8ef1a60
Author: Giuseppe Castagno 
AuthorDate: Sun Jul 24 12:12:35 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:37:30 2021 +0100

ucb: webdav-curl: tdf#101094 (13) OPTIONS: Options cache removal: LOCK, 
UNLOCK

[ port of commit dfb714183f31d8a235797ef1ad3c517966ed4985 ]

Change-Id: I1cf4689847f4f033d6f8cc40265b98b9614363e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123464
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
index bddbe50829b0..839b9e845846 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
@@ -26,6 +26,7 @@ DAVOptions::DAVOptions() :
 m_isClass1( false ),
 m_isClass2( false ),
 m_isClass3( false ),
+m_isLocked( false ),
 m_aAllowedMethods(),
 m_nStaleTime( 0 ),
 m_sURL(),
@@ -39,6 +40,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) :
 m_isClass1( rOther.m_isClass1 ),
 m_isClass2( rOther.m_isClass2 ),
 m_isClass3( rOther.m_isClass3 ),
+m_isLocked( rOther.m_isLocked ),
 m_aAllowedMethods( rOther.m_aAllowedMethods ),
 m_nStaleTime( rOther.m_nStaleTime ),
 m_sURL( rOther.m_sURL ),
@@ -59,6 +61,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const
 m_isClass1 == rOpts.m_isClass1 &&
 m_isClass2 == rOpts.m_isClass2 &&
 m_isClass3 == rOpts.m_isClass3 &&
+m_isLocked == rOpts.m_isLocked &&
 m_aAllowedMethods == rOpts.m_aAllowedMethods &&
 m_nStaleTime == rOpts.m_nStaleTime &&
 m_sURL == rOpts.m_sURL &&
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
index a4180c6dffc7..d5453295c733 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
@@ -71,6 +71,9 @@ namespace http_dav_ucp
 boolm_isClass1;
 boolm_isClass2;
 boolm_isClass3;
+// Internally used to maintain locked stated of the resource, only
+// if it's a Class 2 resource
+boolm_isLocked;
 // contains the methods allowed on this resource
 OUStringm_aAllowedMethods;
 
@@ -112,11 +115,15 @@ namespace http_dav_ucp
 bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != 
-1 ); };
 bool isUnlockAllowed() { return ( m_aAllowedMethods.indexOf( "UNLOCK" 
) != -1 ); };
 
+void setLocked( bool locked = true ) { m_isLocked = locked; } ;
+bool isLocked() { return m_isLocked; };
+
 void reset() {
 m_isResourceFound = false;
 m_isClass1 = false;
 m_isClass2 = false;
 m_isClass3 = false;
+m_isLocked = false;
 m_aAllowedMethods.clear();
 m_nStaleTime = 0;
 m_sURL.clear();
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index ba220778c973..fdec5e34b4bc 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3041,6 +3041,8 @@ void Content::lock(
 aURL = m_xIdentifier->getContentIdentifier();
 }
 
+OUStringaTargetUrl = aURL;
+
 try
 {
 std::unique_ptr< DAVResourceAccess > xResAccess;
@@ -3062,7 +3064,12 @@ void Content::lock(
 //-1, // infinite lock
 uno::Sequence< OUString >() );
 
+//  update the URL
+aTargetUrl = xResAccess->getURL();
+
 xResAccess->LOCK( aLock, Environment );
+// OPTIONS may have changed as a consequence of the lock operation
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 
 {
 osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3071,6 +3078,7 @@ void Content::lock(
 }
 catch ( DAVException const & e )
 {
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 // check if the exception thrown is 'already locked'
 // this exception is mapped directly to the ucb correct one, without
 // going into the cancelCommandExecution() user interaction
@@ -3166,6 +3174,9 @@ void Content::lock(
 void Content::unlock(
 const uno::Reference< ucb::XCommandEnvironment >& Environment )
 {
+// save the URL to clean cache
+OUStringaTargetUrl = m_xIdentifier->getContentIdentifier();
+
 try
 {
 std::unique_ptr< DAVResourceAccess > xResAccess;
@@ -3174,7 +3185,12 @@ void Content::unlock(
 xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
 }
 
+// update the URL

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Michael Stahl (via logerrit)
 ucb/source/ucp/webdav-curl/CurlSession.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit ae8528e4b7c219411e4fa6f33fc693479bb5ce56
Author: Michael Stahl 
AuthorDate: Mon Oct 11 13:45:19 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:38:02 2021 +0100

ucb: webdav-curl: CurlSession OPTIONS() lock cache

Change-Id: I3a815e70db04439dc33d57ce9e214d52a7f0e08d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123465
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 29ddf3671de6..eab01e77d07b 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1179,6 +1179,13 @@ auto CurlSession::OPTIONS(OUString const& rURIReference,
 }
 }
 rOptions.setResourceFound();
+if (rOptions.isClass2() || rOptions.isClass3())
+{
+if (g_Init.LockStore.getLockTokenForURI(rURIReference, nullptr))
+{
+rOptions.setLocked();
+}
+}
 }
 
 auto CurlProcessor::PropFind(


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit c155b4137678455294db605e0332b097ef51dc1a
Author: Giuseppe Castagno 
AuthorDate: Mon Jan 11 11:11:19 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:38:36 2021 +0100

ucb: webdav-curl: tdf#101094 (14) OPTIONS: Options cache removal: PUT

[ port of commit e0eb85785b68867f1476553723dbfc6dc407106b ]

Change-Id: I2c4109b44ba291fdc01289b2706f746512d7e3e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123466
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index fdec5e34b4bc..cc7578a2ca49 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2434,6 +2434,8 @@ void Content::insert(
 
 aURL += aEscapedTitle;
 
+// save the URL to clean cache
+OUStringaTargetUrl = aURL;
 try
 {
 xResAccess->setURL( aURL );
@@ -2443,6 +2445,9 @@ void Content::insert(
 else
 {
 xResAccess->PUT( xInputStream, Environment );
+// remove options from cache, PUT may change it
+// it will be refreshed when needed
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 }
 // no error , set the resourcetype to unknown type
 // the resource may have transitioned from NOT FOUND or UNKNOWN to 
something else
@@ -2453,6 +2458,7 @@ void Content::insert(
 }
 catch ( DAVException const & except )
 {
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 if ( bCollection )
 {
 if ( except.getStatus() == SC_METHOD_NOT_ALLOWED )
@@ -2541,12 +2547,18 @@ void Content::insert(
 // Unreachable
 }
 
+// save the URL since it may change due to redirection
+OUStringaTargetUrl = xResAccess->getURL();
 try
 {
 xResAccess->PUT( xInputStream, Environment );
+// remove options from cache, PUT may change it
+// it will be refreshed when needed
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 }
 catch ( DAVException const & e )
 {
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 cancelCommandExecution( e, Environment, true );
 // Unreachable
 }


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 8c4302a503053251b6360c128a1dcd556f09c5df
Author: Giuseppe Castagno 
AuthorDate: Wed Jan 27 17:04:56 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:38:58 2021 +0100

ucb: webdav-curl: tdf#101094 (15) OPTIONS: Options cache removal: MKCOL

[ port of commit 1596379bc00a32bc3b4e76a53aa884112b21764b ]

Change-Id: If217fde550ef55375e4743de00dcb325a89674c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123467
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index cc7578a2ca49..d9f925b2151d 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2441,7 +2441,10 @@ void Content::insert(
 xResAccess->setURL( aURL );
 
 if ( bCollection )
+{
 xResAccess->MKCOL( Environment );
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+}
 else
 {
 xResAccess->PUT( xInputStream, Environment );


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit dbe4b01ca7d0069f45d655c04ca595b42b71c631
Author: Giuseppe Castagno 
AuthorDate: Wed Jan 27 17:35:36 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:39:26 2021 +0100

ucb: webdav-curl: tdf#101094 (16) OPTIONS: Options cache removal: MOVE

[ port of commit 2359e5a002f4df58548803320991064e6a6d968c ]

Change-Id: I27a68855198fe220a1f4141bb89673992c12e1f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123468
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index d9f925b2151d..6e0b57cb5b01 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1936,14 +1936,18 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
 = new ::ucbhelper::ContentIdentifier( aNewURL );
 uno::Reference< ucb::XContentIdentifier > xOldId = xIdentifier;
 
+CurlUri const sourceURI( xOldId->getContentIdentifier() );
+CurlUri targetURI( xNewId->getContentIdentifier() );
+
 try
 {
-CurlUri const sourceURI( xOldId->getContentIdentifier() );
-CurlUri targetURI( xNewId->getContentIdentifier() );
 targetURI.SetScheme( sourceURI.GetScheme() );
 
 xResAccess->MOVE(
 sourceURI.GetPath(), targetURI.GetURI(), false, xEnv );
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
+
 // @@@ Should check for resources that could not be moved
 // (due to source access or target overwrite) and send
 // this information through the interaction handler.
@@ -1977,6 +1981,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
 }
 catch ( DAVException const & e )
 {
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 // Do not set new title!
 aNewTitle.clear();
 
@@ -2592,11 +2598,12 @@ void Content::transfer(
 xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
 }
 
+CurlUri sourceURI( rArgs.SourceURL );
+CurlUri targetURI( xIdentifier->getContentIdentifier() );
+
 OUString aTargetURI;
 try
 {
-CurlUri sourceURI( rArgs.SourceURL );
-CurlUri targetURI( xIdentifier->getContentIdentifier() );
 aTargetURI = targetURI.GetPathBaseNameUnescaped();
 
 // Check source's and target's URL scheme
@@ -2721,6 +2728,8 @@ void Content::transfer(
 rArgs.NameClash
 == ucb::NameClash::OVERWRITE,
 Environment );
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
 if ( xSource.is() )
 {
@@ -2767,10 +2776,14 @@ void Content::transfer(
 }
 catch ( ucb::IllegalIdentifierException const & )
 {
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 // queryContent
 }
 catch ( DAVException const & e )
 {
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 // [RFC 2518] - WebDAV
 // 412 (Precondition Failed) - The server was unable to maintain
 // the liveness of the properties listed in the propertybehavior


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 43c1de58c3115dd0495d0326975d520a333845b8
Author: Giuseppe Castagno 
AuthorDate: Wed Jan 27 17:41:30 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:39:51 2021 +0100

ucb: webdav-curl: tdf#101094 (17) OPTIONS: Options cache removal: COPY

[ port of commit bedae6b06c51c641c38fa7dd3e25dd2aaafb30cf ]

Change-Id: I1618a7a5ec4e52fdd9e99b17b2b36e5ef77decae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123469
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 6e0b57cb5b01..3f42acc56223 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -865,6 +865,8 @@ void Content::addProperty( const 
css::ucb::PropertyCommandArgument &aCmdArg,
 osl::Guard< osl::Mutex > aGuard( m_aMutex );
 m_xResAccess.reset( new DAVResourceAccess( *xResAccess ) );
 }
+// TODO PLACEHOLDER:
+// remove target URL options from cache, since PROPPATCH may change 
them
 
 // Notify propertyset info change listeners.
 beans::PropertySetInfoChangeEvent evt(
@@ -1885,6 +1887,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
 {
 // Set property values at server.
 xResAccess->PROPPATCH( aProppatchValues, xEnv );
+// TODO PLACEHOLDER:
+// remove target URL options from cache, since PROPPATCH may 
change it
 
 for ( const auto& rProppatchValue : aProppatchValues )
 {
@@ -2757,6 +2761,8 @@ void Content::transfer(
 rArgs.NameClash
 == ucb::NameClash::OVERWRITE,
 Environment );
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
 // DAV resources store all additional props on server!
 //  // Copy own and all children's Additional Core Properties.


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   32 +++
 1 file changed, 32 insertions(+)

New commits:
commit 567f8f716bb644494fa74b9a5030c5a047c8a189
Author: Giuseppe Castagno 
AuthorDate: Mon Jul 25 12:56:27 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:40:13 2021 +0100

ucb: webdav-curl: tdf#101094 (18) OPTIONS: Update OPTIONS cache lifetime if 
not found

[ ported from commit a5fc27e0575eab115de3714ae07fcac7481f4daf ]

Change-Id: I61d06051a4526676fc4ab80d653ab7c2a9e4c209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123470
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 3f42acc56223..962d95fe945f 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2124,6 +2124,7 @@ uno::Any Content::open(
 if ( xDataSink.is() )
 {
 // PULL: wait for client read
+OUString aTargetURL =  m_xIdentifier->getContentIdentifier();
 try
 {
 std::unique_ptr< DAVResourceAccess > xResAccess;
@@ -2163,6 +2164,21 @@ uno::Any Content::open(
 }
 catch ( DAVException const & e )
 {
+// check if error is SC_NOT_FOUND
+// if URL resource not found, set the corresponding 
resource
+// element in option cache and update the cache lifetime 
accordingly
+if( e.getStatus() == SC_NOT_FOUND )
+{
+DAVOptions aDAVOptions;
+if( aStaticDAVOptionsCache.getDAVOptions( aTargetURL, 
aDAVOptions ) )
+{
+// get redirected url
+aDAVOptions.setResourceFound( false );
+aStaticDAVOptionsCache.addDAVOptions( aDAVOptions,
+  
m_nOptsCacheLifeNotFound );
+}
+}
+
 cancelCommandExecution( e, xEnv );
 // Unreachable
 }
@@ -3695,6 +3711,22 @@ Content::ResourceType Content::getResourceType(
 *networkAccessAllowed = *networkAccessAllowed
 && shouldAccessNetworkAfterException(e);
 }
+if ( e.getStatus() == SC_NOT_FOUND )
+{
+// arrives here if OPTIONS is still cached for a resource 
previously available
+// operate on the OPTIONS cache:
+// if OPTIONS was not found, do nothing
+// else OPTIONS returned on a resource not existent  
(example a server that allows lock on null resource) set
+// not found and adjust lifetime accordingly
+DAVOptions aDAVOptionsInner;
+if 
(aStaticDAVOptionsCache.getDAVOptions(rResAccess->getURL(), aDAVOptionsInner))
+{
+// get redirected url
+aDAVOptionsInner.setResourceFound( false );
+aStaticDAVOptionsCache.addDAVOptions( aDAVOptionsInner,
+  
m_nOptsCacheLifeNotFound );
+}
+}
 // if the two net events below happen, something
 // is going on to the connection so break the command flow
 if ( ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||


[Libreoffice-commits] core.git: 2 commits - ucb/source vcl/source

2021-11-01 Thread Jan-Marek Glogowski (via logerrit)
 ucb/source/ucp/webdav-curl/DAVTypes.cxx  |   29 ++
 ucb/source/ucp/webdav-curl/DAVTypes.hxx  |   15 +++
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   55 +++
 vcl/source/outdev/text.cxx   |3 +
 4 files changed, 87 insertions(+), 15 deletions(-)

New commits:
commit 6ac3bf96d5c1676810b31d56f9d6eca7512b9026
Author: Jan-Marek Glogowski 
AuthorDate: Mon Nov 1 17:08:45 2021 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Mon Nov 1 18:40:47 2021 +0100

tdf#145496 Add dropped nLineWidth from refactoring

Regression from commit 4fc1b3fb659be916167518b49ffe8193e9033f30
("flatten ImplGetTextLines").

Change-Id: Ib9f086243b4e3ae245263492e714de6f81b89ea1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124557
Reviewed-by: Noel Grandin 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 57a8a1e55568..8557ba2654c8 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -523,7 +523,10 @@ tools::Long OutputDevice::ImplGetTextLines( const 
tools::Rectangle& rRect, const
 xBI = vcl::unohelper::CreateBreakIterator();
 
 if ( xBI.is() )
+{
 nBreakPos = ImplBreakLinesWithIterator(nWidth, rStr, _rLayout, 
xHyph, xBI, bHyphenate, nPos, nBreakPos);
+nLineWidth = _rLayout.GetTextWidth(rStr, nPos, nBreakPos - 
nPos);
+}
 else
 // fallback to something really simple
 nBreakPos = ImplBreakLinesSimple(nWidth, rStr, _rLayout, nPos, 
nBreakPos, nLineWidth);
commit 044bcca725f07058127fb35e9d3bddada364ff84
Author: Giuseppe Castagno 
AuthorDate: Tue Jul 26 11:36:24 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:40:35 2021 +0100

ucb: webdav-curl: tdf#101094 (19) OPTIONS: Add mechanism to manage not 
found Web URL: GET

[ port of commit 7f32fddb445ef1c1e17f9028f252c21dd83e03af ]

Change-Id: Ie1412f849df0b9da76ccc41309e8e587c8f36c7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123471
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.cxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
index 839b9e845846..a7864350fbac 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.cxx
@@ -147,4 +147,33 @@ void DAVOptionsCache::addDAVOptions( DAVOptions & 
rDAVOptions, const sal_uInt32
 }
 
 
+bool DAVOptionsCache::isResourceFound( const OUString & rURL )
+{
+osl::MutexGuard aGuard( m_aMutex );
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( DecodeURI(rURL) ) );
+normalizeURLLastChar( aEncodedUrl );
+
+DAVOptionsMap::iterator it;
+it = m_aTheCache.find( aEncodedUrl );
+if ( it != m_aTheCache.end() )
+{
+// first check for stale
+TimeValue t1;
+osl_getSystemTime( &t1 );
+if( (*it).second.getStaleTime() < t1.Seconds )
+{
+m_aTheCache.erase( it );
+return true; // to force again OPTIONS method
+}
+
+// check if the resource was present on server
+return (*it).second.isResourceFound();
+}
+// this value is needed because some web server don't implement
+// OPTIONS method, so the resource is considered found,
+// until detected otherwise
+return true;
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/ucb/source/ucp/webdav-curl/DAVTypes.hxx 
b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
index d5453295c733..b7bc7004b613 100644
--- a/ucb/source/ucp/webdav-curl/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVTypes.hxx
@@ -149,6 +149,21 @@ namespace http_dav_ucp
 void removeDAVOptions( const OUString & rURL );
 void addDAVOptions( DAVOptions & rDAVOptions, const sal_uInt32 
nLifeTime );
 
+/** Check if the DAV options cached value was found
+by the last OPTIONS method call.
+If the cached value is found stale, it is removed.
+
+@param OUString
+   the resource URL
+
+@return bool
+true if resource was found or if the Web resource DAV 
options
+are not present (meaning the resource should be checked for
+presence anyway)
+false if resource was not found
+*/
+bool isResourceFound( const OUString & rURL );
+
 private:
 
 /// remove the last '/' in aUrl, if it exists
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 962d95fe945f..483d409cb93b 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2141,26 +2141,51 @@ uno::Any Content::open(
 DAVResourc

[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 944853b03bc5a03ee424354669addb4fa9925fbe
Author: Giuseppe Castagno 
AuthorDate: Wed Jan 13 14:55:57 2016 +0100
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:41:01 2021 +0100

ucb: webdav-curl: Related: tdf#96410 eXo Platform WebDAV: where lock 
fails...

...because apparently eXo Platform WebDAV does not support or supports
poorly this section 
of RFC4918.
It returns HTTP error 404 instead.

[ port of commit 4475c191de479e7a5ddb20d14bc3aa32b0ab84d3 ]

Change-Id: I58c91330806abbde5968ed22e98b9ff80c98c505
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123472
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 483d409cb93b..de9cd6248a66 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3199,6 +3199,10 @@ void Content::lock(
 //grab the error code
 switch( e.getStatus() )
 {
+// The 'case SC_NOT_FOUND' just below tries to solve a 
problem in eXo Platform
+// WebDAV connector which apparently fail on resource 
first creation
+// rfc4918 section-7.3 (see link below)
+case SC_NOT_FOUND:  // 

 // The 'case SC_PRECONDITION_FAILED' just below tries to 
solve a problem
 // in SharePoint when locking the resource on first 
creation fails due to this:
 // 

@@ -3208,7 +3212,7 @@ void Content::lock(
 // part of base http 1.1 RFCs
 case SC_NOT_IMPLEMENTED:// 

 case SC_METHOD_NOT_ALLOWED: // 

-SAL_WARN( "ucb.ucp.webdav", "lock() DAVException 
(SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <"
+SAL_WARN( "ucb.ucp.webdav", "lock() DAVException 
(SC_NOT_FOUND, SC_PRECONDITION_FAILED, SC_NOT_IMPLEMENTED or 
SC_METHOD_NOT_ALLOWED) - URL: <"
   << m_xIdentifier->getContentIdentifier() << 
">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
 // act as nothing happened
 // that's because when a resource is first created


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit a10851aca6e14a00b892c78d1cc51476547acf29
Author: Giuseppe Castagno 
AuthorDate: Wed Aug 3 19:42:27 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:41:25 2021 +0100

ucb: webdav-curl: tdf#101094 (20) OPTIONS: Check for Class1 DAV before 
unlock

[ port of commit d14977d33bc3edb6a2c41db4d685d099bfe8d51e ]

Change-Id: I559d71f49e582af50ef88ea42beba48d38180134
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123473
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index de9cd6248a66..46442074d8b2 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3266,10 +3266,18 @@ void Content::unlock(
 
 // update the URL
 aTargetUrl = xResAccess->getURL();
-xResAccess->UNLOCK( Environment );
-// remove options from cache, unlock may change it
-// it will be refreshed when needed
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+// check if the target URL is a Class1 DAV
+DAVOptions aDAVOptions;
+getResourceOptions( Environment, aDAVOptions, xResAccess );
+
+// at least class one is needed
+if( aDAVOptions.isClass1() )
+{
+xResAccess->UNLOCK( Environment );
+// remove options from cache, unlock may change it
+// it will be refreshed when needed
+aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+}
 
 {
 osl::Guard< osl::Mutex > aGuard( m_aMutex );


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   21 -
 1 file changed, 4 insertions(+), 17 deletions(-)

New commits:
commit ccbb358db241b8b2564f3d5ac29915d3deeb
Author: Giuseppe Castagno 
AuthorDate: Wed Aug 10 14:05:08 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:41:51 2021 +0100

ucb: webdav-curl: tdf#101094 (21): Simplify cache removal: LOCK, UNLOCK

[ port of commit 508f78298833f45fd9e2e789aa26cca125719baf ]

Change-Id: I81185c11ed3ad216b13fcbafee45ea3a48cf0a12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123474
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 46442074d8b2..212c8732b91e 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3116,8 +3116,6 @@ void Content::lock(
 aURL = m_xIdentifier->getContentIdentifier();
 }
 
-OUStringaTargetUrl = aURL;
-
 try
 {
 std::unique_ptr< DAVResourceAccess > xResAccess;
@@ -3139,12 +3137,9 @@ void Content::lock(
 //-1, // infinite lock
 uno::Sequence< OUString >() );
 
-//  update the URL
-aTargetUrl = xResAccess->getURL();
-
+// OPTIONS may change as a consequence of the lock operation
+aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
 xResAccess->LOCK( aLock, Environment );
-// OPTIONS may have changed as a consequence of the lock operation
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 
 {
 osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3153,7 +3148,6 @@ void Content::lock(
 }
 catch ( DAVException const & e )
 {
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 // check if the exception thrown is 'already locked'
 // this exception is mapped directly to the ucb correct one, without
 // going into the cancelCommandExecution() user interaction
@@ -3253,8 +3247,6 @@ void Content::lock(
 void Content::unlock(
 const uno::Reference< ucb::XCommandEnvironment >& Environment )
 {
-// save the URL to clean cache
-OUStringaTargetUrl = m_xIdentifier->getContentIdentifier();
 
 try
 {
@@ -3264,8 +3256,6 @@ void Content::unlock(
 xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
 }
 
-// update the URL
-aTargetUrl = xResAccess->getURL();
 // check if the target URL is a Class1 DAV
 DAVOptions aDAVOptions;
 getResourceOptions( Environment, aDAVOptions, xResAccess );
@@ -3273,10 +3263,10 @@ void Content::unlock(
 // at least class one is needed
 if( aDAVOptions.isClass1() )
 {
-xResAccess->UNLOCK( Environment );
 // remove options from cache, unlock may change it
 // it will be refreshed when needed
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
+xResAccess->UNLOCK( Environment );
 }
 
 {
@@ -3316,9 +3306,6 @@ void Content::unlock(
 }
 break;
 default:
-// remove options from cache,
-// it will be refreshed when needed
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 //fallthrough
 ;
 }


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 928fbadb267be88cc558b55ddb33ec151be6e222
Author: Giuseppe Castagno 
AuthorDate: Thu Aug 11 14:19:03 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:42:12 2021 +0100

ucb: webdav-curl: tdf#101094 (22): Simplify cache removal: MKCOL, PUT

[ port of commit 8ff5e67dea29d9ceb100a67a69f6deb4c6f18e13 ]

Change-Id: If24272566bfb5fba32b9df9bd0f8e1c7fe18c585
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123475
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 212c8732b91e..876a23b7a930 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2485,23 +2485,21 @@ void Content::insert(
 
 aURL += aEscapedTitle;
 
-// save the URL to clean cache
-OUStringaTargetUrl = aURL;
 try
 {
 xResAccess->setURL( aURL );
 
 if ( bCollection )
 {
+aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() 
);
 xResAccess->MKCOL( Environment );
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 }
 else
 {
-xResAccess->PUT( xInputStream, Environment );
 // remove options from cache, PUT may change it
 // it will be refreshed when needed
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
+aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() 
);
+xResAccess->PUT( xInputStream, Environment );
 }
 // no error , set the resourcetype to unknown type
 // the resource may have transitioned from NOT FOUND or UNKNOWN to 
something else
@@ -2512,7 +2510,6 @@ void Content::insert(
 }
 catch ( DAVException const & except )
 {
-aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
 if ( bCollection )
 {
 if ( except.getStatus() == SC_METHOD_NOT_ALLOWED )


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx |   16 ++--
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx |1 +
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |4 
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 0e9cea7ccdac443a51c81ce6ec3e1115a09b00be
Author: Giuseppe Castagno 
AuthorDate: Thu Aug 11 22:20:46 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:42:36 2021 +0100

ucb: webdav-curl: Related: tdf#99499, add a limit to the number of http 
redirections

Check for maximum number of redirections according to
.

A practical limit can be 5, due to old RFC:
, this limit is
reported also in more recent RFCs, see final paragraph of RFC7231, 6.4.

[ port of commit 18009fe8fbe3982141ddca3f1fcd0900a63150a6 ]

Change-Id: I3a6d1510627434cdff9e4f0af8194a8e6a33c28b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123476
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
index c81d326207d1..cead9980b4a6 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx
@@ -129,6 +129,7 @@ DAVResourceAccess::DAVResourceAccess(
 : m_aURL( rURL ),
   m_xSessionFactory( rSessionFactory ),
   m_xContext( rContext )
+, m_nRedirectLimit( 5 )
 {
 }
 
@@ -140,7 +141,8 @@ DAVResourceAccess::DAVResourceAccess( const 
DAVResourceAccess & rOther )
   m_xSession( rOther.m_xSession ),
   m_xSessionFactory( rOther.m_xSessionFactory ),
   m_xContext( rOther.m_xContext ),
-  m_aRedirectURIs( rOther.m_aRedirectURIs )
+  m_aRedirectURIs( rOther.m_aRedirectURIs ),
+  m_nRedirectLimit( rOther.m_nRedirectLimit )
 {
 }
 
@@ -155,6 +157,7 @@ DAVResourceAccess & DAVResourceAccess::operator=(
 m_xSessionFactory = rOther.m_xSessionFactory;
 m_xContext   = rOther.m_xContext;
 m_aRedirectURIs   = rOther.m_aRedirectURIs;
+m_nRedirectLimit = rOther.m_nRedirectLimit;
 
 return *this;
 }
@@ -1094,7 +1097,7 @@ void DAVResourceAccess::getUserRequestHeaders(
 }
 }
 
-
+// This function member implements the control on cyclical redirections
 bool DAVResourceAccess::detectRedirectCycle(
 ::std::u16string_view const rRedirectURL)
 {
@@ -1102,6 +1105,15 @@ bool DAVResourceAccess::detectRedirectCycle(
 
 CurlUri const aUri( rRedirectURL );
 
+// Check for maximum number of redirections
+// according to .
+// A practical limit may be 5, due to earlier specifications:
+// 
+// it can be raised keeping in mind the added net activity.
+if( static_cast< size_t >( m_nRedirectLimit ) <= m_aRedirectURIs.size() )
+return true;
+
+// try to detect a cyclical redirection
 return std::any_of(m_aRedirectURIs.begin(), m_aRedirectURIs.end(),
 [&aUri](const CurlUri& rUri) { return aUri == rUri; });
 }
diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx 
b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
index 86a392e23cf1..051e53c4c8f5 100644
--- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx
@@ -52,6 +52,7 @@ class DAVResourceAccess
 rtl::Reference< DAVSessionFactory > m_xSessionFactory;
 css::uno::Reference< css::uno::XComponentContext > m_xContext;
 std::vector m_aRedirectURIs;
+sal_uInt32   m_nRedirectLimit;
 
 public:
 DAVResourceAccess() = default;
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 876a23b7a930..5b1fbd5635e7 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -3959,6 +3959,10 @@ void Content::getResourceOptions(
 }
 }
 break;
+// The 'DAVException::DAV_HTTP_REDIRECT' means we reached the 
maximum
+// number of redirections, consider the resource type as 
UNKNOWN
+// possibly a normal web site, not DAV
+case DAVException::DAV_HTTP_REDIRECT:
 default: // leave the resource type as UNKNOWN, for now
 // it means this will be managed as a standard http site
 SAL_WARN( "ucb.ucp.webdav","OPTIONS - DAVException for URL 
<" << m_xIdentifier->getContentIdentifier() << ">, DAV error: "


[Libreoffice-commits] core.git: ucb/source

2021-11-01 Thread Giuseppe Castagno (via logerrit)
 ucb/source/ucp/webdav-curl/webdavcontent.cxx |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 5bce551ffe4cf1292e05ec3fe7f8c92adb38
Author: Giuseppe Castagno 
AuthorDate: Sun Aug 14 13:18:44 2016 +0200
Commit: Michael Stahl 
CommitDate: Mon Nov 1 18:43:01 2021 +0100

ucb: webdav-curl: tdf#101094 (23): Simplify cache removal: MOVE, COPY

[ port of commit 63af1c52c534840d1f55e3041351d24b85edcaa4
  plus move Uris back into try block ]

Change-Id: I8cc7f6e14fcac294531b5be8fdbaf78610a3adfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123477
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 5b1fbd5635e7..8917b749a537 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2184,7 +2184,7 @@ uno::Any Content::open(
 ucb::IOErrorCode_NOT_EXISTING,
 aArgs ) ),
 xEnv );
-// Unreachable
+// Unreachable
 }
 }
 catch ( DAVException const & e )
@@ -2640,12 +2640,12 @@ void Content::transfer(
 xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
 }
 
-CurlUri sourceURI( rArgs.SourceURL );
-CurlUri targetURI( xIdentifier->getContentIdentifier() );
-
 OUString aTargetURI;
 try
 {
+CurlUri sourceURI( rArgs.SourceURL );
+CurlUri targetURI( xIdentifier->getContentIdentifier() );
+
 aTargetURI = targetURI.GetPathBaseNameUnescaped();
 
 // Check source's and target's URL scheme
@@ -2765,13 +2765,13 @@ void Content::transfer(
 // destination resource.  If the Overwrite header is set to
 // "F" then the operation will fail.
 
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 aSourceAccess.MOVE( sourceURI.GetPath(),
 targetURI.GetURI(),
 rArgs.NameClash
 == ucb::NameClash::OVERWRITE,
 Environment );
-aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
 if ( xSource.is() )
 {
@@ -2794,13 +2794,13 @@ void Content::transfer(
 // destination resource.  If the Overwrite header is set to
 // "F" then the operation will fail.
 
+aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 aSourceAccess.COPY( sourceURI.GetPath(),
 targetURI.GetURI(),
 rArgs.NameClash
 == ucb::NameClash::OVERWRITE,
 Environment );
-aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
 // DAV resources store all additional props on server!
 //  // Copy own and all children's Additional Core Properties.
@@ -2820,14 +2820,10 @@ void Content::transfer(
 }
 catch ( ucb::IllegalIdentifierException const & )
 {
-aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 // queryContent
 }
 catch ( DAVException const & e )
 {
-aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 // [RFC 2518] - WebDAV
 // 412 (Precondition Failed) - The server was unable to maintain
 // the liveness of the properties listed in the propertybehavior


  1   2   >