diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-08-26 19:40:33 +0200 |
---|---|---|
committer | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-09-18 12:47:29 +0000 |
commit | 827cc09948c09d934dd32ca1867252618f761eab (patch) | |
tree | 7b1caa232639614899cca365f4f84e9c3dea30c0 /ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | |
parent | e592877844573fa5ab934b7ab3b13aaa33ed621d (diff) |
Related: tdf#101094 (31): Add a simulated HEAD method: use GET
Some server have HEAD method disabled or not implemented.
So we can use GET with no data, retrieving only the header info.
The implementing code comes from LO WebDAV serf implementation.
Change-Id: I3b3d81f5a07232c4f1647888685e820939bc978c
Reviewed-on: https://gerrit.libreoffice.org/28982
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Diffstat (limited to 'ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx')
-rw-r--r-- | ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx index 026186db347e..0cf396d8a717 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx @@ -497,6 +497,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(), + ucb::WebDAVHTTPMethod_GET, + rRequestHeaders ); + + xStream = m_xSession->GET( getRequestURI(), + rHeaderNames, + rResource, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + rRequestHeaders, xEnv ) ); + } + catch ( const 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, |