sfx2/source/view/viewfrm.cxx                        |    3 +-
 ucb/CppunitTest_ucb_webdav_core.mk                  |    1 
 ucb/Library_ucpdav1.mk                              |    1 
 ucb/source/ucp/webdav-curl/CurlSession.cxx          |    2 -
 ucb/source/ucp/webdav-curl/webdavcontent.cxx        |    8 +++++--
 ucb/source/ucp/webdav-curl/webdavresponseparser.cxx |   22 ++++++++++++++++++--
 6 files changed, 31 insertions(+), 6 deletions(-)

New commits:
commit beca7cdc365d3f2ed24b740e694cec2558ba615e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Apr 19 18:01:37 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 22 15:49:25 2022 +0200

    ucb: webdav-curl: put user name from config into LOCK request
    
    ... so that the dialog in SfxMedium::LockOrigFileOnDemand() can show
    something more useful than hard-coded URL, which has been used since
    commit 99bdd887a6141883878978bad9beb35e7b326cd1 in 2009 when locking
    was added.
    
    This is half of the user info that is put into LO's own lock files
    (see svt::LockFileCommon::GenerateOwnEntry()).
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133186
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 70bea73ffbe815c2d5b7067f20d3eebbb98df61f)
    
    ucb: webdav-curl: check UseUserData before sending user name
    
    Hope this should be acceptable.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133188
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 6d7c3848560883034a4ff12ac1ef52d2d1d28606)
    
    Change-Id: Iefac724644a536fc37c3c79ce862e25bd9be38af

diff --git a/ucb/CppunitTest_ucb_webdav_core.mk 
b/ucb/CppunitTest_ucb_webdav_core.mk
index aeea8033fa95..2d37401da28b 100644
--- a/ucb/CppunitTest_ucb_webdav_core.mk
+++ b/ucb/CppunitTest_ucb_webdav_core.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_core, \
        cppuhelper \
        sal \
        salhelper \
+       svl \
        test \
        ucbhelper \
        tl \
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 01efc08fdc85..7b8812563e87 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Library_use_libraries,ucpdav1,\
        cppuhelper \
        sal \
        salhelper \
+       svl \
        ucbhelper \
        tl \
 ))
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 46eac2f6f03c..f159cdf8dd37 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -22,12 +22,14 @@
 #include <cppuhelper/queryinterface.hxx>
 #include <rtl/uri.hxx>
 #include <sal/log.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <officecfg/Inet.hxx>
 #include <ucbhelper/contentidentifier.hxx>
 #include <ucbhelper/macros.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
 #include <ucbhelper/simpleinteractionrequest.hxx>
 #include <ucbhelper/cancelcommandexecution.hxx>
+#include <svl/lockfilecommon.hxx>
 
 #include <com/sun/star/beans/IllegalTypeException.hpp>
 #include <com/sun/star/beans/NotRemoveableException.hpp>
@@ -3235,8 +3237,10 @@ void Content::lock(
         }
 
         uno::Any aOwnerAny;
-        aOwnerAny
-            <<= OUString("LibreOffice - http://www.libreoffice.org/";);
+        OUString const 
user(officecfg::Office::Common::Save::Document::UseUserData::get()
+                ? " - " + ::svt::LockFileCommon::GetOOOUserName()
+                : OUString());
+        aOwnerAny <<= OUString("LibreOffice" + user);
 
         ucb::Lock aLock(
             ucb::LockScope_EXCLUSIVE,
commit e84852e4ac0b3e6b72cc8ad7b3b95f3e73eac592
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Apr 19 17:34:52 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 22 15:49:25 2022 +0200

    ucb: webdav-curl: fix getting DAV:lockdiscovery property
    
    commit b4576f3da4d90139fc5140962d13cb91dab98797 "tdf#82744: fix WebDAV
    lock/unlock behaviour - part 3" added a call to get the
    DAV:lockdiscovery property.
    
    But WebDAVResponseParser puts lock related properties into a separate
    return value maResult_Lock that is only returned for LOCK requests.
    
    Just add it as a normal property too, then PROPFIND can get it, and
    the dialog in SfxMedium::LockOrigFileOnDemand() no longer displays
    "Unknown user".
    
    Change-Id: Icee920588ea40b6e203b18287d75484528cfdebb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133185
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 68f41f4e2dcec65e8885cdfa658c0568a26182a9)

