summaryrefslogtreecommitdiffstats
path: root/ucb
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2015-12-04 17:10:06 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-12-15 19:26:00 +0000
commit522de0352ae5968d4f24726812504a2749ad0958 (patch)
treeb08e279ed5819180e113cce7604ea208d4381ab0 /ucb
parentsd: remove cargo-culted dependencies from CppunitTest_sd_misc_tests (diff)
downloadcore-522de0352ae5968d4f24726812504a2749ad0958.tar.gz
core-522de0352ae5968d4f24726812504a2749ad0958.zip
tdf#95792: fix saving file the first time on some WebDAV servers.
Some WebDAV servers don't implement section 7.3 of RFC4918: <http://tools.ietf.org/html/rfc4918#section-7.3> 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. Change-Id: Ie4689a076aafa365106d02b3ea16459a28fcde65 Reviewed-on: https://gerrit.libreoffice.org/20600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 4c82edfb3a9286a0bfef3f006e468e5c331987eb) Reviewed-on: https://gerrit.libreoffice.org/20722 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx2
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx47
2 files changed, 29 insertions, 20 deletions
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index f696e5513251..6cd7c320080a 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -596,7 +596,7 @@ NeonSession::NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFa
m_aScheme = theUri.GetScheme();
m_aHostName = theUri.GetHost();
m_nPort = theUri.GetPort();
- SAL_INFO( "ucb.ucp.webdav", "NeonSession ctor - URL < " << inUri << ">" );
+ SAL_INFO( "ucb.ucp.webdav", "NeonSession ctor - URL <" << inUri << ">" );
}
NeonSession::~NeonSession( )
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index f77b1ef61368..d00e2e871260 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -2872,16 +2872,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 <http://tools.ietf.org/html/rfc7231#section-6.5.3>:
// 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: // <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: <"
<< m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
@@ -2986,7 +2986,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
@@ -3008,20 +3008,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:
+ // <https://msdn.microsoft.com/en-us/library/jj575265%28v=office.12%29.aspx#id15>
+ // (retrieved on 2015-08-14)
+ case SC_PRECONDITION_FAILED: // <http://tools.ietf.org/html/rfc7232#section-4.2>
+ // Errors SC_NOT_IMPLEMENTED and SC_METHOD_NOT_ALLOWED are
+ // part of base http 1.1 RFCs
+ 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>
+ SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (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
// the lock is sent before the put, so the resource
// is actually created by LOCK, locking it before
- // doing the first PUT, but if LOCK is not supported
- // (simple web or DAV with lock disabled) we end with one of these two http
- // errors
- // details to LOCK on an unmapped (i.e. non existent) resource are in:
- // http://tools.ietf.org/html/rfc4918#section-7.3
+ // the first PUT, but if LOCK is not supported
+ // (simple web or DAV with lock disabled) we end with one of these http
+ // errors.
+ // These same errors may be reported when the LOCK on an unmapped
+ // (i.e. non existent) resource is not implemented.
+ // Detailed specification in:
+ // <http://tools.ietf.org/html/rfc4918#section-7.3>
return;
break;
default:
@@ -3084,9 +3092,10 @@ void Content::unlock(
//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:
+ // Errors SC_NOT_IMPLEMENTED and SC_METHOD_NOT_ALLOWED are
+ // part of base http 1.1 RFCs
+ 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>
SAL_WARN( "ucb.ucp.webdav", "unlock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <"
<< m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() );
return;