18590a0fdSAndre Fischer /************************************************************** 28590a0fdSAndre Fischer * 38590a0fdSAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 48590a0fdSAndre Fischer * or more contributor license agreements. See the NOTICE file 58590a0fdSAndre Fischer * distributed with this work for additional information 68590a0fdSAndre Fischer * regarding copyright ownership. The ASF licenses this file 78590a0fdSAndre Fischer * to you under the Apache License, Version 2.0 (the 88590a0fdSAndre Fischer * "License"); you may not use this file except in compliance 98590a0fdSAndre Fischer * with the License. You may obtain a copy of the License at 108590a0fdSAndre Fischer * 118590a0fdSAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 128590a0fdSAndre Fischer * 138590a0fdSAndre Fischer * Unless required by applicable law or agreed to in writing, 148590a0fdSAndre Fischer * software distributed under the License is distributed on an 158590a0fdSAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 168590a0fdSAndre Fischer * KIND, either express or implied. See the License for the 178590a0fdSAndre Fischer * specific language governing permissions and limitations 188590a0fdSAndre Fischer * under the License. 198590a0fdSAndre Fischer * 208590a0fdSAndre Fischer *************************************************************/ 218590a0fdSAndre Fischer 228590a0fdSAndre Fischer 238590a0fdSAndre Fischer #ifndef INCLUDED_SERFREQUESTPROCESSOR_HXX 248590a0fdSAndre Fischer #define INCLUDED_SERFREQUESTPROCESSOR_HXX 258590a0fdSAndre Fischer 268590a0fdSAndre Fischer #include <apr_errno.h> 278590a0fdSAndre Fischer #include <apr_pools.h> 288590a0fdSAndre Fischer 298590a0fdSAndre Fischer #include <serf.h> 308590a0fdSAndre Fischer 31*c1c10f68SAriel Constenla-Haile #include "DAVTypes.hxx" 32*c1c10f68SAriel Constenla-Haile #include "DAVResource.hxx" 33*c1c10f68SAriel Constenla-Haile #include "DAVException.hxx" 348590a0fdSAndre Fischer 35*c1c10f68SAriel Constenla-Haile #include "SerfInputStream.hxx" 368590a0fdSAndre Fischer #include <com/sun/star/io/XOutputStream.hpp> 378590a0fdSAndre Fischer 388590a0fdSAndre Fischer namespace http_dav_ucp 398590a0fdSAndre Fischer { 408590a0fdSAndre Fischer 418590a0fdSAndre Fischer class SerfSession; 428590a0fdSAndre Fischer class SerfRequestProcessorImpl; 438590a0fdSAndre Fischer 448590a0fdSAndre Fischer class SerfRequestProcessor 458590a0fdSAndre Fischer { 468590a0fdSAndre Fischer public: 478590a0fdSAndre Fischer SerfRequestProcessor( SerfSession& rSerfSession, 4849989859SOliver-Rainer Wittmann const rtl::OUString & inPath, 4949989859SOliver-Rainer Wittmann const bool bUseChunkedEncoding ); 508590a0fdSAndre Fischer ~SerfRequestProcessor(); 518590a0fdSAndre Fischer 528590a0fdSAndre Fischer // PROPFIND - allprop & named 538590a0fdSAndre Fischer bool processPropFind( const Depth inDepth, 548590a0fdSAndre Fischer const std::vector< ::rtl::OUString > & inPropNames, 558590a0fdSAndre Fischer std::vector< DAVResource > & ioResources, 568590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 578590a0fdSAndre Fischer 588590a0fdSAndre Fischer // PROPFIND - property names 598590a0fdSAndre Fischer bool processPropFind( const Depth inDepth, 608590a0fdSAndre Fischer std::vector< DAVResourceInfo > & ioResInfo, 618590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 628590a0fdSAndre Fischer 638590a0fdSAndre Fischer // PROPPATCH 648590a0fdSAndre Fischer bool processPropPatch( const std::vector< ProppatchValue > & inProperties, 658590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 668590a0fdSAndre Fischer 678590a0fdSAndre Fischer // GET 688590a0fdSAndre Fischer bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm, 698590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 708590a0fdSAndre Fischer 718590a0fdSAndre Fischer // GET inclusive header fields 728590a0fdSAndre Fischer bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm, 738590a0fdSAndre Fischer const std::vector< ::rtl::OUString > & inHeaderNames, 748590a0fdSAndre Fischer DAVResource & ioResource, 758590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 768590a0fdSAndre Fischer 778590a0fdSAndre Fischer // GET 788590a0fdSAndre Fischer bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm, 798590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 808590a0fdSAndre Fischer 818590a0fdSAndre Fischer // GET inclusive header fields 828590a0fdSAndre Fischer bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm, 838590a0fdSAndre Fischer const std::vector< ::rtl::OUString > & inHeaderNames, 848590a0fdSAndre Fischer DAVResource & ioResource, 858590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 868590a0fdSAndre Fischer 878590a0fdSAndre Fischer // HEAD 888590a0fdSAndre Fischer bool processHead( const std::vector< ::rtl::OUString > & inHeaderNames, 898590a0fdSAndre Fischer DAVResource & ioResource, 908590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 918590a0fdSAndre Fischer 928590a0fdSAndre Fischer // PUT 938590a0fdSAndre Fischer bool processPut( const char* inData, 948590a0fdSAndre Fischer apr_size_t inDataLen, 958590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 968590a0fdSAndre Fischer 978590a0fdSAndre Fischer // POST 988590a0fdSAndre Fischer bool processPost( const char* inData, 998590a0fdSAndre Fischer apr_size_t inDataLen, 1008590a0fdSAndre Fischer const rtl::OUString & inContentType, 1018590a0fdSAndre Fischer const rtl::OUString & inReferer, 1028590a0fdSAndre Fischer const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm, 1038590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 1048590a0fdSAndre Fischer 1058590a0fdSAndre Fischer // POST 1068590a0fdSAndre Fischer bool processPost( const char* inData, 1078590a0fdSAndre Fischer apr_size_t inDataLen, 1088590a0fdSAndre Fischer const rtl::OUString & inContentType, 1098590a0fdSAndre Fischer const rtl::OUString & inReferer, 1108590a0fdSAndre Fischer const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm, 1118590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 1128590a0fdSAndre Fischer 1138590a0fdSAndre Fischer // DELETE 1148590a0fdSAndre Fischer bool processDelete( apr_status_t& outSerfStatus ); 1158590a0fdSAndre Fischer 1168590a0fdSAndre Fischer // MKCOL 1178590a0fdSAndre Fischer bool processMkCol( apr_status_t& outSerfStatus ); 1188590a0fdSAndre Fischer 1198590a0fdSAndre Fischer // COPY 1208590a0fdSAndre Fischer bool processCopy( const rtl::OUString & inDestinationPath, 1218590a0fdSAndre Fischer const bool inOverwrite, 1228590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 1238590a0fdSAndre Fischer 1248590a0fdSAndre Fischer // MOVE 1258590a0fdSAndre Fischer bool processMove( const rtl::OUString & inDestinationPath, 1268590a0fdSAndre Fischer const bool inOverwrite, 1278590a0fdSAndre Fischer apr_status_t& outSerfStatus ); 1288590a0fdSAndre Fischer 1298590a0fdSAndre Fischer apr_status_t provideSerfCredentials( char ** outUsername, 1308590a0fdSAndre Fischer char ** outPassword, 1318590a0fdSAndre Fischer serf_request_t * inRequest, 1328590a0fdSAndre Fischer int inCode, 1338590a0fdSAndre Fischer const char *inAuthProtocol, 1348590a0fdSAndre Fischer const char *inRealm, 1358590a0fdSAndre Fischer apr_pool_t *inAprPool ); 1368590a0fdSAndre Fischer 1378590a0fdSAndre Fischer apr_status_t setupSerfRequest( serf_request_t * inSerfRequest, 1388590a0fdSAndre Fischer serf_bucket_t ** outSerfRequestBucket, 1398590a0fdSAndre Fischer serf_response_acceptor_t * outSerfResponseAcceptor, 1408590a0fdSAndre Fischer void ** outSerfResponseAcceptorBaton, 1418590a0fdSAndre Fischer serf_response_handler_t * outSerfResponseHandler, 1428590a0fdSAndre Fischer void ** outSerfResponseHandlerBaton, 1438590a0fdSAndre Fischer apr_pool_t * inAprPool ); 1448590a0fdSAndre Fischer 1458590a0fdSAndre Fischer serf_bucket_t* acceptSerfResponse( serf_request_t * inSerfRequest, 1468590a0fdSAndre Fischer serf_bucket_t * inSerfStreamBucket, 1478590a0fdSAndre Fischer apr_pool_t* inAprPool ); 1488590a0fdSAndre Fischer 1498590a0fdSAndre Fischer apr_status_t handleSerfResponse( serf_request_t * inSerfRequest, 1508590a0fdSAndre Fischer serf_bucket_t * inSerfResponseBucket, 1518590a0fdSAndre Fischer apr_pool_t * inAprPool ); 1528590a0fdSAndre Fischer 1538590a0fdSAndre Fischer //private: 1548590a0fdSAndre Fischer void prepareProcessor(); 1558590a0fdSAndre Fischer apr_status_t runProcessor(); 1568590a0fdSAndre Fischer void postprocessProcessor( const apr_status_t inStatus ); 1578590a0fdSAndre Fischer 1588590a0fdSAndre Fischer SerfSession& mrSerfSession; 1598590a0fdSAndre Fischer const char* mPathStr; 16049989859SOliver-Rainer Wittmann const bool mbUseChunkedEncoding; 1618590a0fdSAndre Fischer const char* mDestPathStr; 1628590a0fdSAndre Fischer const char* mContentType; 1638590a0fdSAndre Fischer const char* mReferer; 1648590a0fdSAndre Fischer SerfRequestProcessorImpl* mpProcImpl; 1658590a0fdSAndre Fischer 1668590a0fdSAndre Fischer bool mbProcessingDone; 1678590a0fdSAndre Fischer 1688590a0fdSAndre Fischer DAVException* mpDAVException; 1698590a0fdSAndre Fischer sal_uInt16 mnHTTPStatusCode; 1708590a0fdSAndre Fischer rtl::OUString mHTTPStatusCodeText; 1718590a0fdSAndre Fischer rtl::OUString mRedirectLocation; 1728590a0fdSAndre Fischer 173fb7f54d2SOliver-Rainer Wittmann sal_uInt8 mnSuccessfulCredentialAttempts; 174fb7f54d2SOliver-Rainer Wittmann bool mbInputOfCredentialsAborted; 1758590a0fdSAndre Fischer bool mbSetupSerfRequestCalled; 1768590a0fdSAndre Fischer bool mbAcceptSerfResponseCalled; 1778590a0fdSAndre Fischer bool mbHandleSerfResponseCalled; 1788590a0fdSAndre Fischer }; 1798590a0fdSAndre Fischer 1808590a0fdSAndre Fischer } // namespace http_dav_ucp 1818590a0fdSAndre Fischer 1828590a0fdSAndre Fischer #endif // INCLUDED_SERFREQUESTPROCESSOR_HXX 183