1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DAVResourceAccess.cxx,v $
10 * $Revision: 1.29.16.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucb.hxx"
34 #include "osl/diagnose.h"
36 #include "com/sun/star/task/XInteractionAbort.hpp"
37 #include "com/sun/star/ucb/XWebDAVCommandEnvironment.hpp"
39 #include "ucbhelper/simpleauthenticationrequest.hxx"
40 #include "comphelper/seekableinput.hxx"
42 #include "DAVAuthListenerImpl.hxx"
43 #include "DAVResourceAccess.hxx"
45 #include <comphelper/processfactory.hxx>
46 #include <ucbhelper/commandenvironment.hxx>
48 using namespace webdav_ucp
;
49 using namespace com::sun::star
;
51 //=========================================================================
52 //=========================================================================
54 // DAVAuthListener_Impl Implementation.
56 //=========================================================================
57 //=========================================================================
59 //=========================================================================
61 int DAVAuthListener_Impl::authenticate(
62 const ::rtl::OUString
& inRealm
,
63 const ::rtl::OUString
& inHostName
,
64 ::rtl::OUString
& inoutUserName
,
65 ::rtl::OUString
& outPassWord
,
66 const sal_Bool
& bAllowPersistentStoring
)
68 uno::Reference
< task::XInteractionHandler
> xIH
;
71 xIH
= m_xEnv
->getInteractionHandler();
73 xIH
= DAVResourceAccess::createCommandEnvironment()->getInteractionHandler();
78 // #102871# - Supply username and password from previous try.
79 // Password container service depends on this!
80 if ( inoutUserName
.getLength() == 0 )
81 inoutUserName
= m_aPrevUsername
;
83 if ( outPassWord
.getLength() == 0 )
84 outPassWord
= m_aPrevPassword
;
86 rtl::Reference
< ucbhelper::SimpleAuthenticationRequest
> xRequest
87 = new ucbhelper::SimpleAuthenticationRequest( inHostName
,
92 bAllowPersistentStoring
);
93 xIH
->handle( xRequest
.get() );
95 rtl::Reference
< ucbhelper::InteractionContinuation
> xSelection
96 = xRequest
->getSelection();
98 if ( !xSelection
.is() )
101 // Handler handled the request.
102 uno::Reference
< task::XInteractionAbort
> xAbort(
103 xSelection
.get(), uno::UNO_QUERY
);
107 const rtl::Reference
< ucbhelper::InteractionSupplyAuthentication
> & xSupp
108 = xRequest
->getAuthenticationSupplier();
110 inoutUserName
= xSupp
->getUserName();
111 outPassWord
= xSupp
->getPassword();
113 // #102871# - Remember username and password.
114 m_aPrevUsername
= inoutUserName
;
115 m_aPrevPassword
= outPassWord
;
121 //=========================================================================
122 //=========================================================================
124 // DAVResourceAccess Implementation.
126 //=========================================================================
127 //=========================================================================
129 //=========================================================================
130 DAVResourceAccess::DAVResourceAccess(
131 const uno::Reference
< lang::XMultiServiceFactory
> & rSMgr
,
132 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
,
133 const rtl::OUString
& rURL
)
135 m_xSessionFactory( rSessionFactory
),
140 //=========================================================================
141 DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess
& rOther
)
142 : m_aURL( rOther
.m_aURL
),
143 m_aPath( rOther
.m_aPath
),
144 m_xSession( rOther
.m_xSession
),
145 m_xSessionFactory( rOther
.m_xSessionFactory
),
146 m_xSMgr( rOther
.m_xSMgr
),
147 m_aRedirectURIs( rOther
.m_aRedirectURIs
)
151 //=========================================================================
152 DAVResourceAccess
& DAVResourceAccess::operator=(
153 const DAVResourceAccess
& rOther
)
155 m_aURL
= rOther
.m_aURL
;
156 m_aPath
= rOther
.m_aPath
;
157 m_xSession
= rOther
.m_xSession
;
158 m_xSessionFactory
= rOther
.m_xSessionFactory
;
159 m_xSMgr
= rOther
.m_xSMgr
;
160 m_aRedirectURIs
= rOther
.m_aRedirectURIs
;
165 //=========================================================================
166 void DAVResourceAccess::OPTIONS(
167 DAVCapabilities
& rCapabilities
,
168 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
169 throw( DAVException
)
180 DAVRequestHeaders aHeaders
;
181 getUserRequestHeaders( xEnv
,
183 rtl::OUString::createFromAscii(
187 m_xSession
->OPTIONS( getRequestURI(),
189 DAVRequestEnvironment(
191 new DAVAuthListener_Impl( xEnv
),
194 catch ( DAVException
& e
)
197 bRetry
= handleException( e
, errorCount
);
205 //=========================================================================
206 void DAVResourceAccess::PROPFIND(
208 const std::vector
< rtl::OUString
> & rPropertyNames
,
209 std::vector
< DAVResource
> & rResources
,
210 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
211 throw( DAVException
)
222 DAVRequestHeaders aHeaders
;
224 getUserRequestHeaders( xEnv
,
226 rtl::OUString::createFromAscii(
230 m_xSession
->PROPFIND( getRequestURI(),
234 DAVRequestEnvironment(
236 new DAVAuthListener_Impl( xEnv
),
239 catch ( DAVException
& e
)
242 bRetry
= handleException( e
, errorCount
);
250 //=========================================================================
251 void DAVResourceAccess::PROPFIND(
253 std::vector
< DAVResourceInfo
> & rResInfo
,
254 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
255 throw( DAVException
)
266 DAVRequestHeaders aHeaders
;
267 getUserRequestHeaders( xEnv
,
269 rtl::OUString::createFromAscii(
273 m_xSession
->PROPFIND( getRequestURI(),
276 DAVRequestEnvironment(
278 new DAVAuthListener_Impl( xEnv
),
281 catch ( DAVException
& e
)
284 bRetry
= handleException( e
, errorCount
);
292 //=========================================================================
293 void DAVResourceAccess::PROPPATCH(
294 const std::vector
< ProppatchValue
>& rValues
,
295 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
296 throw( DAVException
)
307 DAVRequestHeaders aHeaders
;
308 getUserRequestHeaders( xEnv
,
310 rtl::OUString::createFromAscii(
314 m_xSession
->PROPPATCH( getRequestURI(),
316 DAVRequestEnvironment(
318 new DAVAuthListener_Impl( xEnv
),
321 catch ( DAVException
& e
)
324 bRetry
= handleException( e
, errorCount
);
332 //=========================================================================
333 void DAVResourceAccess::HEAD(
334 const std::vector
< rtl::OUString
> & rHeaderNames
,
335 DAVResource
& rResource
,
336 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
337 throw( DAVException
)
347 DAVRequestHeaders aHeaders
;
348 getUserRequestHeaders( xEnv
,
350 rtl::OUString::createFromAscii( "HEAD" ),
353 m_xSession
->HEAD( getRequestURI(),
356 DAVRequestEnvironment(
358 new DAVAuthListener_Impl( xEnv
),
361 catch ( DAVException
& e
)
364 bRetry
= handleException( e
, errorCount
);
372 //=========================================================================
373 uno::Reference
< io::XInputStream
> DAVResourceAccess::GET(
374 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
375 throw( DAVException
)
379 uno::Reference
< io::XInputStream
> xStream
;
387 DAVRequestHeaders aHeaders
;
388 getUserRequestHeaders( xEnv
,
390 rtl::OUString::createFromAscii( "GET" ),
393 xStream
= m_xSession
->GET( getRequestURI(),
394 DAVRequestEnvironment(
396 new DAVAuthListener_Impl( xEnv
),
399 catch ( DAVException
& e
)
402 bRetry
= handleException( e
, errorCount
);
412 //=========================================================================
413 void DAVResourceAccess::GET(
414 uno::Reference
< io::XOutputStream
> & rStream
,
415 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
416 throw( DAVException
)
427 DAVRequestHeaders aHeaders
;
428 getUserRequestHeaders( xEnv
,
430 rtl::OUString::createFromAscii( "GET" ),
433 m_xSession
->GET( getRequestURI(),
435 DAVRequestEnvironment(
437 new DAVAuthListener_Impl( xEnv
),
440 catch ( DAVException
& e
)
443 bRetry
= handleException( e
, errorCount
);
451 //=========================================================================
452 uno::Reference
< io::XStream
> DAVResourceAccess::GET(
453 const std::vector
< rtl::OUString
> & rHeaderNames
,
454 DAVResource
& rResource
,
455 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
,
456 sal_Bool bAllowEmpty
)
457 throw( DAVException
)
461 uno::Reference
< io::XStream
> xStream
;
469 DAVRequestHeaders aHeaders
;
470 getUserRequestHeaders( xEnv
,
472 rtl::OUString::createFromAscii( "GET" ),
475 xStream
= m_xSession
->GET( getRequestURI(),
478 DAVRequestEnvironment(
480 new DAVAuthListener_Impl( xEnv
),
484 catch ( DAVException
& e
)
487 bRetry
= handleException( e
, errorCount
);
497 //=========================================================================
498 void DAVResourceAccess::GET(
499 uno::Reference
< io::XOutputStream
> & rStream
,
500 const std::vector
< rtl::OUString
> & rHeaderNames
,
501 DAVResource
& rResource
,
502 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
503 throw( DAVException
)
514 DAVRequestHeaders aHeaders
;
515 getUserRequestHeaders( xEnv
,
517 rtl::OUString::createFromAscii( "GET" ),
520 m_xSession
->GET( getRequestURI(),
524 DAVRequestEnvironment(
526 new DAVAuthListener_Impl( xEnv
),
529 catch ( DAVException
& e
)
532 bRetry
= handleException( e
, errorCount
);
540 //=========================================================================
541 void DAVResourceAccess::ABORT()
542 throw( DAVException
)
547 //=========================================================================
550 void resetInputStream( const uno::Reference
< io::XInputStream
> & rStream
)
551 throw( DAVException
)
555 uno::Reference
< io::XSeekable
> xSeekable(
556 rStream
, uno::UNO_QUERY
);
557 if ( xSeekable
.is() )
559 xSeekable
->seek( 0 );
563 catch ( lang::IllegalArgumentException
const & )
566 catch ( io::IOException
const & )
570 throw DAVException( DAVException::DAV_INVALID_ARG
);
575 //=========================================================================
576 void DAVResourceAccess::PUT(
577 const uno::Reference
< io::XInputStream
> & rStream
,
578 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
579 throw( DAVException
)
583 // Make stream seekable, if it not. Needed, if request must be retried.
584 uno::Reference
< io::XInputStream
> xSeekableStream
585 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
593 resetInputStream( xSeekableStream
);
598 DAVRequestHeaders aHeaders
;
599 getUserRequestHeaders( xEnv
,
601 rtl::OUString::createFromAscii( "PUT" ),
604 m_xSession
->PUT( getRequestURI(),
606 DAVRequestEnvironment(
608 new DAVAuthListener_Impl( xEnv
),
611 catch ( DAVException
& e
)
614 bRetry
= handleException( e
, errorCount
);
622 //=========================================================================
623 void DAVResourceAccess::PUT(
624 const char * buffer
, size_t size
,
625 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
626 throw( DAVException
)
637 DAVRequestHeaders aHeaders
;
638 getUserRequestHeaders( xEnv
,
640 rtl::OUString::createFromAscii( "PUT" ),
643 m_xSession
->PUT( getRequestURI(),
645 DAVRequestEnvironment(
647 new DAVAuthListener_Impl( xEnv
),
650 catch ( DAVException
& e
)
653 bRetry
= handleException( e
, errorCount
);
661 //=========================================================================
662 uno::Reference
< io::XInputStream
> DAVResourceAccess::POST(
663 const rtl::OUString
& rContentType
,
664 const rtl::OUString
& rReferer
,
665 const uno::Reference
< io::XInputStream
> & rInputStream
,
666 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
667 throw ( DAVException
)
671 // Make stream seekable, if it not. Needed, if request must be retried.
672 uno::Reference
< io::XInputStream
> xSeekableStream
673 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
674 rInputStream
, m_xSMgr
);
676 uno::Reference
< io::XInputStream
> xStream
;
683 resetInputStream( xSeekableStream
);
689 DAVRequestHeaders aHeaders
;
690 getUserRequestHeaders( xEnv
,
692 rtl::OUString::createFromAscii( "POST" ),
695 xStream
= m_xSession
->POST( getRequestURI(),
699 DAVRequestEnvironment(
701 new DAVAuthListener_Impl( xEnv
),
704 catch ( DAVException
& e
)
707 bRetry
= handleException( e
, errorCount
);
711 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
713 // #i74980# - Upon POST redirect, do a GET.
723 //=========================================================================
725 void DAVResourceAccess::POST(
726 const rtl::OUString
& rContentType
,
727 const rtl::OUString
& rReferer
,
728 const uno::Reference
< io::XInputStream
> & rInputStream
,
729 uno::Reference
< io::XOutputStream
> & rOutputStream
,
730 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
731 throw ( DAVException
)
735 // Make stream seekable, if it not. Needed, if request must be retried.
736 uno::Reference
< io::XInputStream
> xSeekableStream
737 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
738 rInputStream
, m_xSMgr
);
746 resetInputStream( xSeekableStream
);
752 DAVRequestHeaders aHeaders
;
753 getUserRequestHeaders( xEnv
,
755 rtl::OUString::createFromAscii( "POST" ),
758 m_xSession
->POST( getRequestURI(),
763 DAVRequestEnvironment(
765 new DAVAuthListener_Impl( xEnv
),
768 catch ( DAVException
& e
)
771 bRetry
= handleException( e
, errorCount
);
775 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
777 // #i74980# - Upon POST redirect, do a GET.
778 GET( rOutputStream
, xEnv
);
786 //=========================================================================
787 void DAVResourceAccess::MKCOL(
788 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
789 throw( DAVException
)
799 DAVRequestHeaders aHeaders
;
800 getUserRequestHeaders( xEnv
,
802 rtl::OUString::createFromAscii( "MKCOL" ),
805 m_xSession
->MKCOL( getRequestURI(),
806 DAVRequestEnvironment(
808 new DAVAuthListener_Impl( xEnv
),
811 catch ( DAVException
& e
)
814 bRetry
= handleException( e
, errorCount
);
822 //=========================================================================
823 void DAVResourceAccess::COPY(
824 const ::rtl::OUString
& rSourcePath
,
825 const ::rtl::OUString
& rDestinationURI
,
827 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
828 throw( DAVException
)
838 DAVRequestHeaders aHeaders
;
839 getUserRequestHeaders( xEnv
,
841 rtl::OUString::createFromAscii( "COPY" ),
844 m_xSession
->COPY( rSourcePath
,
846 DAVRequestEnvironment(
848 new DAVAuthListener_Impl( xEnv
),
852 catch ( DAVException
& e
)
855 bRetry
= handleException( e
, errorCount
);
863 //=========================================================================
864 void DAVResourceAccess::MOVE(
865 const ::rtl::OUString
& rSourcePath
,
866 const ::rtl::OUString
& rDestinationURI
,
868 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
869 throw( DAVException
)
879 DAVRequestHeaders aHeaders
;
880 getUserRequestHeaders( xEnv
,
882 rtl::OUString::createFromAscii( "MOVE" ),
885 m_xSession
->MOVE( rSourcePath
,
887 DAVRequestEnvironment(
889 new DAVAuthListener_Impl( xEnv
),
893 catch ( DAVException
& e
)
896 bRetry
= handleException( e
, errorCount
);
904 //=========================================================================
905 void DAVResourceAccess::DESTROY(
906 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
907 throw( DAVException
)
918 DAVRequestHeaders aHeaders
;
919 getUserRequestHeaders( xEnv
,
921 rtl::OUString::createFromAscii(
925 m_xSession
->DESTROY( getRequestURI(),
926 DAVRequestEnvironment(
928 new DAVAuthListener_Impl( xEnv
),
931 catch ( DAVException
& e
)
934 bRetry
= handleException( e
, errorCount
);
942 //=========================================================================
943 void DAVResourceAccess::LOCK (
945 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
946 throw( DAVException
)
950 DAVRequestHeaders aHeaders
;
951 getUserRequestHeaders( xEnv
,
953 rtl::OUString::createFromAscii( "LOCK" ),
956 m_xSession
->LOCK( rLock
,
957 DAVRequestEnvironment(
959 new DAVAuthListener_Impl( xEnv
),
963 //=========================================================================
964 void DAVResourceAccess::UNLOCK (
966 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
967 throw( DAVException
)
971 DAVRequestHeaders aHeaders
;
972 getUserRequestHeaders( xEnv
,
974 rtl::OUString::createFromAscii( "UNLOCK" ),
977 m_xSession
->UNLOCK( rLock
,
978 DAVRequestEnvironment(
980 new DAVAuthListener_Impl( xEnv
),
984 //=========================================================================
985 void DAVResourceAccess::setURL( const rtl::OUString
& rNewURL
)
986 throw( DAVException
)
988 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
990 m_aPath
= rtl::OUString(); // Next initialize() will create new session.
993 //=========================================================================
994 // init dav session and path
995 void DAVResourceAccess::initialize()
996 throw ( DAVException
)
998 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
999 if ( m_aPath
.getLength() == 0 )
1001 NeonUri
aURI( m_aURL
);
1002 rtl::OUString
aPath( aURI
.GetPath() );
1004 /* #134089# - Check URI */
1005 if ( !aPath
.getLength() )
1006 throw DAVException( DAVException::DAV_INVALID_ARG
);
1008 /* #134089# - Check URI */
1009 if ( !aURI
.GetHost().getLength() )
1010 throw DAVException( DAVException::DAV_INVALID_ARG
);
1012 if ( !m_xSession
.is() || !m_xSession
->CanUse( m_aURL
) )
1016 // create new webdav session
1018 = m_xSessionFactory
->createDAVSession( m_aURL
, m_xSMgr
);
1020 if ( !m_xSession
.is() )
1024 // Own URI is needed for redirect cycle detection.
1025 m_aRedirectURIs
.push_back( aURI
);
1030 // Not only the path has to be encoded
1031 m_aURL
= aURI
.GetURI();
1035 //=========================================================================
1036 const rtl::OUString
& DAVResourceAccess::getRequestURI() const
1038 OSL_ENSURE( m_xSession
.is(),
1039 "DAVResourceAccess::getRequestURI - Not initialized!" );
1041 // In case a proxy is used we have to use the absolute URI for a request.
1042 if ( m_xSession
->UsesProxy() )
1048 //=========================================================================
1050 void DAVResourceAccess::getUserRequestHeaders(
1051 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
,
1052 const rtl::OUString
& rURI
,
1053 const rtl::OUString
& rMethod
,
1054 DAVRequestHeaders
& rRequestHeaders
)
1058 uno::Reference
< ucb::XWebDAVCommandEnvironment
> xDAVEnv(
1059 xEnv
, uno::UNO_QUERY
);
1063 uno::Sequence
< beans::NamedValue
> aRequestHeaders
1064 = xDAVEnv
->getUserRequestHeaders( rURI
, rMethod
);
1066 for ( sal_Int32 n
= 0; n
< aRequestHeaders
.getLength(); ++n
)
1068 rtl::OUString aValue
;
1069 sal_Bool isString
= aRequestHeaders
[ n
].Value
>>= aValue
;
1073 OSL_ENSURE( isString
,
1074 "DAVResourceAccess::getUserRequestHeaders :"
1075 "Value is not a string! Ignoring..." );
1078 rRequestHeaders
.push_back( DAVRequestHeader(
1079 aRequestHeaders
[ n
].Name
,
1087 com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
> DAVResourceAccess::createCommandEnvironment( void )
1089 uno::Reference
< lang::XMultiServiceFactory
> xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY
);
1090 uno::Reference
< task::XInteractionHandler
> xInteractionHandler
= uno::Reference
< task::XInteractionHandler
> (
1091 xFactory
->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), uno::UNO_QUERY
);
1092 ucbhelper::CommandEnvironment
* pCommandEnv
= new ::ucbhelper::CommandEnvironment( xInteractionHandler
, uno::Reference
< ucb::XProgressHandler
>() );
1094 return uno::Reference
< ucb::XCommandEnvironment
>( static_cast< ucb::XCommandEnvironment
* >( pCommandEnv
), uno::UNO_QUERY
);
1098 //=========================================================================
1099 sal_Bool
DAVResourceAccess::detectRedirectCycle(
1100 const rtl::OUString
& rRedirectURL
)
1101 throw ( DAVException
)
1103 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1105 NeonUri
aUri( rRedirectURL
);
1107 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1108 std::vector
< NeonUri
>::const_iterator end
= m_aRedirectURIs
.end();
1112 if ( aUri
== (*it
) )
1121 //=========================================================================
1122 void DAVResourceAccess::resetUri()
1124 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1125 if ( m_aRedirectURIs
.size() > 0 )
1127 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1129 NeonUri
aUri( (*it
) );
1130 m_aRedirectURIs
.clear();
1131 setURL ( aUri
.GetURI() );
1137 //=========================================================================
1138 sal_Bool
DAVResourceAccess::handleException( DAVException
& e
, int errorCount
)
1139 throw ( DAVException
)
1141 switch ( e
.getError() )
1143 case DAVException::DAV_HTTP_REDIRECT
:
1144 if ( !detectRedirectCycle( e
.getData() ) )
1146 // set new URL and path.
1147 setURL( e
.getData() );
1152 // --> tkr #67048# copy & paste images doesn't display.
1153 // if we have a bad connection try again. Up to three times.
1154 case DAVException::DAV_HTTP_ERROR
:
1155 // retry up to three times, if not a client-side error.
1156 if ( ( e
.getStatus() < 400 || e
.getStatus() > 499 ) && errorCount
< 3)
1162 // --> tkr: if connection has said retry then retry!
1163 case DAVException::DAV_HTTP_RETRY
:
1167 return sal_False
; // Abort