diff --git a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx 
b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
index 33074b94040e..6d7902a2f9c3 100644
--- a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
@@ -22,11 +22,13 @@
 #include "DAVProperties.hxx"
 #include "UCBDeadPropertyValue.hxx"
 
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+
 #include <cppuhelper/implbase.hxx>
 #include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <comphelper/processfactory.hxx>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/ucb/LockEntry.hpp>
 #include <com/sun/star/ucb/LockScope.hpp>
 #include <com/sun/star/ucb/LockType.hpp>
@@ -75,6 +77,7 @@ namespace
     {
         WebDAVName_unknown = 0,
         WebDAVName_activelock,
+        WebDAVName_lockdiscovery,
         WebDAVName_multistatus,
         WebDAVName_response,
         WebDAVName_href,
@@ -114,6 +117,7 @@ namespace
         if(aWebDAVNameMapperList.empty())
         {
             
aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("activelock"), 
WebDAVName_activelock));
+            
aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("lockdiscovery"), 
WebDAVName_lockdiscovery));
             
aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("multistatus"), 
WebDAVName_multistatus));
             
aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("response"), 
WebDAVName_response));
             aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("href"), 
WebDAVName_href));
@@ -751,6 +755,20 @@ namespace
                                 maResult_Lock.push_back(maLock);
                                 break;
                             }
+                            case WebDAVName_lockdiscovery:
+                            {
+                                // lockdiscovery may be requested via PROPFIND,
+                                // in addition to LOCK! so return it 2 ways
+                                if (isCollectingProperties())
+                                {
+                                    http_dav_ucp::DAVPropertyValue 
aDAVPropertyValue;
+
+                                    aDAVPropertyValue.Name = 
"DAV:lockdiscovery";
+                                    aDAVPropertyValue.Value <<= 
::comphelper::containerToSequence(maResult_Lock);
+                                    
maPropStatProperties.push_back(aDAVPropertyValue);
+                                }
+                                break;
+                            }
                             case WebDAVName_propstat:
                             {
                                 // propstat end, check status
commit 9d68e53b368ffebf20821702ac15dd974ab2eac6
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Apr 19 14:09:08 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 22 15:49:25 2022 +0200

    sfx2: do reload on SID_EDITDOC in SfxViewFrame::ExecReload_Impl()
    
    commit b505ca5b9c31b3d9c639406d03a25bea4e914242 "Switch to read-only
    mode: do not force reload document if possible" replaced "true" with
    "bNeedsReload" here - but this is a problem when switching from
    read-only to editable.
    
    1. Start LO and load a document from WebDAV editable
    2. Start other LO and load the same document from WebDAV read-only
    3. In first LO, edit document, store it and close it
    4. In second LO, click "Edit Document" button
    5. LO doesn't reload the document and shows stale content
    
    It's not clear what problem that commit was trying to solve, but let's
    assume that it intended to change only what happens when switching from
    editable to read-only.
    
    Change-Id: I69c779c5c0c5c2ccda677ea8cb353c8716916861
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133171
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit c929c563e2029bbb969dc417a688cca8934e69b0)

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 23e318fa761c..c22385427c00 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -608,7 +608,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 }
             }
 
-            rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, bNeedsReload) );
+            rReq.AppendItem( SfxBoolItem(SID_FORCERELOAD,
+                    rReq.GetSlot() == SID_EDITDOC || bNeedsReload) );
             rReq.AppendItem( SfxBoolItem( SID_SILENT, true ));
 
             [[fallthrough]]; //TODO ???
commit 5aac97f46dcea3704705eaf9b45a88be6b553e28
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Apr 20 13:16:31 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 22 15:49:25 2022 +0200

    tdf#146460 tdf#148429 ucb: webdav-curl: censor "curl" in UserAgent
    
    This is now the second bug filed because a server replies with 403 if
    the UserAgent contains the string "curl".
    
    Change-Id: I25ca2d255af76a7ff4e64dad900b1bf0b78de59f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133212
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 8d9c56e8f42428fd6695942c673bffb985d22ad5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133146
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 3fe6a03426a86ec6b18a9b712588619f19a72897)

diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index dbc2e45cd3eb..1c0201cd7680 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -619,7 +619,7 @@ 
CurlSession::CurlSession(uno::Reference<uno::XComponentContext> const& xContext,
     // 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("LibreOffice " LIBO_VERSION_DOTTED " 
curl/")
+    OString const useragent(OString("LibreOffice " LIBO_VERSION_DOTTED " 
denylistedbackend/")
                             + OString(pVersion->version, 
strlen(pVersion->version)) + " "
                             + pVersion->ssl_version);
     // looks like an explicit "User-Agent" header in CURLOPT_HTTPHEADER

Reply via email to