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 sal_Bool bAllowPersistentStoring
,
67 sal_Bool bCanUseSystemCredentials
)
69 uno::Reference
< task::XInteractionHandler
> xIH
;
73 xIH
= m_xEnv
->getInteractionHandler();
77 xIH
= DAVResourceAccess::createCommandEnvironment()->getInteractionHandler();
82 // #102871# - Supply username and password from previous try.
83 // Password container service depends on this!
84 if ( inoutUserName
.getLength() == 0 )
85 inoutUserName
= m_aPrevUsername
;
87 if ( outPassWord
.getLength() == 0 )
88 outPassWord
= m_aPrevPassword
;
90 rtl::Reference
< ucbhelper::SimpleAuthenticationRequest
> xRequest
91 = new ucbhelper::SimpleAuthenticationRequest( m_aURL
,
97 bAllowPersistentStoring
,
98 bCanUseSystemCredentials
);
99 xIH
->handle( xRequest
.get() );
101 rtl::Reference
< ucbhelper::InteractionContinuation
> xSelection
102 = xRequest
->getSelection();
104 if ( xSelection
.is() )
106 // Handler handled the request.
107 uno::Reference
< task::XInteractionAbort
> xAbort(
108 xSelection
.get(), uno::UNO_QUERY
);
111 const rtl::Reference
<
112 ucbhelper::InteractionSupplyAuthentication
> & xSupp
113 = xRequest
->getAuthenticationSupplier();
115 sal_Bool bUseSystemCredentials
= sal_False
;
117 if ( bCanUseSystemCredentials
)
118 bUseSystemCredentials
= xSupp
->getUseSystemCredentials();
120 if ( bUseSystemCredentials
)
122 // This is the (strange) way to tell neon to use
123 // system credentials.
124 inoutUserName
= rtl::OUString();
125 outPassWord
= rtl::OUString();
129 inoutUserName
= xSupp
->getUserName();
130 outPassWord
= xSupp
->getPassword();
133 // #102871# - Remember username and password.
134 m_aPrevUsername
= inoutUserName
;
135 m_aPrevPassword
= outPassWord
;
147 //=========================================================================
148 //=========================================================================
150 // DAVResourceAccess Implementation.
152 //=========================================================================
153 //=========================================================================
155 //=========================================================================
156 DAVResourceAccess::DAVResourceAccess(
157 const uno::Reference
< lang::XMultiServiceFactory
> & rSMgr
,
158 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
,
159 const rtl::OUString
& rURL
)
161 m_xSessionFactory( rSessionFactory
),
166 //=========================================================================
167 DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess
& rOther
)
168 : m_aURL( rOther
.m_aURL
),
169 m_aPath( rOther
.m_aPath
),
170 m_xSession( rOther
.m_xSession
),
171 m_xSessionFactory( rOther
.m_xSessionFactory
),
172 m_xSMgr( rOther
.m_xSMgr
),
173 m_aRedirectURIs( rOther
.m_aRedirectURIs
)
177 //=========================================================================
178 DAVResourceAccess
& DAVResourceAccess::operator=(
179 const DAVResourceAccess
& rOther
)
181 m_aURL
= rOther
.m_aURL
;
182 m_aPath
= rOther
.m_aPath
;
183 m_xSession
= rOther
.m_xSession
;
184 m_xSessionFactory
= rOther
.m_xSessionFactory
;
185 m_xSMgr
= rOther
.m_xSMgr
;
186 m_aRedirectURIs
= rOther
.m_aRedirectURIs
;
191 //=========================================================================
192 void DAVResourceAccess::OPTIONS(
193 DAVCapabilities
& rCapabilities
,
194 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
195 throw( DAVException
)
206 DAVRequestHeaders aHeaders
;
207 getUserRequestHeaders( xEnv
,
209 rtl::OUString::createFromAscii(
213 m_xSession
->OPTIONS( getRequestURI(),
215 DAVRequestEnvironment(
217 new DAVAuthListener_Impl( xEnv
, m_aURL
),
220 catch ( DAVException
& e
)
223 bRetry
= handleException( e
, errorCount
);
231 //=========================================================================
232 void DAVResourceAccess::PROPFIND(
234 const std::vector
< rtl::OUString
> & rPropertyNames
,
235 std::vector
< DAVResource
> & rResources
,
236 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
237 throw( DAVException
)
248 DAVRequestHeaders aHeaders
;
250 getUserRequestHeaders( xEnv
,
252 rtl::OUString::createFromAscii(
256 m_xSession
->PROPFIND( getRequestURI(),
260 DAVRequestEnvironment(
262 new DAVAuthListener_Impl( xEnv
, m_aURL
),
265 catch ( DAVException
& e
)
268 bRetry
= handleException( e
, errorCount
);
276 //=========================================================================
277 void DAVResourceAccess::PROPFIND(
279 std::vector
< DAVResourceInfo
> & rResInfo
,
280 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
281 throw( DAVException
)
292 DAVRequestHeaders aHeaders
;
293 getUserRequestHeaders( xEnv
,
295 rtl::OUString::createFromAscii(
299 m_xSession
->PROPFIND( getRequestURI(),
302 DAVRequestEnvironment(
304 new DAVAuthListener_Impl( xEnv
, m_aURL
),
307 catch ( DAVException
& e
)
310 bRetry
= handleException( e
, errorCount
);
318 //=========================================================================
319 void DAVResourceAccess::PROPPATCH(
320 const std::vector
< ProppatchValue
>& rValues
,
321 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
322 throw( DAVException
)
333 DAVRequestHeaders aHeaders
;
334 getUserRequestHeaders( xEnv
,
336 rtl::OUString::createFromAscii(
340 m_xSession
->PROPPATCH( getRequestURI(),
342 DAVRequestEnvironment(
344 new DAVAuthListener_Impl( xEnv
, m_aURL
),
347 catch ( DAVException
& e
)
350 bRetry
= handleException( e
, errorCount
);
358 //=========================================================================
359 void DAVResourceAccess::HEAD(
360 const std::vector
< rtl::OUString
> & rHeaderNames
,
361 DAVResource
& rResource
,
362 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
363 throw( DAVException
)
373 DAVRequestHeaders aHeaders
;
374 getUserRequestHeaders( xEnv
,
376 rtl::OUString::createFromAscii( "HEAD" ),
379 m_xSession
->HEAD( getRequestURI(),
382 DAVRequestEnvironment(
384 new DAVAuthListener_Impl( xEnv
, m_aURL
),
387 catch ( DAVException
& e
)
390 bRetry
= handleException( e
, errorCount
);
398 //=========================================================================
399 uno::Reference
< io::XInputStream
> DAVResourceAccess::GET(
400 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
401 throw( DAVException
)
405 uno::Reference
< io::XInputStream
> xStream
;
413 DAVRequestHeaders aHeaders
;
414 getUserRequestHeaders( xEnv
,
416 rtl::OUString::createFromAscii( "GET" ),
419 xStream
= m_xSession
->GET( getRequestURI(),
420 DAVRequestEnvironment(
422 new DAVAuthListener_Impl( xEnv
, m_aURL
),
425 catch ( DAVException
& e
)
428 bRetry
= handleException( e
, errorCount
);
438 //=========================================================================
439 void DAVResourceAccess::GET(
440 uno::Reference
< io::XOutputStream
> & rStream
,
441 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
442 throw( DAVException
)
453 DAVRequestHeaders aHeaders
;
454 getUserRequestHeaders( xEnv
,
456 rtl::OUString::createFromAscii( "GET" ),
459 m_xSession
->GET( getRequestURI(),
461 DAVRequestEnvironment(
463 new DAVAuthListener_Impl( xEnv
, m_aURL
),
466 catch ( DAVException
& e
)
469 bRetry
= handleException( e
, errorCount
);
477 //=========================================================================
478 uno::Reference
< io::XStream
> DAVResourceAccess::GET(
479 const std::vector
< rtl::OUString
> & rHeaderNames
,
480 DAVResource
& rResource
,
481 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
,
482 sal_Bool bAllowEmpty
)
483 throw( DAVException
)
487 uno::Reference
< io::XStream
> xStream
;
495 DAVRequestHeaders aHeaders
;
496 getUserRequestHeaders( xEnv
,
498 rtl::OUString::createFromAscii( "GET" ),
501 xStream
= m_xSession
->GET( getRequestURI(),
504 DAVRequestEnvironment(
506 new DAVAuthListener_Impl( xEnv
, m_aURL
),
510 catch ( DAVException
& e
)
513 bRetry
= handleException( e
, errorCount
);
523 //=========================================================================
524 void DAVResourceAccess::GET(
525 uno::Reference
< io::XOutputStream
> & rStream
,
526 const std::vector
< rtl::OUString
> & rHeaderNames
,
527 DAVResource
& rResource
,
528 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
529 throw( DAVException
)
540 DAVRequestHeaders aHeaders
;
541 getUserRequestHeaders( xEnv
,
543 rtl::OUString::createFromAscii( "GET" ),
546 m_xSession
->GET( getRequestURI(),
550 DAVRequestEnvironment(
552 new DAVAuthListener_Impl( xEnv
, m_aURL
),
555 catch ( DAVException
& e
)
558 bRetry
= handleException( e
, errorCount
);
566 //=========================================================================
567 void DAVResourceAccess::ABORT()
568 throw( DAVException
)
573 //=========================================================================
576 void resetInputStream( const uno::Reference
< io::XInputStream
> & rStream
)
577 throw( DAVException
)
581 uno::Reference
< io::XSeekable
> xSeekable(
582 rStream
, uno::UNO_QUERY
);
583 if ( xSeekable
.is() )
585 xSeekable
->seek( 0 );
589 catch ( lang::IllegalArgumentException
const & )
592 catch ( io::IOException
const & )
596 throw DAVException( DAVException::DAV_INVALID_ARG
);
601 //=========================================================================
602 void DAVResourceAccess::PUT(
603 const uno::Reference
< io::XInputStream
> & rStream
,
604 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
605 throw( DAVException
)
609 // Make stream seekable, if it not. Needed, if request must be retried.
610 uno::Reference
< io::XInputStream
> xSeekableStream
611 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
619 resetInputStream( xSeekableStream
);
624 DAVRequestHeaders aHeaders
;
625 getUserRequestHeaders( xEnv
,
627 rtl::OUString::createFromAscii( "PUT" ),
630 m_xSession
->PUT( getRequestURI(),
632 DAVRequestEnvironment(
634 new DAVAuthListener_Impl( xEnv
, m_aURL
),
637 catch ( DAVException
& e
)
640 bRetry
= handleException( e
, errorCount
);
648 //=========================================================================
649 void DAVResourceAccess::PUT(
650 const char * buffer
, size_t size
,
651 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
652 throw( DAVException
)
663 DAVRequestHeaders aHeaders
;
664 getUserRequestHeaders( xEnv
,
666 rtl::OUString::createFromAscii( "PUT" ),
669 m_xSession
->PUT( getRequestURI(),
671 DAVRequestEnvironment(
673 new DAVAuthListener_Impl( xEnv
, m_aURL
),
676 catch ( DAVException
& e
)
679 bRetry
= handleException( e
, errorCount
);
687 //=========================================================================
688 uno::Reference
< io::XInputStream
> DAVResourceAccess::POST(
689 const rtl::OUString
& rContentType
,
690 const rtl::OUString
& rReferer
,
691 const uno::Reference
< io::XInputStream
> & rInputStream
,
692 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
693 throw ( DAVException
)
697 // Make stream seekable, if it not. Needed, if request must be retried.
698 uno::Reference
< io::XInputStream
> xSeekableStream
699 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
700 rInputStream
, m_xSMgr
);
702 uno::Reference
< io::XInputStream
> xStream
;
709 resetInputStream( xSeekableStream
);
715 DAVRequestHeaders aHeaders
;
716 getUserRequestHeaders( xEnv
,
718 rtl::OUString::createFromAscii( "POST" ),
721 xStream
= m_xSession
->POST( getRequestURI(),
725 DAVRequestEnvironment(
727 new DAVAuthListener_Impl( xEnv
, m_aURL
),
730 catch ( DAVException
& e
)
733 bRetry
= handleException( e
, errorCount
);
737 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
739 // #i74980# - Upon POST redirect, do a GET.
749 //=========================================================================
751 void DAVResourceAccess::POST(
752 const rtl::OUString
& rContentType
,
753 const rtl::OUString
& rReferer
,
754 const uno::Reference
< io::XInputStream
> & rInputStream
,
755 uno::Reference
< io::XOutputStream
> & rOutputStream
,
756 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
757 throw ( DAVException
)
761 // Make stream seekable, if it not. Needed, if request must be retried.
762 uno::Reference
< io::XInputStream
> xSeekableStream
763 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
764 rInputStream
, m_xSMgr
);
772 resetInputStream( xSeekableStream
);
778 DAVRequestHeaders aHeaders
;
779 getUserRequestHeaders( xEnv
,
781 rtl::OUString::createFromAscii( "POST" ),
784 m_xSession
->POST( getRequestURI(),
789 DAVRequestEnvironment(
791 new DAVAuthListener_Impl( xEnv
, m_aURL
),
794 catch ( DAVException
& e
)
797 bRetry
= handleException( e
, errorCount
);
801 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
803 // #i74980# - Upon POST redirect, do a GET.
804 GET( rOutputStream
, xEnv
);
812 //=========================================================================
813 void DAVResourceAccess::MKCOL(
814 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
815 throw( DAVException
)
825 DAVRequestHeaders aHeaders
;
826 getUserRequestHeaders( xEnv
,
828 rtl::OUString::createFromAscii( "MKCOL" ),
831 m_xSession
->MKCOL( getRequestURI(),
832 DAVRequestEnvironment(
834 new DAVAuthListener_Impl( xEnv
, m_aURL
),
837 catch ( DAVException
& e
)
840 bRetry
= handleException( e
, errorCount
);
848 //=========================================================================
849 void DAVResourceAccess::COPY(
850 const ::rtl::OUString
& rSourcePath
,
851 const ::rtl::OUString
& rDestinationURI
,
853 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
854 throw( DAVException
)
864 DAVRequestHeaders aHeaders
;
865 getUserRequestHeaders( xEnv
,
867 rtl::OUString::createFromAscii( "COPY" ),
870 m_xSession
->COPY( rSourcePath
,
872 DAVRequestEnvironment(
874 new DAVAuthListener_Impl( xEnv
, m_aURL
),
878 catch ( DAVException
& e
)
881 bRetry
= handleException( e
, errorCount
);
889 //=========================================================================
890 void DAVResourceAccess::MOVE(
891 const ::rtl::OUString
& rSourcePath
,
892 const ::rtl::OUString
& rDestinationURI
,
894 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
895 throw( DAVException
)
905 DAVRequestHeaders aHeaders
;
906 getUserRequestHeaders( xEnv
,
908 rtl::OUString::createFromAscii( "MOVE" ),
911 m_xSession
->MOVE( rSourcePath
,
913 DAVRequestEnvironment(
915 new DAVAuthListener_Impl( xEnv
, m_aURL
),
919 catch ( DAVException
& e
)
922 bRetry
= handleException( e
, errorCount
);
930 //=========================================================================
931 void DAVResourceAccess::DESTROY(
932 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
933 throw( DAVException
)
944 DAVRequestHeaders aHeaders
;
945 getUserRequestHeaders( xEnv
,
947 rtl::OUString::createFromAscii(
951 m_xSession
->DESTROY( getRequestURI(),
952 DAVRequestEnvironment(
954 new DAVAuthListener_Impl( xEnv
, m_aURL
),
957 catch ( DAVException
& e
)
960 bRetry
= handleException( e
, errorCount
);
968 //=========================================================================
969 void DAVResourceAccess::LOCK (
971 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
972 throw( DAVException
)
976 DAVRequestHeaders aHeaders
;
977 getUserRequestHeaders( xEnv
,
979 rtl::OUString::createFromAscii( "LOCK" ),
982 m_xSession
->LOCK( rLock
,
983 DAVRequestEnvironment(
985 new DAVAuthListener_Impl( xEnv
, m_aURL
),
989 //=========================================================================
990 void DAVResourceAccess::UNLOCK (
992 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
993 throw( DAVException
)
997 DAVRequestHeaders aHeaders
;
998 getUserRequestHeaders( xEnv
,
1000 rtl::OUString::createFromAscii( "UNLOCK" ),
1003 m_xSession
->UNLOCK( rLock
,
1004 DAVRequestEnvironment(
1006 new DAVAuthListener_Impl( xEnv
, m_aURL
),
1010 //=========================================================================
1011 void DAVResourceAccess::setURL( const rtl::OUString
& rNewURL
)
1012 throw( DAVException
)
1014 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1016 m_aPath
= rtl::OUString(); // Next initialize() will create new session.
1019 //=========================================================================
1020 // init dav session and path
1021 void DAVResourceAccess::initialize()
1022 throw ( DAVException
)
1024 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1025 if ( m_aPath
.getLength() == 0 )
1027 NeonUri
aURI( m_aURL
);
1028 rtl::OUString
aPath( aURI
.GetPath() );
1030 /* #134089# - Check URI */
1031 if ( !aPath
.getLength() )
1032 throw DAVException( DAVException::DAV_INVALID_ARG
);
1034 /* #134089# - Check URI */
1035 if ( !aURI
.GetHost().getLength() )
1036 throw DAVException( DAVException::DAV_INVALID_ARG
);
1038 if ( !m_xSession
.is() || !m_xSession
->CanUse( m_aURL
) )
1042 // create new webdav session
1044 = m_xSessionFactory
->createDAVSession( m_aURL
, m_xSMgr
);
1046 if ( !m_xSession
.is() )
1050 // Own URI is needed for redirect cycle detection.
1051 m_aRedirectURIs
.push_back( aURI
);
1056 // Not only the path has to be encoded
1057 m_aURL
= aURI
.GetURI();
1061 //=========================================================================
1062 const rtl::OUString
& DAVResourceAccess::getRequestURI() const
1064 OSL_ENSURE( m_xSession
.is(),
1065 "DAVResourceAccess::getRequestURI - Not initialized!" );
1067 // In case a proxy is used we have to use the absolute URI for a request.
1068 if ( m_xSession
->UsesProxy() )
1074 //=========================================================================
1076 void DAVResourceAccess::getUserRequestHeaders(
1077 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
,
1078 const rtl::OUString
& rURI
,
1079 const rtl::OUString
& rMethod
,
1080 DAVRequestHeaders
& rRequestHeaders
)
1084 uno::Reference
< ucb::XWebDAVCommandEnvironment
> xDAVEnv(
1085 xEnv
, uno::UNO_QUERY
);
1089 uno::Sequence
< beans::NamedValue
> aRequestHeaders
1090 = xDAVEnv
->getUserRequestHeaders( rURI
, rMethod
);
1092 for ( sal_Int32 n
= 0; n
< aRequestHeaders
.getLength(); ++n
)
1094 rtl::OUString aValue
;
1095 sal_Bool isString
= aRequestHeaders
[ n
].Value
>>= aValue
;
1099 OSL_ENSURE( isString
,
1100 "DAVResourceAccess::getUserRequestHeaders :"
1101 "Value is not a string! Ignoring..." );
1104 rRequestHeaders
.push_back( DAVRequestHeader(
1105 aRequestHeaders
[ n
].Name
,
1113 com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
> DAVResourceAccess::createCommandEnvironment( void )
1115 uno::Reference
< lang::XMultiServiceFactory
> xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY
);
1116 uno::Reference
< task::XInteractionHandler
> xInteractionHandler
= uno::Reference
< task::XInteractionHandler
> (
1117 xFactory
->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), uno::UNO_QUERY
);
1118 ucbhelper::CommandEnvironment
* pCommandEnv
= new ::ucbhelper::CommandEnvironment( xInteractionHandler
, uno::Reference
< ucb::XProgressHandler
>() );
1120 return uno::Reference
< ucb::XCommandEnvironment
>( static_cast< ucb::XCommandEnvironment
* >( pCommandEnv
), uno::UNO_QUERY
);
1124 //=========================================================================
1125 sal_Bool
DAVResourceAccess::detectRedirectCycle(
1126 const rtl::OUString
& rRedirectURL
)
1127 throw ( DAVException
)
1129 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1131 NeonUri
aUri( rRedirectURL
);
1133 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1134 std::vector
< NeonUri
>::const_iterator end
= m_aRedirectURIs
.end();
1138 if ( aUri
== (*it
) )
1147 //=========================================================================
1148 void DAVResourceAccess::resetUri()
1150 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1151 if ( m_aRedirectURIs
.size() > 0 )
1153 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1155 NeonUri
aUri( (*it
) );
1156 m_aRedirectURIs
.clear();
1157 setURL ( aUri
.GetURI() );
1163 //=========================================================================
1164 sal_Bool
DAVResourceAccess::handleException( DAVException
& e
, int errorCount
)
1165 throw ( DAVException
)
1167 switch ( e
.getError() )
1169 case DAVException::DAV_HTTP_REDIRECT
:
1170 if ( !detectRedirectCycle( e
.getData() ) )
1172 // set new URL and path.
1173 setURL( e
.getData() );
1178 // --> tkr #67048# copy & paste images doesn't display.
1179 // if we have a bad connection try again. Up to three times.
1180 case DAVException::DAV_HTTP_ERROR
:
1181 // retry up to three times, if not a client-side error.
1182 if ( ( e
.getStatus() < 400 || e
.getStatus() > 499 ) && errorCount
< 3)
1188 // --> tkr: if connection has said retry then retry!
1189 case DAVException::DAV_HTTP_RETRY
:
1193 return sal_False
; // Abort