1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "osl/diagnose.h"
32 #include "com/sun/star/task/XInteractionAbort.hpp"
33 #include "com/sun/star/ucb/XWebDAVCommandEnvironment.hpp"
35 #include "ucbhelper/simpleauthenticationrequest.hxx"
36 #include "comphelper/seekableinput.hxx"
38 #include "DAVAuthListenerImpl.hxx"
39 #include "DAVResourceAccess.hxx"
41 using namespace webdav_ucp
;
42 using namespace com::sun::star
;
44 //=========================================================================
45 //=========================================================================
47 // DAVAuthListener_Impl Implementation.
49 //=========================================================================
50 //=========================================================================
52 //=========================================================================
54 int DAVAuthListener_Impl::authenticate(
55 const ::rtl::OUString
& inRealm
,
56 const ::rtl::OUString
& inHostName
,
57 ::rtl::OUString
& inoutUserName
,
58 ::rtl::OUString
& outPassWord
,
59 sal_Bool bCanUseSystemCredentials
)
63 uno::Reference
< task::XInteractionHandler
> xIH
64 = m_xEnv
->getInteractionHandler();
68 // #102871# - Supply username and password from previous try.
69 // Password container service depends on this!
70 if ( inoutUserName
.isEmpty() )
71 inoutUserName
= m_aPrevUsername
;
73 if ( outPassWord
.isEmpty() )
74 outPassWord
= m_aPrevPassword
;
76 rtl::Reference
< ucbhelper::SimpleAuthenticationRequest
> xRequest
77 = new ucbhelper::SimpleAuthenticationRequest(
78 m_aURL
, inHostName
, inRealm
, inoutUserName
,
79 outPassWord
, ::rtl::OUString(),
80 true /*bAllowPersistentStoring*/,
81 bCanUseSystemCredentials
);
82 xIH
->handle( xRequest
.get() );
84 rtl::Reference
< ucbhelper::InteractionContinuation
> xSelection
85 = xRequest
->getSelection();
87 if ( xSelection
.is() )
89 // Handler handled the request.
90 uno::Reference
< task::XInteractionAbort
> xAbort(
91 xSelection
.get(), uno::UNO_QUERY
);
95 ucbhelper::InteractionSupplyAuthentication
> & xSupp
96 = xRequest
->getAuthenticationSupplier();
98 sal_Bool bUseSystemCredentials
= sal_False
;
100 if ( bCanUseSystemCredentials
)
101 bUseSystemCredentials
102 = xSupp
->getUseSystemCredentials();
104 if ( bUseSystemCredentials
)
106 // This is the (strange) way to tell neon to use
107 // system credentials.
108 inoutUserName
= rtl::OUString();
109 outPassWord
= rtl::OUString();
113 inoutUserName
= xSupp
->getUserName();
114 outPassWord
= xSupp
->getPassword();
117 // #102871# - Remember username and password.
118 m_aPrevUsername
= inoutUserName
;
119 m_aPrevPassword
= outPassWord
;
131 //=========================================================================
132 //=========================================================================
134 // DAVResourceAccess Implementation.
136 //=========================================================================
137 //=========================================================================
139 //=========================================================================
140 DAVResourceAccess::DAVResourceAccess(
141 const uno::Reference
< lang::XMultiServiceFactory
> & rSMgr
,
142 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
,
143 const rtl::OUString
& rURL
)
145 m_xSessionFactory( rSessionFactory
),
150 //=========================================================================
151 DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess
& rOther
)
152 : m_aURL( rOther
.m_aURL
),
153 m_aPath( rOther
.m_aPath
),
154 m_aFlags( rOther
.m_aFlags
),
155 m_xSession( rOther
.m_xSession
),
156 m_xSessionFactory( rOther
.m_xSessionFactory
),
157 m_xSMgr( rOther
.m_xSMgr
),
158 m_aRedirectURIs( rOther
.m_aRedirectURIs
)
162 //=========================================================================
163 DAVResourceAccess
& DAVResourceAccess::operator=(
164 const DAVResourceAccess
& rOther
)
166 m_aURL
= rOther
.m_aURL
;
167 m_aPath
= rOther
.m_aPath
;
168 m_aFlags
= rOther
.m_aFlags
;
169 m_xSession
= rOther
.m_xSession
;
170 m_xSessionFactory
= rOther
.m_xSessionFactory
;
171 m_xSMgr
= rOther
.m_xSMgr
;
172 m_aRedirectURIs
= rOther
.m_aRedirectURIs
;
177 #if 0 // currently not used, but please don't remove code
178 //=========================================================================
179 void DAVResourceAccess::OPTIONS(
180 DAVCapabilities
& rCapabilities
,
181 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
182 throw( DAVException
)
193 DAVRequestHeaders aHeaders
;
194 getUserRequestHeaders( xEnv
,
196 rtl::OUString( "OPTIONS" ),
199 m_xSession
->OPTIONS( getRequestURI(),
201 DAVRequestEnvironment(
203 new DAVAuthListener_Impl( xEnv
, m_aURL
),
206 catch ( const DAVException
& e
)
209 bRetry
= handleException( e
, errorCount
);
218 //=========================================================================
219 void DAVResourceAccess::PROPFIND(
221 const std::vector
< rtl::OUString
> & rPropertyNames
,
222 std::vector
< DAVResource
> & rResources
,
223 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
224 throw( DAVException
)
235 DAVRequestHeaders aHeaders
;
237 getUserRequestHeaders( xEnv
,
239 rtl::OUString( "PROPFIND" ),
242 m_xSession
->PROPFIND( getRequestURI(),
246 DAVRequestEnvironment(
248 new DAVAuthListener_Impl( xEnv
, m_aURL
),
251 catch ( const DAVException
& e
)
254 bRetry
= handleException( e
, errorCount
);
262 //=========================================================================
263 void DAVResourceAccess::PROPFIND(
265 std::vector
< DAVResourceInfo
> & rResInfo
,
266 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
267 throw( DAVException
)
278 DAVRequestHeaders aHeaders
;
279 getUserRequestHeaders( xEnv
,
281 rtl::OUString( "PROPFIND" ),
284 m_xSession
->PROPFIND( getRequestURI(),
287 DAVRequestEnvironment(
289 new DAVAuthListener_Impl( xEnv
, m_aURL
),
292 catch ( const DAVException
& e
)
295 bRetry
= handleException( e
, errorCount
);
303 //=========================================================================
304 void DAVResourceAccess::PROPPATCH(
305 const std::vector
< ProppatchValue
>& rValues
,
306 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
307 throw( DAVException
)
318 DAVRequestHeaders aHeaders
;
319 getUserRequestHeaders( xEnv
,
321 rtl::OUString( "PROPPATCH" ),
324 m_xSession
->PROPPATCH( getRequestURI(),
326 DAVRequestEnvironment(
328 new DAVAuthListener_Impl( xEnv
, m_aURL
),
331 catch ( const DAVException
& e
)
334 bRetry
= handleException( e
, errorCount
);
342 //=========================================================================
343 void DAVResourceAccess::HEAD(
344 const std::vector
< rtl::OUString
> & rHeaderNames
,
345 DAVResource
& rResource
,
346 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
347 throw( DAVException
)
358 DAVRequestHeaders aHeaders
;
359 getUserRequestHeaders( xEnv
,
361 rtl::OUString("HEAD"),
364 m_xSession
->HEAD( getRequestURI(),
367 DAVRequestEnvironment(
369 new DAVAuthListener_Impl( xEnv
, m_aURL
),
372 catch ( const DAVException
& e
)
375 bRetry
= handleException( e
, errorCount
);
383 //=========================================================================
384 uno::Reference
< io::XInputStream
> DAVResourceAccess::GET(
385 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
386 throw( DAVException
)
390 uno::Reference
< io::XInputStream
> xStream
;
398 DAVRequestHeaders aHeaders
;
399 getUserRequestHeaders( xEnv
,
401 rtl::OUString("GET"),
404 xStream
= m_xSession
->GET( getRequestURI(),
405 DAVRequestEnvironment(
407 new DAVAuthListener_Impl(
411 catch ( const DAVException
& e
)
414 bRetry
= handleException( e
, errorCount
);
424 //=========================================================================
425 void DAVResourceAccess::GET(
426 uno::Reference
< io::XOutputStream
> & rStream
,
427 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
428 throw( DAVException
)
439 DAVRequestHeaders aHeaders
;
440 getUserRequestHeaders( xEnv
,
442 rtl::OUString("GET"),
445 m_xSession
->GET( getRequestURI(),
447 DAVRequestEnvironment(
449 new DAVAuthListener_Impl( xEnv
, m_aURL
),
452 catch ( const DAVException
& e
)
455 bRetry
= handleException( e
, errorCount
);
463 //=========================================================================
464 uno::Reference
< io::XInputStream
> DAVResourceAccess::GET(
465 const std::vector
< rtl::OUString
> & rHeaderNames
,
466 DAVResource
& rResource
,
467 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
468 throw( DAVException
)
472 uno::Reference
< io::XInputStream
> xStream
;
480 DAVRequestHeaders aHeaders
;
481 getUserRequestHeaders( xEnv
,
483 rtl::OUString("GET"),
486 xStream
= m_xSession
->GET( getRequestURI(),
489 DAVRequestEnvironment(
491 new DAVAuthListener_Impl(
495 catch ( const DAVException
& e
)
498 bRetry
= handleException( e
, errorCount
);
508 //=========================================================================
509 void DAVResourceAccess::GET(
510 uno::Reference
< io::XOutputStream
> & rStream
,
511 const std::vector
< rtl::OUString
> & rHeaderNames
,
512 DAVResource
& rResource
,
513 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
514 throw( DAVException
)
525 DAVRequestHeaders aHeaders
;
526 getUserRequestHeaders( xEnv
,
528 rtl::OUString("GET"),
531 m_xSession
->GET( getRequestURI(),
535 DAVRequestEnvironment(
537 new DAVAuthListener_Impl( xEnv
, m_aURL
),
540 catch ( const DAVException
& e
)
543 bRetry
= handleException( e
, errorCount
);
551 //=========================================================================
552 void DAVResourceAccess::abort()
553 throw( DAVException
)
555 // 17.11.09 (tkr): abort currently disabled caused by issue i106766
557 // m_xSession->abort();
558 OSL_TRACE( "Not implemented. -> #i106766#" );
561 //=========================================================================
564 void resetInputStream( const uno::Reference
< io::XInputStream
> & rStream
)
565 throw( DAVException
)
569 uno::Reference
< io::XSeekable
> xSeekable(
570 rStream
, uno::UNO_QUERY
);
571 if ( xSeekable
.is() )
573 xSeekable
->seek( 0 );
577 catch ( lang::IllegalArgumentException
const & )
580 catch ( io::IOException
const & )
584 throw DAVException( DAVException::DAV_INVALID_ARG
);
589 //=========================================================================
590 void DAVResourceAccess::PUT(
591 const uno::Reference
< io::XInputStream
> & rStream
,
592 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
593 throw( DAVException
)
597 // Make stream seekable, if it not. Needed, if request must be retried.
598 uno::Reference
< io::XInputStream
> xSeekableStream
599 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
607 resetInputStream( xSeekableStream
);
612 DAVRequestHeaders aHeaders
;
613 getUserRequestHeaders( xEnv
,
615 rtl::OUString("PUT"),
618 m_xSession
->PUT( getRequestURI(),
620 DAVRequestEnvironment(
622 new DAVAuthListener_Impl( xEnv
, m_aURL
),
625 catch ( const DAVException
& e
)
628 bRetry
= handleException( e
, errorCount
);
636 //=========================================================================
637 uno::Reference
< io::XInputStream
> DAVResourceAccess::POST(
638 const rtl::OUString
& rContentType
,
639 const rtl::OUString
& rReferer
,
640 const uno::Reference
< io::XInputStream
> & rInputStream
,
641 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
642 throw ( DAVException
)
646 // Make stream seekable, if it not. Needed, if request must be retried.
647 uno::Reference
< io::XInputStream
> xSeekableStream
648 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
649 rInputStream
, m_xSMgr
);
651 uno::Reference
< io::XInputStream
> xStream
;
658 resetInputStream( xSeekableStream
);
664 DAVRequestHeaders aHeaders
;
665 getUserRequestHeaders( xEnv
,
667 rtl::OUString("POST"),
670 xStream
= m_xSession
->POST( getRequestURI(),
674 DAVRequestEnvironment(
676 new DAVAuthListener_Impl(
680 catch ( const DAVException
& e
)
683 bRetry
= handleException( e
, errorCount
);
687 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
689 // #i74980# - Upon POST redirect, do a GET.
699 //=========================================================================
700 void DAVResourceAccess::POST(
701 const rtl::OUString
& rContentType
,
702 const rtl::OUString
& rReferer
,
703 const uno::Reference
< io::XInputStream
> & rInputStream
,
704 uno::Reference
< io::XOutputStream
> & rOutputStream
,
705 const uno::Reference
< ucb::XCommandEnvironment
>& xEnv
)
706 throw ( DAVException
)
710 // Make stream seekable, if it not. Needed, if request must be retried.
711 uno::Reference
< io::XInputStream
> xSeekableStream
712 = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
713 rInputStream
, m_xSMgr
);
721 resetInputStream( xSeekableStream
);
727 DAVRequestHeaders aHeaders
;
728 getUserRequestHeaders( xEnv
,
730 rtl::OUString("POST"),
733 m_xSession
->POST( getRequestURI(),
738 DAVRequestEnvironment(
740 new DAVAuthListener_Impl( xEnv
, m_aURL
),
743 catch ( const DAVException
& e
)
746 bRetry
= handleException( e
, errorCount
);
750 if ( e
.getError() == DAVException::DAV_HTTP_REDIRECT
)
752 // #i74980# - Upon POST redirect, do a GET.
753 GET( rOutputStream
, xEnv
);
761 //=========================================================================
762 void DAVResourceAccess::MKCOL(
763 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
764 throw( DAVException
)
775 DAVRequestHeaders aHeaders
;
776 getUserRequestHeaders( xEnv
,
778 rtl::OUString("MKCOL"),
781 m_xSession
->MKCOL( getRequestURI(),
782 DAVRequestEnvironment(
784 new DAVAuthListener_Impl( xEnv
, m_aURL
),
787 catch ( const DAVException
& e
)
790 bRetry
= handleException( e
, errorCount
);
798 //=========================================================================
799 void DAVResourceAccess::COPY(
800 const ::rtl::OUString
& rSourcePath
,
801 const ::rtl::OUString
& rDestinationURI
,
803 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
804 throw( DAVException
)
815 DAVRequestHeaders aHeaders
;
816 getUserRequestHeaders( xEnv
,
818 rtl::OUString("COPY"),
821 m_xSession
->COPY( rSourcePath
,
823 DAVRequestEnvironment(
825 new DAVAuthListener_Impl( xEnv
, m_aURL
),
829 catch ( const DAVException
& e
)
832 bRetry
= handleException( e
, errorCount
);
840 //=========================================================================
841 void DAVResourceAccess::MOVE(
842 const ::rtl::OUString
& rSourcePath
,
843 const ::rtl::OUString
& rDestinationURI
,
845 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
846 throw( DAVException
)
857 DAVRequestHeaders aHeaders
;
858 getUserRequestHeaders( xEnv
,
860 rtl::OUString("MOVE"),
863 m_xSession
->MOVE( rSourcePath
,
865 DAVRequestEnvironment(
867 new DAVAuthListener_Impl( xEnv
, m_aURL
),
871 catch ( const DAVException
& e
)
874 bRetry
= handleException( e
, errorCount
);
882 //=========================================================================
883 void DAVResourceAccess::DESTROY(
884 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
885 throw( DAVException
)
896 DAVRequestHeaders aHeaders
;
897 getUserRequestHeaders( xEnv
,
899 rtl::OUString( "DESTROY" ),
902 m_xSession
->DESTROY( getRequestURI(),
903 DAVRequestEnvironment(
905 new DAVAuthListener_Impl( xEnv
, m_aURL
),
908 catch ( const DAVException
& e
)
911 bRetry
= handleException( e
, errorCount
);
919 //=========================================================================
921 void DAVResourceAccess::LOCK(
923 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
924 throw ( DAVException
)
935 DAVRequestHeaders aHeaders
;
936 getUserRequestHeaders( xEnv
,
938 rtl::OUString("LOCK"),
941 m_xSession
->LOCK( getRequestURI(),
943 DAVRequestEnvironment(
945 new DAVAuthListener_Impl( xEnv
, m_aURL
),
948 catch ( const DAVException
& e
)
951 bRetry
= handleException( e
, errorCount
);
959 #if 0 // currently not used, but please don't remove code
960 //=========================================================================
961 // refresh existing lock.
962 sal_Int64
DAVResourceAccess::LOCK(
964 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
965 throw ( DAVException
)
969 sal_Int64 nNewTimeout
= 0;
977 DAVRequestHeaders aHeaders
;
978 getUserRequestHeaders( xEnv
,
980 rtl::OUString("LOCK"),
983 nNewTimeout
= m_xSession
->LOCK( getRequestURI(),
985 DAVRequestEnvironment(
987 new DAVAuthListener_Impl(
991 catch ( const DAVException
& e
)
994 bRetry
= handleException( e
, errorCount
);
1005 //=========================================================================
1006 void DAVResourceAccess::UNLOCK(
1007 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
)
1008 throw ( DAVException
)
1019 DAVRequestHeaders aHeaders
;
1020 getUserRequestHeaders( xEnv
,
1022 rtl::OUString("UNLOCK"),
1025 m_xSession
->UNLOCK( getRequestURI(),
1026 DAVRequestEnvironment(
1028 new DAVAuthListener_Impl( xEnv
, m_aURL
),
1031 catch ( const DAVException
& e
)
1034 bRetry
= handleException( e
, errorCount
);
1042 //=========================================================================
1043 void DAVResourceAccess::setFlags( const uno::Sequence
< beans::NamedValue
>& rFlags
)
1044 throw ( DAVException
)
1046 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1050 //=========================================================================
1051 void DAVResourceAccess::setURL( const rtl::OUString
& rNewURL
)
1052 throw( DAVException
)
1054 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1056 m_aPath
= rtl::OUString(); // Next initialize() will create new session.
1059 //=========================================================================
1060 // init dav session and path
1061 void DAVResourceAccess::initialize()
1062 throw ( DAVException
)
1064 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1065 if ( m_aPath
.isEmpty() )
1067 NeonUri
aURI( m_aURL
);
1068 rtl::OUString
aPath( aURI
.GetPath() );
1070 /* #134089# - Check URI */
1071 if ( aPath
.isEmpty() )
1072 throw DAVException( DAVException::DAV_INVALID_ARG
);
1074 /* #134089# - Check URI */
1075 if ( aURI
.GetHost().isEmpty() )
1076 throw DAVException( DAVException::DAV_INVALID_ARG
);
1078 if ( !m_xSession
.is() || !m_xSession
->CanUse( m_aURL
, m_aFlags
) )
1082 // create new webdav session
1084 = m_xSessionFactory
->createDAVSession( m_aURL
, m_aFlags
, m_xSMgr
);
1086 if ( !m_xSession
.is() )
1090 // Own URI is needed for redirect cycle detection.
1091 m_aRedirectURIs
.push_back( aURI
);
1096 // Not only the path has to be encoded
1097 m_aURL
= aURI
.GetURI();
1101 //=========================================================================
1102 const rtl::OUString
& DAVResourceAccess::getRequestURI() const
1104 OSL_ENSURE( m_xSession
.is(),
1105 "DAVResourceAccess::getRequestURI - Not initialized!" );
1107 // In case a proxy is used we have to use the absolute URI for a request.
1108 if ( m_xSession
->UsesProxy() )
1114 //=========================================================================
1116 void DAVResourceAccess::getUserRequestHeaders(
1117 const uno::Reference
< ucb::XCommandEnvironment
> & xEnv
,
1118 const rtl::OUString
& rURI
,
1119 const rtl::OUString
& rMethod
,
1120 DAVRequestHeaders
& rRequestHeaders
)
1124 uno::Reference
< ucb::XWebDAVCommandEnvironment
> xDAVEnv(
1125 xEnv
, uno::UNO_QUERY
);
1129 uno::Sequence
< beans::NamedValue
> aRequestHeaders
1130 = xDAVEnv
->getUserRequestHeaders( rURI
, rMethod
);
1132 for ( sal_Int32 n
= 0; n
< aRequestHeaders
.getLength(); ++n
)
1134 rtl::OUString aValue
;
1135 sal_Bool isString
= aRequestHeaders
[ n
].Value
>>= aValue
;
1139 OSL_ENSURE( isString
,
1140 "DAVResourceAccess::getUserRequestHeaders :"
1141 "Value is not a string! Ignoring..." );
1144 rRequestHeaders
.push_back(
1145 DAVRequestHeader( aRequestHeaders
[ n
].Name
, aValue
) );
1150 // Make sure a User-Agent header is always included, as at least
1151 // en.wikipedia.org:80 forces back 403 "Scripts should use an informative
1152 // User-Agent string with contact information, or they may be IP-blocked
1153 // without notice" otherwise:
1154 for ( DAVRequestHeaders::iterator
i(rRequestHeaders
.begin());
1155 i
!= rRequestHeaders
.end(); ++i
)
1157 if ( i
->first
.equalsIgnoreAsciiCase( "User-Agent" ) )
1162 rRequestHeaders
.push_back(
1163 DAVRequestHeader( "User-Agent", "LibreOffice" ) );
1166 //=========================================================================
1167 sal_Bool
DAVResourceAccess::detectRedirectCycle(
1168 const rtl::OUString
& rRedirectURL
)
1169 throw ( DAVException
)
1171 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1173 NeonUri
aUri( rRedirectURL
);
1175 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1176 std::vector
< NeonUri
>::const_iterator end
= m_aRedirectURIs
.end();
1180 if ( aUri
== (*it
) )
1189 //=========================================================================
1190 void DAVResourceAccess::resetUri()
1192 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
1193 if ( !m_aRedirectURIs
.empty() )
1195 std::vector
< NeonUri
>::const_iterator it
= m_aRedirectURIs
.begin();
1197 NeonUri
aUri( (*it
) );
1198 m_aRedirectURIs
.clear();
1199 setURL ( aUri
.GetURI() );
1204 //=========================================================================
1205 sal_Bool
DAVResourceAccess::handleException( const DAVException
& e
, int errorCount
)
1206 throw ( DAVException
)
1208 switch ( e
.getError() )
1210 case DAVException::DAV_HTTP_REDIRECT
:
1211 if ( !detectRedirectCycle( e
.getData() ) )
1213 // set new URL and path.
1214 setURL( e
.getData() );
1219 // #67048# copy & paste images doesn't display.
1220 // if we have a bad connection try again. Up to three times.
1221 case DAVException::DAV_HTTP_ERROR
:
1222 // retry up to three times, if not a client-side error.
1223 if ( ( e
.getStatus() < 400 || e
.getStatus() >= 500 ) &&
1229 // if connection has said retry then retry!
1230 case DAVException::DAV_HTTP_RETRY
:
1233 return sal_False
; // Abort
1237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */