ucb/source/ucp/webdav/AprEnv.cxx | 2 ucb/source/ucp/webdav/DAVRequestEnvironment.hxx | 2 ucb/source/ucp/webdav/DAVResource.hxx | 4 ucb/source/ucp/webdav/DAVResourceAccess.cxx | 55 +++++- ucb/source/ucp/webdav/DAVResourceAccess.hxx | 8 ucb/source/ucp/webdav/SerfCallbacks.cxx | 6 ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx | 2 ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx | 2 ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx | 6 ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx | 6 ucb/source/ucp/webdav/SerfLockStore.cxx | 6 ucb/source/ucp/webdav/SerfLockStore.hxx | 4 ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx | 2 ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx | 2 ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx | 4 ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx | 36 ++-- ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx | 4 ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx | 85 +++++---- ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx | 4 ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx | 2 ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx | 2 ucb/source/ucp/webdav/SerfRequestProcessor.cxx | 10 - ucb/source/ucp/webdav/SerfRequestProcessor.hxx | 8 ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx | 2 ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx | 2 ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx | 22 +- ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx | 4 ucb/source/ucp/webdav/SerfSession.cxx | 16 - ucb/source/ucp/webdav/SerfSession.hxx | 6 ucb/source/ucp/webdav/SerfUri.cxx | 2 ucb/source/ucp/webdav/SerfUri.hxx | 2 ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx | 2 ucb/source/ucp/webdav/webdavcontent.cxx | 162 ++++++++++++++++-- ucb/source/ucp/webdav/webdavprovider.cxx | 2 ucb/source/ucp/webdav/webdavresponseparser.cxx | 2 ucb/source/ucp/webdav/webdavresponseparser.hxx | 2 43 files changed, 355 insertions(+), 147 deletions(-)
New commits: commit 7056e8ef89e938e38fc5b2b8a7493f0c79d5efd4 Author: Ariel Constenla-Haile <[email protected]> Date: Sun Mar 24 12:21:32 2013 +0000 Resolves@ #i121926# fix malformed PROPFIND/PROPPATCH request body (cherry picked from commit 3c83ceae5e4ff5afe20ea76aeaaae6303cdaec2d) Conflicts: ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx Change-Id: I13dab5fb80235e2ab968a1492c05bf579ba08d40 diff --git a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx index ef02e68..ccceaf4 100644 --- a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx @@ -23,6 +23,8 @@ #include "webdavresponseparser.hxx" #include <comphelper/seqstream.hxx> +#include <rtl/ustrbuf.hxx> + using namespace com::sun::star; @@ -89,14 +91,20 @@ serf_bucket_t * SerfPropFindReqProcImpl::createSerfRequestBucket( serf_request_t // body bucket - certain properties OR all properties OR only property names serf_bucket_t* body_bkt = 0; - OUString aBodyText; + OString aBodyText; { + // TODO is it really needed a Unicode string buffer? + // All properties and property names aren't supposed to be ASCII? + rtl::OUStringBuffer aBuffer; + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_HEADER )); + // create and fill body bucket with requested properties const int nPropCount = ( !mbOnlyPropertyNames && mpPropNames ) ? mpPropNames->size() : 0; if ( nPropCount > 0 ) { + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<prop>" ) ); SerfPropName thePropName; for ( int theIndex = 0; theIndex < nPropCount; theIndex ++ ) { @@ -120,23 +128,19 @@ serf_bucket_t * SerfPropFindReqProcImpl::createSerfRequestBucket( serf_request_t { if ( mbOnlyPropertyNames ) { - aBodyText = OUString::createFromAscii( "<propname/>" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<propname/>" )); } else { - aBodyText = OUString::createFromAscii( "<allprop/>" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<allprop/>" )); } } - aBodyText = OUString::createFromAscii( PROPFIND_HEADER ) + - aBodyText + - OUString::createFromAscii( PROPFIND_TRAILER ); - body_bkt = SERF_BUCKET_SIMPLE_STRING( OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 ), - pSerfBucketAlloc ); - if ( useChunkedEncoding() ) - { - body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc ); - } + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_TRAILER )); + aBodyText = rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(), + aBodyText.getLength(), + pSerfBucketAlloc ); } // create serf request diff --git a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx index d504a66..c3e95b4 100644 --- a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx @@ -18,6 +18,7 @@ */ #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include "DAVProperties.hxx" #include "UCBDeadPropertyValue.hxx" @@ -48,20 +49,33 @@ serf_bucket_t * SerfPropPatchReqProcImpl::createSerfRequestBucket( serf_request_ // body bucket serf_bucket_t* body_bkt = 0; - OUString aBodyText; + OString aBodyText; { // create and fill body bucket with properties to be set or removed - static const char* OpCodes[2] = { "set", "remove" }; + static const struct + { + const char *str; + sal_Int32 len; + } + OpCode [] = { + { RTL_CONSTASCII_STRINGPARAM( "set" ) }, + { RTL_CONSTASCII_STRINGPARAM( "remove" ) } + }; const int nPropCount = ( mpProperties != 0 ) ? mpProperties->size() : 0; if ( nPropCount > 0 ) { + rtl::OUStringBuffer aBuffer; + // add PropPatch xml header in front + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_HEADER )); + // <*operation code*><prop> + ProppatchOperation lastOp = (*mpProperties)[ 0 ].operation; - aBodyText += OUString::createFromAscii( "<" ); - aBodyText += OUString::createFromAscii( OpCodes[lastOp] ); - aBodyText += OUString::createFromAscii( "><prop>" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" )); + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" )); SerfPropName thePropName; for ( int n = 0; n < nPropCount; ++n ) @@ -74,24 +88,24 @@ serf_bucket_t * SerfPropPatchReqProcImpl::createSerfRequestBucket( serf_request_ if ( rProperty.operation != lastOp ) { // </prop></*last operation code*><*operation code><prop> - aBodyText += OUString::createFromAscii( "</prop></" ); - aBodyText += OUString::createFromAscii( OpCodes[lastOp] ); - aBodyText += OUString::createFromAscii( "><" ); - aBodyText += OUString::createFromAscii( OpCodes[rProperty.operation] ); - aBodyText += OUString::createFromAscii( "><prop>" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" )); + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><" )); + aBuffer.appendAscii( OpCode[rProperty.operation].str, OpCode[rProperty.operation].len ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" )); } // <*propname* xmlns="*propns*" - aBodyText += OUString::createFromAscii( "<" ); - aBodyText += OUString::createFromAscii( thePropName.name ); - aBodyText += OUString::createFromAscii( " xmlns=\"" ); - aBodyText += OUString::createFromAscii( thePropName.nspace ); - aBodyText += OUString::createFromAscii( "\"" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" )); + aBuffer.appendAscii( thePropName.name ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " xmlns=\"" )); + aBuffer.appendAscii( thePropName.nspace ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" )); if ( rProperty.operation == PROPSET ) { // >*property value*</*propname*> - aBodyText += OUString::createFromAscii( ">" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" )); OUString aStringValue; if ( DAVProperties::isUCBDeadProperty( thePropName ) ) @@ -103,37 +117,32 @@ serf_bucket_t * SerfPropPatchReqProcImpl::createSerfRequestBucket( serf_request_ { rProperty.value >>= aStringValue; } - aBodyText += aStringValue; - aBodyText += OUString::createFromAscii( "</" ); - aBodyText += OUString::createFromAscii( thePropName.name ); - aBodyText += OUString::createFromAscii( ">" ); + aBuffer.append( aStringValue ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</" )); + aBuffer.appendAscii( thePropName.name ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" )); } else { // /> - aBodyText += OUString::createFromAscii( "/>" ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/>" )); } lastOp = rProperty.operation; } // </prop></*last operation code*> - aBodyText += OUString::createFromAscii( "</prop></" ); - aBodyText += OUString::createFromAscii( OpCodes[lastOp] ); - aBodyText += OUString::createFromAscii( ">" ); - - // add PropPatch xml header in front - aBodyText = OUString::createFromAscii( PROPPATCH_HEADER ) + aBodyText; + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" )); + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" )); // add PropPatch xml trailer at end - aBodyText += OUString::createFromAscii( PROPPATCH_TRAILER ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_TRAILER )); - body_bkt = SERF_BUCKET_SIMPLE_STRING( OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 ), - pSerfBucketAlloc ); - if ( useChunkedEncoding() ) - { - body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc ); - } + aBodyText = rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(), + aBodyText.getLength(), + pSerfBucketAlloc ); } } commit 3c18e25efdbbc13be3a0c6ed354d5e7a46feb451 Author: Ariel Constenla-Haile <[email protected]> Date: Sun Mar 24 12:21:20 2013 +0000 Header clean-up (cherry picked from commit 9e6159be30751d0ff3af6086de0114cb769873ee) Change-Id: I1bd046e1aca89d3dd35780338737ca4a6f207bca diff --git a/ucb/source/ucp/webdav/AprEnv.cxx b/ucb/source/ucp/webdav/AprEnv.cxx index 6c52b1a..327b7dd 100644 --- a/ucb/source/ucp/webdav/AprEnv.cxx +++ b/ucb/source/ucp/webdav/AprEnv.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <AprEnv.hxx> +#include "AprEnv.hxx" namespace apr_environment { diff --git a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx index ea63b9ef..db2a853 100644 --- a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx +++ b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx @@ -23,7 +23,7 @@ #include <vector> #include <rtl/ref.hxx> -#include <DAVAuthListener.hxx> +#include "DAVAuthListener.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/DAVResource.hxx b/ucb/source/ucp/webdav/DAVResource.hxx index 9e43a13..e0986b5 100644 --- a/ucb/source/ucp/webdav/DAVResource.hxx +++ b/ucb/source/ucp/webdav/DAVResource.hxx @@ -24,8 +24,8 @@ #include <vector> -#include "rtl/ustring.hxx" -#include "com/sun/star/uno/Any.hxx" +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Any.hxx> namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index 5ce2db6..531d6d1 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -17,13 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "osl/diagnose.h" +#include <osl/diagnose.h> -#include "com/sun/star/task/XInteractionAbort.hpp" -#include "com/sun/star/ucb/XWebDAVCommandEnvironment.hpp" +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp> -#include "ucbhelper/simpleauthenticationrequest.hxx" -#include "comphelper/seekableinput.hxx" +#include <ucbhelper/simpleauthenticationrequest.hxx> +#include <comphelper/seekableinput.hxx> #include "DAVAuthListenerImpl.hxx" #include "DAVResourceAccess.hxx" diff --git a/ucb/source/ucp/webdav/SerfCallbacks.cxx b/ucb/source/ucp/webdav/SerfCallbacks.cxx index 25539ce..c0aa58b 100644 --- a/ucb/source/ucp/webdav/SerfCallbacks.cxx +++ b/ucb/source/ucp/webdav/SerfCallbacks.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfCallbacks.hxx> +#include "SerfCallbacks.hxx" -#include <SerfSession.hxx> -#include <SerfRequestProcessor.hxx> +#include "SerfSession.hxx" +#include "SerfRequestProcessor.hxx" using namespace http_dav_ucp; diff --git a/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx index 5e730c0..1bc2098 100644 --- a/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfCopyReqProcImpl.hxx> +#include "SerfCopyReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx index 75631bb..49ecb42 100644 --- a/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SERFCOPYREQPROCIMPL_HXX #define INCLUDED_SERFCOPYREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx index 0a0ca35..9287408 100644 --- a/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfDeleteReqProcImpl.hxx> +#include "SerfDeleteReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx index 1cf2ec1..203a677 100644 --- a/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SERFDELETEREQPROCIMPL_HXX #define INCLUDED_SERFDELETEREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx index 3632853..03c686f 100644 --- a/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfGetReqProcImpl.hxx> +#include "SerfGetReqProcImpl.hxx" using namespace com::sun::star; diff --git a/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx index dd02be1..868d006 100644 --- a/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx @@ -20,13 +20,13 @@ #ifndef INCLUDED_SERFGETREQPROCIMPL_HXX #define INCLUDED_SERFGETREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" #include <vector> #include <rtl/ustring.hxx> -#include <DAVResource.hxx> +#include "DAVResource.hxx" -#include <SerfInputStream.hxx> +#include "SerfInputStream.hxx" #include <com/sun/star/io/XOutputStream.hpp> namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx index e48a1a0..248a5c5 100644 --- a/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfHeadReqProcImpl.hxx> +#include "SerfHeadReqProcImpl.hxx" using namespace com::sun::star; diff --git a/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx index 4041756..4902da1 100644 --- a/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx @@ -20,13 +20,13 @@ #ifndef INCLUDED_SERFHEADREQPROCIMPL_HXX #define INCLUDED_SERFHEADREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" #include <vector> #include <rtl/ustring.hxx> -#include <DAVResource.hxx> +#include "DAVResource.hxx" -#include <SerfInputStream.hxx> +#include "SerfInputStream.hxx" #include <com/sun/star/io/XOutputStream.hpp> namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfLockStore.cxx b/ucb/source/ucp/webdav/SerfLockStore.cxx index 27ed897..80dcd60 100644 --- a/ucb/source/ucp/webdav/SerfLockStore.cxx +++ b/ucb/source/ucp/webdav/SerfLockStore.cxx @@ -19,9 +19,9 @@ #include <ne_locks.h> #include <ne_uri.h> -#include "rtl/ustring.hxx" -#include "osl/time.h" -#include "osl/thread.hxx" +#include <rtl/ustring.hxx> +#include <osl/time.h> +#include <osl/thread.hxx> #include "SerfSession.hxx" #include "SerfLockStore.hxx" diff --git a/ucb/source/ucp/webdav/SerfLockStore.hxx b/ucb/source/ucp/webdav/SerfLockStore.hxx index ac3e951..4fff5f6 100644 --- a/ucb/source/ucp/webdav/SerfLockStore.hxx +++ b/ucb/source/ucp/webdav/SerfLockStore.hxx @@ -22,8 +22,8 @@ #define INCLUDED_SERFLOCKSTORE_HXX #include <map> -#include "osl/mutex.hxx" -#include "rtl/ref.hxx" +#include <osl/mutex.hxx> +#include <rtl/ref.hxx> #include "SerfTypes.hxx" namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx index 0d5a492..07c6725 100644 --- a/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfMkColReqProcImpl.hxx> +#include "SerfMkColReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx index 3e1ded5..3f7c75e 100644 --- a/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SERFMKCOLREQPROCIMPL_HXX #define INCLUDED_SERFMKCOLREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx index 89d6df1..b0cb2cc 100644 --- a/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfMoveReqProcImpl.hxx> +#include "SerfMoveReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx index 0ed5d2d..e7156db 100644 --- a/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SERFMOVEREQPROCIMPL_HXX #define INCLUDED_SERFMOVEREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx index 50accc4..86e2f36 100644 --- a/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfPostReqProcImpl.hxx> +#include "SerfPostReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx index 9cb6af3..9ad9beb 100644 --- a/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx @@ -20,9 +20,9 @@ #ifndef INCLUDED_SERFPOSTREQPROCIMPL_HXX #define INCLUDED_SERFPOSTREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" -#include <SerfInputStream.hxx> +#include "SerfInputStream.hxx" #include <com/sun/star/io/XOutputStream.hpp> namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx index 5fb7680..ef02e68 100644 --- a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx @@ -17,11 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfPropFindReqProcImpl.hxx> -#include <SerfTypes.hxx> -#include <DAVProperties.hxx> +#include "SerfPropFindReqProcImpl.hxx" +#include "SerfTypes.hxx" +#include "DAVProperties.hxx" -#include <webdavresponseparser.hxx> +#include "webdavresponseparser.hxx" #include <comphelper/seqstream.hxx> using namespace com::sun::star; diff --git a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx index 35503ba..7f7bd9d 100644 --- a/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx @@ -20,14 +20,14 @@ #ifndef INCLUDED_SERFPROPFINDREQPROCIMPL_HXX #define INCLUDED_SERFPROPFINDREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" #include <vector> #include <rtl/ustring.hxx> #include "DAVTypes.hxx" #include "DAVResource.hxx" -#include <SerfInputStream.hxx> +#include "SerfInputStream.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx index 9b2583a..d504a66 100644 --- a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx @@ -18,11 +18,11 @@ */ #include <rtl/ustring.hxx> -#include <DAVProperties.hxx> -#include <UCBDeadPropertyValue.hxx> +#include "DAVProperties.hxx" +#include "UCBDeadPropertyValue.hxx" -#include <SerfPropPatchReqProcImpl.hxx> -#include <SerfTypes.hxx> +#include "SerfPropPatchReqProcImpl.hxx" +#include "SerfTypes.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx index c2ee2d1..1b9693c 100644 --- a/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx @@ -20,10 +20,10 @@ #ifndef INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX #define INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" #include <vector> -#include <DAVTypes.hxx> +#include "DAVTypes.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx index 2b83dcf..6440318 100644 --- a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx +++ b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx @@ -19,7 +19,7 @@ #include <rtl/ustring.hxx> -#include <SerfPutReqProcImpl.hxx> +#include "SerfPutReqProcImpl.hxx" #include <serf.h> diff --git a/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx b/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx index 64474d7..a0bcccd 100644 --- a/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx +++ b/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SERFPUTREQPROCIMPL_HXX #define INCLUDED_SERFPUTREQPROCIMPL_HXX -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx index db4c5ac..dbf1ec1 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx @@ -17,11 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfRequestProcessor.hxx> -#include <SerfRequestProcessorImpl.hxx> -#include <SerfRequestProcessorImplFac.hxx> -#include <SerfCallbacks.hxx> -#include <SerfSession.hxx> +#include "SerfRequestProcessor.hxx" +#include "SerfRequestProcessorImpl.hxx" +#include "SerfRequestProcessorImplFac.hxx" +#include "SerfCallbacks.hxx" +#include "SerfSession.hxx" #include <apr_strings.h> diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx index 734cd07..9addb34 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessor.hxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessor.hxx @@ -26,11 +26,11 @@ #include <serf.h> -#include <DAVTypes.hxx> -#include <DAVResource.hxx> -#include <DAVException.hxx> +#include "DAVTypes.hxx" +#include "DAVResource.hxx" +#include "DAVException.hxx" -#include <SerfInputStream.hxx> +#include "SerfInputStream.hxx" #include <com/sun/star/io/XOutputStream.hpp> namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx index 7637684..f5023b8 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfRequestProcessorImpl.hxx> +#include "SerfRequestProcessorImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx index 2d0eb1b..cea80bd 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx @@ -23,7 +23,7 @@ #include <serf.h> #include <sal/types.h> -#include <DAVRequestEnvironment.hxx> +#include "DAVRequestEnvironment.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx b/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx index 3abf5a7..cbd45a1 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx @@ -17,17 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <SerfRequestProcessorImplFac.hxx> -#include <SerfPropFindReqProcImpl.hxx> -#include <SerfPropPatchReqProcImpl.hxx> -#include <SerfGetReqProcImpl.hxx> -#include <SerfHeadReqProcImpl.hxx> -#include <SerfPutReqProcImpl.hxx> -#include <SerfPostReqProcImpl.hxx> -#include <SerfDeleteReqProcImpl.hxx> -#include <SerfMkColReqProcImpl.hxx> -#include <SerfCopyReqProcImpl.hxx> -#include <SerfMoveReqProcImpl.hxx> +#include "SerfRequestProcessorImplFac.hxx" +#include "SerfPropFindReqProcImpl.hxx" +#include "SerfPropPatchReqProcImpl.hxx" +#include "SerfGetReqProcImpl.hxx" +#include "SerfHeadReqProcImpl.hxx" +#include "SerfPutReqProcImpl.hxx" +#include "SerfPostReqProcImpl.hxx" +#include "SerfDeleteReqProcImpl.hxx" +#include "SerfMkColReqProcImpl.hxx" +#include "SerfCopyReqProcImpl.hxx" +#include "SerfMoveReqProcImpl.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx b/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx index 083287e..f31d96a 100644 --- a/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx +++ b/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx @@ -25,8 +25,8 @@ #include "DAVTypes.hxx" #include "DAVResource.hxx" -#include <SerfRequestProcessorImpl.hxx> -#include <SerfInputStream.hxx> +#include "SerfRequestProcessorImpl.hxx" +#include "SerfInputStream.hxx" #include <com/sun/star/io/XOutputStream.hpp> namespace http_dav_ucp diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx index 33c5428..ffef27d 100644 --- a/ucb/source/ucp/webdav/SerfSession.cxx +++ b/ucb/source/ucp/webdav/SerfSession.cxx @@ -25,17 +25,17 @@ #include "comphelper/sequence.hxx" #include "ucbhelper/simplecertificatevalidationrequest.hxx" -#include <AprEnv.hxx> +#include "AprEnv.hxx" #include <apr_strings.h> #include "DAVAuthListener.hxx" -#include <SerfTypes.hxx> -#include <SerfSession.hxx> -#include <SerfUri.hxx> -#include <SerfRequestProcessor.hxx> -#include <SerfCallbacks.hxx> -#include <SerfInputStream.hxx> -#include <UCBDeadPropertyValue.hxx> +#include "SerfTypes.hxx" +#include "SerfSession.hxx" +#include "SerfUri.hxx" +#include "SerfRequestProcessor.hxx" +#include "SerfCallbacks.hxx" +#include "SerfInputStream.hxx" +#include "UCBDeadPropertyValue.hxx" #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/security/XCertificate.hpp> diff --git a/ucb/source/ucp/webdav/SerfSession.hxx b/ucb/source/ucp/webdav/SerfSession.hxx index 585a28a..aa75d45 100644 --- a/ucb/source/ucp/webdav/SerfSession.hxx +++ b/ucb/source/ucp/webdav/SerfSession.hxx @@ -25,10 +25,10 @@ #include <vector> #include <boost/shared_ptr.hpp> #include <osl/mutex.hxx> -#include <DAVSession.hxx> -#include <SerfTypes.hxx> +#include "DAVSession.hxx" +#include "SerfTypes.hxx" //#include "SerfLockStore.hxx" -#include <SerfUri.hxx> +#include "SerfUri.hxx" #include <com/sun/star/lang/XMultiServiceFactory.hpp> namespace ucbhelper { class ProxyDecider; } diff --git a/ucb/source/ucp/webdav/SerfUri.cxx b/ucb/source/ucp/webdav/SerfUri.cxx index a82418c..66aec6d 100644 --- a/ucb/source/ucp/webdav/SerfUri.cxx +++ b/ucb/source/ucp/webdav/SerfUri.cxx @@ -23,7 +23,7 @@ #include <rtl/ustrbuf.hxx> #include "SerfUri.hxx" #include "DAVException.hxx" -#include <AprEnv.hxx> +#include "AprEnv.hxx" #include "../inc/urihelper.hxx" diff --git a/ucb/source/ucp/webdav/SerfUri.hxx b/ucb/source/ucp/webdav/SerfUri.hxx index 15b0a6b..eb192b5 100644 --- a/ucb/source/ucp/webdav/SerfUri.hxx +++ b/ucb/source/ucp/webdav/SerfUri.hxx @@ -23,7 +23,7 @@ #include <apr-util/apr_uri.h> #include <rtl/ustring.hxx> -#include <DAVException.hxx> +#include "DAVException.hxx" namespace http_dav_ucp { diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx index 3a953d2..82096f2 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx @@ -23,7 +23,7 @@ #include "UCBDeadPropertyValue.hxx" using namespace http_dav_ucp; -using namespace com::sun::star; +using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////////// diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 6410dd3..8bc4d69 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -18,7 +18,7 @@ */ #include <osl/diagnose.h> -#include "osl/doublecheckedlocking.h" +#include <osl/doublecheckedlocking.h> #include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> @@ -41,9 +41,9 @@ #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> -#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp" -#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp" -#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp" +#include <com/sun/star/ucb/InteractiveLockingLockedException.hpp> +#include <com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp> +#include <com/sun/star/ucb/InteractiveLockingNotLockedException.hpp> #include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp> #include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp> #include <com/sun/star/ucb/InteractiveNetworkReadException.hpp> diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx index 0d4d091..ad93bf9 100644 --- a/ucb/source/ucp/webdav/webdavprovider.cxx +++ b/ucb/source/ucp/webdav/webdavprovider.cxx @@ -21,7 +21,7 @@ #include "webdavprovider.hxx" #include "webdavcontent.hxx" -#include "osl/mutex.hxx" +#include <osl/mutex.hxx> using namespace com::sun::star; using namespace http_dav_ucp; diff --git a/ucb/source/ucp/webdav/webdavresponseparser.cxx b/ucb/source/ucp/webdav/webdavresponseparser.cxx index f61efc8..2da021f 100644 --- a/ucb/source/ucp/webdav/webdavresponseparser.cxx +++ b/ucb/source/ucp/webdav/webdavresponseparser.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <webdavresponseparser.hxx> +#include "webdavresponseparser.hxx" #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <cppuhelper/implbase2.hxx> #include <com/sun/star/xml/sax/Parser.hpp> diff --git a/ucb/source/ucp/webdav/webdavresponseparser.hxx b/ucb/source/ucp/webdav/webdavresponseparser.hxx index d59cb2a..f385895 100644 --- a/ucb/source/ucp/webdav/webdavresponseparser.hxx +++ b/ucb/source/ucp/webdav/webdavresponseparser.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/io/XInputStream.hpp> -#include <DAVResource.hxx> +#include "DAVResource.hxx" #include <vector> ////////////////////////////////////////////////////////////////////////////// commit b42211965a5246735c6551f1472c82da8d20d508 Author: Ariel Constenla-Haile <[email protected]> Date: Sun Mar 24 12:20:58 2013 +0000 Resolves; #i121201# Handle servers not supporting HEAD requests (cherry picked from commit d7085ea6fe26d2fc2ba384da04e454e78887f1f1) Change-Id: I4b3d50906468b998a1f4964d0ad1af3d31725332 diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index ee713ea..5ce2db6 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -459,6 +459,51 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( } //========================================================================= +uno::Reference< io::XInputStream > DAVResourceAccess::GET( + DAVRequestHeaders &rRequestHeaders, + const std::vector< OUString > & rHeaderNames, + DAVResource & rResource, + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw( DAVException ) +{ + initialize(); + + uno::Reference< io::XInputStream > xStream; + int errorCount = 0; + bool bRetry; + do + { + bRetry = false; + try + { + getUserRequestHeaders( xEnv, + getRequestURI(), + OUString( "GET" ), + rRequestHeaders ); + + xStream = m_xSession->GET( getRequestURI(), + rHeaderNames, + rResource, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + rRequestHeaders, xEnv ) ); + } + catch ( DAVException & e ) + { + errorCount++; + bRetry = handleException( e, errorCount ); + if ( !bRetry ) + throw; + } + } + while ( bRetry ); + + return xStream; +} + +//========================================================================= void DAVResourceAccess::GET( uno::Reference< io::XOutputStream > & rStream, const std::vector< OUString > & rHeaderNames, diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx index a6d5623..23705ce 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx @@ -126,6 +126,14 @@ public: com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw ( DAVException ); + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + GET( DAVRequestHeaders & rRequestHeaders, + const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' + DAVResource & rResource, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); + void GET( com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & rStream, diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index d5e4f90..6410dd3 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -75,6 +75,118 @@ using namespace com::sun::star; using namespace http_dav_ucp; +namespace +{ +static void lcl_sendPartialGETRequest( bool &bError, + DAVException &aLastException, + const std::vector< rtl::OUString > aProps, + std::vector< rtl::OUString > &aHeaderNames, + const std::auto_ptr< DAVResourceAccess > &xResAccess, + std::auto_ptr< ContentProperties > &xProps, + const uno::Reference< ucb::XCommandEnvironment >& xEnv ) +{ + bool bIsRequestSize = false; + DAVResource aResource; + DAVRequestHeaders aPartialGet; + aPartialGet.push_back( + DAVRequestHeader( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bytes=0-0" )))); + + for ( std::vector< rtl::OUString >::const_iterator it = aHeaderNames.begin(); + it != aHeaderNames.end(); it++ ) + { + if ( it->equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Content-Length" ) ) ) + { + bIsRequestSize = true; + break; + } + } + + if ( bIsRequestSize ) + { + // we need to know if the server accepts range requests for a resource + // and the range unit it uses + aHeaderNames.push_back( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accept-Ranges" ) ) ); + aHeaderNames.push_back( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Content-Range" ) ) ); + } + try + { + uno::Reference< io::XInputStream > xIn = xResAccess->GET( aPartialGet, + aHeaderNames, + aResource, + xEnv ); + bError = false; + + if ( bIsRequestSize ) + { + // the ContentProperties maps "Content-Length" to the UCB "Size" property + // This would have an unrealistic value of 1 byte because we did only a partial GET + // Solution: if "Content-Range" is present, map it with UCB "Size" property + rtl::OUString aAcceptRanges, aContentRange, aContentLength; + std::vector< DAVPropertyValue > &aResponseProps = aResource.properties; + for ( std::vector< DAVPropertyValue >::const_iterator it = aResponseProps.begin(); + it != aResponseProps.end(); it++ ) + { + if ( it->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Accept-Ranges" ) ) ) + it->Value >>= aAcceptRanges; + else if ( it->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Content-Range" ) ) ) + it->Value >>= aContentRange; + else if ( it->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Content-Length" ) ) ) + it->Value >>= aContentLength; + } + + sal_Int64 nSize = 1; + if ( aContentLength.getLength() ) + { + nSize = aContentLength.toInt64(); + } + + // according to http://tools.ietf.org/html/rfc2616#section-3.12 + // the only range unit defined is "bytes" and implementations + // MAY ignore ranges specified using other units. + if ( nSize == 1 && + aContentRange.getLength() && + aAcceptRanges.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bytes" ) ) ) + { + // Parse the Content-Range to get the size + // vid. http://tools.ietf.org/html/rfc2616#section-14.16 + // Content-Range: <range unit> <bytes range>/<size> + sal_Int32 nSlash = aContentRange.lastIndexOf( sal_Unicode('/')); + if ( nSlash != -1 ) + { + rtl::OUString aSize = aContentRange.copy( nSlash + 1 ); + // "*" means that the instance-length is unknown at the time when the response was generated + if ( !aSize.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "*" ))) + { + for ( std::vector< DAVPropertyValue >::iterator it = aResponseProps.begin(); + it != aResponseProps.end(); it++ ) + { + if ( it->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Content-Length" ) ) ) + { + it->Value <<= aSize; + break; + } + } + } + } + } + } + + if ( xProps.get() ) + xProps->addProperties( + aProps, + ContentProperties( aResource ) ); + else + xProps.reset ( new ContentProperties( aResource ) ); + } + catch ( DAVException const & ex ) + { + aLastException = ex; + } +} +} + //========================================================================= //========================================================================= // @@ -1335,13 +1447,43 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( } catch ( DAVException const & e ) { - bNetworkAccessAllowed - = shouldAccessNetworkAfterException( e ); + // non "general-purpose servers" may not support HEAD requests + // see http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.1 + // In this case, perform a partial GET only to get the header info + // vid. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 + // WARNING if the server does not support partial GETs, + // the GET will transfer the whole content + bool bError = true; + DAVException aLastException = e; + + // According to the spec. the origin server SHOULD return + // * 405 (Method Not Allowed): + // the method is known but not allowed for the requested resource + // * 501 (Not Implemented): + // the method is unrecognized or not implemented + // TODO SC_NOT_FOUND is only for google-code server + if ( aLastException.getStatus() == SC_NOT_IMPLEMENTED || + aLastException.getStatus() == SC_METHOD_NOT_ALLOWED || + aLastException.getStatus() == SC_NOT_FOUND ) + { + lcl_sendPartialGETRequest( bError, + aLastException, + aMissingProps, + aHeaderNames, + xResAccess, + xProps, + xEnv ); + m_bDidGetOrHead = !bError; + } - if ( !bNetworkAccessAllowed ) + if ( bError ) { - cancelCommandExecution( e, xEnv ); - // unreachable + if ( !(bNetworkAccessAllowed + = shouldAccessNetworkAfterException( aLastException )) ) + { + cancelCommandExecution( aLastException, xEnv ); + // unreachable + } } } } commit a86bc34ddcff6b04bb9fdb8c960bbf2c49540da1 Author: Ariel Constenla-Haile <[email protected]> Date: Sun Mar 24 12:20:48 2013 +0000 Resolves: #i121922# Fix wrong condition (cherry picked from commit 19c47c4496af7db6c8e41cc218d6c8c2fe69db0e) Change-Id: Ic3febe262cb6723a17e3ea9078137479211fbe59 diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index d2fad39..d5e4f90 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -1301,7 +1301,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( !( xProps.get() && xProps->containsAllNames( rProperties, aMissingProps ) ) - && !m_bDidGetOrHead ) + || !m_bDidGetOrHead ) { // Possibly the missing props can be obtained using a HEAD // request. _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
